OpenPIV / openpiv-python-gpu

GPU accelerated version of OpenPIV in Python
https://drive.google.com/open?id=1yMWm2FpjFXG8l94632gE1GsMRZqUTs16
GNU General Public License v3.0
19 stars 7 forks source link

Google Colaboratory example not working anymore #3

Open benediktbrandt opened 3 years ago

benediktbrandt commented 3 years ago

The example code Openpiv_Python_Cython_GPU_demo.ipynb run in Googles Colaboratory (at import pycuda.autoinit) throws the following error:

/usr/local/lib/python2.7/dist-packages/pycuda/driver.py:66: UserWarning: Failed to import the CUDA driver interface, with an error message indicating that the version of your CUDA header does not match the version of your CUDA driver.
  warn("Failed to import the CUDA driver interface, with an error "

ImportErrorTraceback (most recent call last)
<ipython-input-4-6b190a107c72> in <module>()
      1 # check to make sure PyCUDA installed properly
----> 2 import pycuda.autoinit

1 frames
/usr/local/lib/python2.7/dist-packages/pycuda/driver.py in <module>()
     60 
     61 try:
---> 62     from pycuda._driver import *  # noqa
     63 except ImportError as e:
     64     if "_v2" in str(e):

ImportError: /usr/local/lib/python2.7/dist-packages/pycuda/_driver.so: undefined symbol: cuIpcOpenMemHandle_v2
alexlib commented 3 years ago

thanks for pointing it out. Do you have by any chance a thought how to solve it? @benediktbrandt I'm not an expert on PyCUDA and I believe we should move it to Python 3 anyhow. Could you please check that when you select Google Runtime - Python 3 -

benediktbrandt commented 3 years ago

If I change the runtime to python3 in colab I get this error:

ImportError: /usr/local/lib/python3.6/dist-packages/pycuda/_driver.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cuDevicePrimaryCtxRelease_v2

I have played around with this quite extensively and even locally I couldn't get python 3 to work, no matter what CUDA toolkit / pycuda version I tried. The failure cause was always an incompatible c++ signature in pycuda (seemingly python 2 does an implicit cast from np.int64 to unsinged long long which python 3 does not do). Not sure whether the root cause for this is a bug in pycuda or something in the openpiv-gpu code.

However I was able to get the notebook to work locally with python 2.7, CUDA toolkit 9.0, gcc 6, pip installed scikit-cuda and latest pip package versions for everything.

alexlib commented 3 years ago

Thanks for letting us know @benediktbrandt

On Fri, Oct 16, 2020 at 11:48 PM benediktbrandt notifications@github.com wrote:

If I change the runtime to python3 in colab I get this error:

ImportError: /usr/local/lib/python3.6/dist-packages/pycuda/_driver.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cuDevicePrimaryCtxRelease_v2

I have played around with this quite extensively and even locally I couldn't get python 3 to work, no matter what CUDA toolkit / pycuda version I tried. The failure cause was always an incompatible c++ signature in pycuda (seemingly python 2 does an implicit cast from np.int64 to unsinged long long which python 3 does not do). Not sure whether the root cause for this is a bug in pycuda or something in the openpiv-gpu code.

However I was able to get the notebook to work locally with python 2.7, CUDA toolkit 9.0, gcc 6, pip installed scikit-cuda and latest pip package versions for everything.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenPIV/openpiv-python-gpu/issues/3#issuecomment-710605038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFWMZQKLXU455TRRL53OI3SLCWQTANCNFSM4SN5TG7A .

CameronDallas5000 commented 3 years ago

Hi @benediktbrandt, thanks for bringing this to my attention! I'm glad you found a way to get the demo running through Python2 and using the old Cuda toolkit. Unfortunately, when I wrote this, Python2 was the only option. I think to truly fix this issue I need to update the code to run with Python3 as there are sections of the code right now that are not compatible with that. I'll keep this issue open as a reminder to me to update this at some point when I have some time. Let me know if in the meantime I can help with anything else.