Skip to content

Commit

Permalink
update dependencies and better error handling (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
daurer authored Mar 5, 2024
1 parent ebf8deb commit c9d7bac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cufft/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: ptypy_cufft
channels:
- conda-forge
- nvidia
dependencies:
- python
- cmake>=3.8.0
- pybind11
- compilers
- cudatoolkit-dev
- cuda-nvcc
- cuda-cudart-dev
- libcufft-dev
- libcufft-static
- pip
5 changes: 5 additions & 0 deletions cufft/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def locate_cuda():
cudaconfig = {'home': home, 'nvcc': nvcc,
'include': os.path.join(home, 'include'),
'lib64': os.path.join(home, 'lib64')}

# If lib64 does not exist, try lib instead (as common in conda env)
if not os.path.exists(cudaconfig['lib64']):
cudaconfig['lib64'] = os.path.join(home, 'lib')

for k, v in cudaconfig.items():
if not os.path.exists(v):
raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
Expand Down
13 changes: 10 additions & 3 deletions cufft/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@
)
cmdclass = {"build_ext": CustomBuildExt}
EXTBUILD_MESSAGE = "The filtered cufft extension has been successfully installed.\n"
except:
except EnvironmentError as e:
EXTBUILD_MESSAGE = '*' * 75 + "\n"
EXTBUILD_MESSAGE += "Could not install the filtered cufft extension.\n"
EXTBUILD_MESSAGE += "Make sure to have CUDA >= 10 and pybind11 installed.\n"
EXTBUILD_MESSAGE += "Make sure to have CUDA >= 10 installed.\n"
EXTBUILD_MESSAGE += '*' * 75 + "\n"

EXTBUILD_MESSAGE += 'Error message: ' + str(e)
except ImportError as e:
EXTBUILD_MESSAGE = '*' * 75 + "\n"
EXTBUILD_MESSAGE += "Could not install the filtered cufft extension.\n"
EXTBUILD_MESSAGE += "Make sure to have pybind11 installed.\n"
EXTBUILD_MESSAGE += '*' * 75 + "\n"
EXTBUILD_MESSAGE += 'Error message: ' + str(e)

exclude_packages = []
package_list = setuptools.find_packages(exclude=exclude_packages)
setup(
Expand Down

0 comments on commit c9d7bac

Please sign in to comment.