deepdrr
deepdrr copied to clipboard
Fix issue #69
Fixes issue #69 by reusing cuda primary context instead of creating one through pycuda.autoinit. When the gpu is to be used by the projector, this primary context is made active and then deactivated when not needed anymore. This at least prevents conflicts when importing deepdrr and using PyTorch with cuda afterwards.
Testing with a Nvidia GeForce GTX 1080 Ti worked but when I switched to a GTX 1070, it didn't work anymore and crashed the python process and made the GPU unavailable. So I think something strange is happening on PyCuda's part
This was a quick and dirty fix to get it working with my pipeline which includes using deepdrr to generate projections and then PyTorch to make predictions on the GPU on the projections. However, it did not fix the conflict when using the GPU with PyTorch at the same time as the pycuda context was open. This issue produced constant 0 projection images. Is the conflict between pycuda and PyTorch fixed now ?
This issue resolved by using Cupy instead of Pycuda.