kunzmi / managedCuda

ManagedCUDA aims an easy integration of NVidia's CUDA in .net applications written in C#, Visual Basic or any other .net language.
Other
440 stars 79 forks source link

ManagedCuda.CudaBlas.CudaBlasException : NotInitialized: The CUBLAS library was not initialized #85

Open mrorigo opened 4 years ago

mrorigo commented 4 years ago

I am having an issue with getting even the most basic Cuda support working. I have Cuda 10.0 installed, and using the latest cloned ManagedCuda repo.

When trying to create a GPU Volume, I get the following exception:

ManagedCuda.CudaBlas.CudaBlasException : NotInitialized: The CUBLAS library was not initialized.
  Stack Trace:
     at ManagedCuda.CudaBlas.CudaBlas..ctor()
   at ConvNetSharp.Volume.GPU.GpuContext..ctor(Int32 deviceId) in D:\Code\ConvNetSharp\src\ConvNetSharp.Volume.GPU\GpuContext.cs:line 18
   at ConvNetSharp.Volume.GPU.GpuContext.<>c.<.cctor>b__31_0() in D:\Code\ConvNetSharp\src\ConvNetSharp.Volume.GPU\GpuContext.cs:line 11
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at ConvNetSharp.Volume.GPU.GpuContext.get_Default() in D:\Code\ConvNetSharp\src\ConvNetSharp.Volume.GPU\GpuContext.cs:line 40
   at ConvNetSharp.Volume.GPU.Double.VolumeBuilder..ctor() in D:\Code\ConvNetSharp\src\ConvNetSharp.Volume.GPU\Double\VolumeBuilder.cs:line 7
   at tests.MLTest1.Test1() in D:\Code\MLTest1.cs:line 22
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
kunzmi commented 4 years ago

Apperently you are using ConvNetSharp? I don't know much about that project… But from the error message I can see that you are trying to use a CUBLAS function without initializing the library first. In managedCuda speech, create a CudaBLAS object first.