Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import pyvkfft.fft.fftn without OpenCL backends #21

Closed
jimmyjamison opened this issue Nov 21, 2022 · 0 comments
Closed

Cannot import pyvkfft.fft.fftn without OpenCL backends #21

jimmyjamison opened this issue Nov 21, 2022 · 0 comments
Assignees

Comments

@jimmyjamison
Copy link

I tried install pyvkfft with only cuda backends using VKFFT_BACKEND=CUDA CUDAHOME=/usr/local/cuda pip install pyvkfft

This runs and builds the wheel for pyvkfft without errors. After running, I can import and use the cuda pyvkfft planner without error

$ python
Python 3.9.10 (main, Sep  1 2022, 19:43:27) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyvkfft.cuda import VkFFTApp
>>> 

But if I try to import pyvkfft.fft.fftn I get an OSError

$ python
Python 3.9.10 (main, Sep  1 2022, 19:43:27) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyvkfft.fft import fftn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../venv/lib/python3.9/site-packages/pyvkfft/fft.py", line 28, in <module>
    from .opencl import VkFFTApp as VkFFTApp_cl, cla, vkfft_version
  File ".../venv/lib/python3.9/site-packages/pyvkfft/opencl.py", line 15, in <module>
    _vkfft_opencl = load_library("_vkfft_opencl")
  File ".../venv/lib/python3.9/site-packages/pyvkfft/base.py", line 117, in load_library
    return ctypes.cdll.LoadLibrary(os.path.join(os.path.dirname(__file__) or os.path.curdir, basename + ext))
  File ".../Python-3.9.10/Lib/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File ".../Python-3.9.10/Lib/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: .../venv/lib/python3.9/site-packages/pyvkfft/_vkfft_opencl.cpython-39-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory

Looking at the code for pyvkfft.fft it looks like it tries to handle the case where the OpenCL backend isn't installed

pyvkfft/pyvkfft/fft.py

Lines 27 to 33 in d75c620

try:
from .opencl import VkFFTApp as VkFFTApp_cl, cla, vkfft_version
has_opencl = True
except ImportError:
has_opencl = False

only I get an OSError not ImportError.

If I install pyvkfft with both OpenCL and cuda backends using CUDAHOME=/usr/local/cuda pip install pyvkfft things work

$ python
Python 3.9.10 (main, Sep  1 2022, 19:43:27) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyvkfft.fft import fftn
>>> 

but I'd like to use pyvkfft with only the Cuda backends installed.

@vincefn vincefn self-assigned this Nov 24, 2022
@vincefn vincefn closed this as completed in 66fe944 Jan 6, 2023
vincefn added a commit that referenced this issue Jan 6, 2023
* strides:
  Update notebooks
  Add support for F-ordered array in the simple fft interface (C2C and R2C). Fox use of opencl_platform in tests
  Fix tests using F-strided arrays. Allow to select the backend also for the basic test, and add the option to select the opencl platform.
  Check also for OSError in fftp.py. Should fix #21
  Also display the platforma and device name along vkfft error check
  Non-C-contiguous arrays: add systematic test, fix DCT check, upodate some doc and outputs
  Add support for non C-ordered arrays (F-order or different types of strides). Supports both C2C and R2C (as long as the fast axis is transformed). Adresses #20
  Update changelog
  More elegant re-ordering array during accuracy test, when necessary
  During accuracy tests, make sure the array after an R2C transform still has the fastest axis along the last dimension (X) - since this is not the case after a 2D numpy rfftn transform. Fixes #19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants