title: IPython notebook with optirun
body: <p>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 <code>optirun python my_pycuda_script.py</code> </p>
  
  <p>But if I start <code>optirun ipython notebook</code> 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 <code>optirun new_location_of_python</code> 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?  </p>
  
  <p>Thanks for any help!</p>