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

Linking of cudart #579

Open
gfardell opened this issue Sep 9, 2024 · 1 comment
Open

Linking of cudart #579

gfardell opened this issue Sep 9, 2024 · 1 comment

Comments

@gfardell
Copy link
Contributor

gfardell commented Sep 9, 2024

As you know, for use with CIL we build tigre with conda and host under the ccpi channel

The environment we build in to contains the right version of the cudart redistributable shared library, and this should be automatically found and linked when running within the virtual environment.

However we have an issue where users need to install the cuda sdk installed in order to run tigre.

Commenting out these lines:

if hasattr(os, "add_dll_directory"):
# Add all the DLL directories manually
# see:
# https://docs.python.org/3.8/whatsnew/3.8.html#bpo-36085-whatsnew
# https://stackoverflow.com/a/60803169/19344391
dll_directory = os.path.dirname(__file__)
os.add_dll_directory(dll_directory)
# The user must install the CUDA Toolkit
cuda_bin = os.path.join(os.environ["CUDA_PATH"], "bin")
os.add_dll_directory(cuda_bin)

The correct version of cudart is found automatically. With conda it's in somewhere like C:\Users\[USER]\miniforge3\envs\[ENV]\Library\bin

With the lines it forces it to use the system installation - which if you're building and running on the same system isn't an issue but obviously our aim is easy redistribution and CUDA_HOME is therefore often None. Even if it's not None it may not point to the right CUDA version.

I've read through the linked issues to the code, and still struggle to see why it would be necessary if PATH was set correctly to something like: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin which contains cudart.

Specifications

  • MATLAB/python version: Python 3.10/3.11/3.12
  • OS: win11 (and confirmed on win10)
  • CUDA version: Building with 11.8, but previously had 10.2
@AnderBiguri
Copy link
Member

Heya,

Admittedly, I don't know why this was changed. It always worked for me. I wonder if it for the cases where users install CUDA but not add it to PATH?

Is there maybe an alternative we can add that joins two things? something like if built_via_conda: elif hasattr(os, "add_dll_directory"): that we can do, such that everyone is happy? All this is not much my strength admitedly.

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