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

Building Sphericart-torch from source fails without specifying architecture and/or compiler (solution included) #133

Closed
amunozj opened this issue Aug 14, 2024 · 6 comments

Comments

@amunozj
Copy link

amunozj commented Aug 14, 2024

Hello friends! I have been trying to install sphericart-torch from source into a conda environment so that I can use the GPU, but had a very hard time. I kept getting errors like this:

CMake Error at /tmp/pip-build-env-h_izynb9/overlay/lib/python3.12/site-packages/cmake/data/share/cmake-3.30/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake:7 (message): CMAKE_CUDA_ARCHITECTURES must be non-empty if set.

In the end I solved adding this two lines to: 'sphericart-torch/ CMakeLists.txt'

set(CMAKE_CUDA_ARCHITECTURES "native") set(CMAKE_CUDA_COMPILER /usr/local/cuda-12.4/bin/nvcc)

I'm posting this here, in case somebody else has this issue. Once you add these lines, you'll have to delete the build folders inside the root of the repository and the sphericart-torch folder

@frostedoyster
Copy link
Collaborator

Thanks @amunozj!
@nickjbrowning Aren't we already building for all architectures?

@amunozj
Copy link
Author

amunozj commented Aug 19, 2024

@frostedoyster looking in more detail I found someone reporting that this error is a CMAKE red herring, and the actual problem is no setting the CMAKE_CUDA_COMPILER .

@frostedoyster
Copy link
Collaborator

Thanks a lot for the report and also for the solution! You're right that it's most likely not a CUDA architecture issue. Let's wait for @nickjbrowning's opinion on this and then we'll see if we can add something in the installation scripts and/or in the documentation

@amunozj
Copy link
Author

amunozj commented Aug 20, 2024

Hi @frostedoyster and @nickjbrowning I have been installing it in more machines and I can confirm that the actual problem, and solution is pointing at the system cuda compiler properly. My struggle (and what I suppose will be a problem for others) is that I'm installing sphericart inside a conda environment that natively has an incomplete cuda installation. This makes pip try to find the compiler and libraries inside the conda environment, not find them, and crash. The solution is adding the path to the actual compiler of your system in all the CMakeLists.txt you plan to run.

Now, since we are chatting, let me also thank you for sphericart. I looked, and looked, and looked, and looked, and could not find anything like it so thank you from the bottom of my heart because it works really well and addresses a huge need I had.

Also, I was wondering, why don't you provide the Torch build for CUDA as part of PyPI? The challenge I faced is that the PyPI package doesn't have CUDA support and I want to use sphericart to define Kolmogorov-Arnold layers, which need to train on the GPU. If you provide the CUDA sphericart directly on PyPI, only super-users will have to build it manually. Please keep up the great job and thank you for your service to the community!

@nickjbrowning
Copy link
Collaborator

nickjbrowning commented Aug 28, 2024

Sorry about my lack of response on this issue - I've been on holiday. The way to build CUDA-enabled sphericart is downloading and installing the CUDA SDK separately and setting your CUDA_HOME to that, as well as making sure the variables LD_LIBRARY_FLAGS and PATH are updated to the relevant paths. You're right that the conda package for the CUDA SDK is incomplete - I'm not sure why this is the case I've not looked into it.

Regarding providing the packaging on PyPi - we are actually working on runtime compilation of sphericart-cuda through NVRTC. Once this is complete we should be able to provide a CPU-only package on PyPi, which will build and link the sphericart-cuda libraries dynamically if CUDA_HOME has been set - this should hide away some of the packaging/installation.

perhaps the best solution is to update the docs @frostedoyster @Luthaf to make sure users install the SDK prior to trying to build CUDA-sphericart? I'm not sure yet how this will change when we swap over to runtime compilation...

@frostedoyster
Copy link
Collaborator

Ok! Added to the documentation on installation in #143

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

3 participants