cuDeviceGetCount() is rather important for creating contexts when you want to support multiple devices. You have no idea how many GPUs your user has plugged in! Using the method from DriverAPINativeMethods is of course clunky, since you're going to then have to deal with cuInit() most of the time.
Is there any chance of adding a proper DeviceGetCount() function to the managed API?
From:
static member Contexts =
let devCount = ref 0
DriverAPINativeMethods.cuInit(CUInitializationFlags.None) |> ignore
DriverAPINativeMethods.DeviceManagement.cuDeviceGetCount(devCount) |> ignore
//Error handling??!
[|
for n in [0..!devCount-1] do
yield new CudaContext (n)
|]
To:
static member Contexts =
[|
for n in [0..DeviceGetCount()-1] do
yield new CudaContext (n)
|]
cuDeviceGetCount() is rather important for creating contexts when you want to support multiple devices. You have no idea how many GPUs your user has plugged in! Using the method from DriverAPINativeMethods is of course clunky, since you're going to then have to deal with cuInit() most of the time.
Is there any chance of adding a proper DeviceGetCount() function to the managed API?
From:
To: