I have compiled my cuda script via the following command into a shared library :
nvcc --ptxas-options=-v --compiler-options '-fPIC' -o test_function.so mologram.cu
Then, in Python:
import ctypes
from numpy.ctypeslib import ndpointer
lib = ctypes.cdll.LoadLibrary('./test_function.so')
Throws the following error message:
OSError Traceback (most recent call last)
<ipython-input-12-02ce09d7f391> in <module>()
2 from numpy.ctypeslib import ndpointer
3
----> 4 lib = ctypes.cdll.LoadLibrary('./test_function.so')
/usr/lib/python2.7/ctypes/__init__.pyc in LoadLibrary(self, name)
438
439 def LoadLibrary(self, name):
--> 440 return self._dlltype(name)
441
442 cdll = LibraryLoader(CDLL)
/usr/lib/python2.7/ctypes/__init__.pyc in __init__(self, name, mode, handle, use_errno, use_last_error)
360
361 if handle is None:
--> 362 self._handle = _dlopen(self._name, mode)
363 else:
364 self._handle = handle
OSError: ./test_function.so: cannot dynamically load executable
I have done similar scripts in the past and never encounter this error. I am baffled as to why this error message appears.
Any input appreciated