
gust.util.cuda.CuDevice.scala Maven / Gradle / Ivy
The newest version!
package gust.util.cuda
import jcuda.driver.{JCudaDriver, CUdevice}
/**
* TODO
*
* @author dlwh
**/
class CuDevice(val device: CUdevice) {
override def toString = device.toString
}
object CuDevice {
implicit lazy val defaultDevice = {
apply(0)
}
def apply(deviceNumber: Int):CuDevice = {
JCudaDriver.cuInit(0)
JCudaDriver.setExceptionsEnabled(true)
val device = new CUdevice
JCudaDriver.cuDeviceGet(device, deviceNumber)
new CuDevice(device)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy