CUDA.jl icon indicating copy to clipboard operation
CUDA.jl copied to clipboard

remove calling initialize automatically

Open pluskid opened this issue 10 years ago • 1 comments

Hi, I noticed that initialize is automatically called when the CUDA module is imported. I think it's better to let the user to make that call explicitly: the users will need to setup device and context explicitly any way.

My problem here is that I'm writing a module that could either use GPU or CPU to carry out computation. The GPU code will be called only when the user explicitly choose to do it. However, currently I need to import CUDA module in order to define my functions, which uses some functions and types in the CUDA library. The problem is, since the CUDA driver is initialized upon importing the module, even the user is not intended to use GPU. What's worse is, when the user run it on a node without a GPU device, the code will simply fail upon importing.

pluskid avatar Oct 30 '14 16:10 pluskid

I can prepare a pull request if needed: removing the initialize call in base, and fix the example code by calling initialize explicitly.

pluskid avatar Oct 30 '14 16:10 pluskid