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

Installation with GPU support #584

Closed
ercius opened this issue May 10, 2022 · 5 comments
Closed

Installation with GPU support #584

ercius opened this issue May 10, 2022 · 5 comments
Labels
question Troubleshooting requests

Comments

@ercius
Copy link

ercius commented May 10, 2022

Describe the problem
Im trying to install tomopy in a Docker container using the NVIDIA and miniconda pre-built images for Ubuntu 20. The build instructions simply say to install tomopy using conda and if which nvcc returns a path it will work. Is this still true? Or are there different build instructions for GPU accelerated tomopy?

I saw other issues where users had problems enabling the GPU, but most posts simply said "I followed the build instructions." Im not sure which build instructions are being referred to.

BTW: Installing astra-toolbox using conda provided GPU accelerated algorithms (not through tomopy). So, Im sure the container can access the GPUs.

@ercius ercius added the question Troubleshooting requests label May 10, 2022
@ercius ercius changed the title Single line summary of the problem here Installation with GPU support May 10, 2022
@carterbox
Copy link
Member

You don't need nvcc if you are installing tomopy using conda. Pre-built tomopy with and without GPU support are available on the conda-forge channel. You can see whether you have installed the CUDA version or not by looking at the build string:

tomopy                        1.11.0 cuda11.2py39hfc7db82_1  conda-forge         
tomopy                        1.11.0 py310h8d81d44_101  conda-forge  

If you need to build tomopy for some reason, then follow the development guide. TomoPy currently uses scikit-build to run CMake from the setup script.

@ercius
Copy link
Author

ercius commented May 11, 2022

Thanks for the information. I do not need to build it from scratch. Conda is much preferred.

I checked my version with conda list tomopy which says:

# Name                    Version                   Build  Channel
tomopy                    1.11.0          py39h10ffb3b_101    conda-forge

So, using miniconda and conda -c conda-forge install tomopy did not install the GPU accelerated version automatically on my system.

To install the GPU package you need to specify the specific version of tomopy and the specific build. A list of all available versions is here. Here is an example line which will install tomopy 1.11.0 for CUDA 11.2 and python 3.9.
conda install -c conda-forge tomopy=1.11.0=cuda11.2py39hfc7db82_1

After running that line above I was able to successfully reconstruct using the sirt with with accelerated=True.

I uploaded a docker container with CUDA 11, tomopy (with GPU support), and ASTRA here in case others find it useful.

@carterbox
Copy link
Member

You can also install using something like:

$ conda install tomopy=*=cuda*

or I think this also works:

$ conda install tomopy cudatoolkit

@carterbox carterbox pinned this issue May 11, 2022
@matangpanchal
Copy link

@carterbox @ercius

Is it possible to install Tomopy with GPU support on Windows 10 64 bit Also ?,
I tried installing using

$ conda install tomopy==cuda
Then package manager is not able to find any library,
So I tried

$ conda install tomopy cudatoolkit

In this case it installed properly from Conda-Forge channel,
Now when I am trying to reconstruct using MLEM Accelerated Version, it shows me error :

  • "ModuleNotFoundError: The MLEM ACCEL algorithm is unavailable because its shared library is missing. Check CMake logs to determine if TomoPy was built with all dependencies required by this algorithm."

The code I am using is :

recon = tomopy.recon(proj, theta, center=rCentre, algorithm='mlem', num_iter=2, ncore=1, accelerated=True, device='gpu')

Do I need to install something separately ?

output of "conda list tomopy " is

Name Version Build Channel

tomopy 1.12.2 pyhd8ed1ab_1 conda-forge

output of "conda list cudatoolkit"

packages in environment at C:\Users\admin.conda\envs\gtomopy:

Name Version Build Channel

cudatoolkit 11.8.0 h09e9e62_11 conda-forge
Will you please guide me ASAP ?

@carterbox
Copy link
Member

The way to force CUDA installation is now

$ conda install tomopy libtomo=*=cuda*

Because the compiled libraries have been separated in to a different package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Troubleshooting requests
Projects
None yet
Development

No branches or pull requests

3 participants