I want to run pycuda from an IPython notebook on a Linux laptop with NVIDIA Optimus (bumblebee). Usually, I can get a python script running by typing optirun python my_pycuda_script.py
But if I start optirun ipython notebook
and then open a notebook, a new Kernel starts and I cannot run pycuda anymore. I found that if I replace my python executable by a shell script that calls optirun new_location_of_python
it is working - but this is a pretty ugly hack. Is there a better way to do this? Maybe with a magic function, so that only the relevant notebooks are started with optirun?
Thanks for any help!