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

NVIDIA CUDA Toolkit 9.1 from Ubuntu build error #35

Open
paskino opened this issue Feb 18, 2021 · 3 comments
Open

NVIDIA CUDA Toolkit 9.1 from Ubuntu build error #35

paskino opened this issue Feb 18, 2021 · 3 comments

Comments

@paskino
Copy link

paskino commented Feb 18, 2021

On a Ubuntu 18.04 I cannot build NiftyPET. See SyneRBI/SIRF-SuperBuild#494

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

I ran

sudo apt update
sudo apt upgrade
sudo apt install python3-dev
sudo apt install nvidia-cuda-toolkit
sudo snap install --classic cmake
wget https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py
python3 get-pip.py --user
python3 -m pip install --user 'numpy==1.19.5'  # no need to specify version. just testing...
git clone https://github.com/NiftyPET/NIPET nipet
mkdir nipet/build
cd nipet/build
cmake ../niftypet && cmake --build .

Error

[  4%] Building CUDA object nipet/CMakeFiles/mmr_auxe.dir/src/aux_module.cu.o
cd /home/ofn77899/nipet/build/nipet && /usr/bin/nvcc  -Dmmr_auxe_EXPORTS -I/home/ofn77899/nipet/niftypet/nipet/src -I/usr/include/python3.6m -I/home/ofn77899/.local/lib/python3.6/site-packages/numpy/core/include -I/home/ofn77899/nipet/niftypet/nipet/include -O3 -DNDEBUG --generate-code=arch=compute_30,code=[compute_30,sm_30] -Xcompiler=-fPIC -std=c++14 -x cu -c /home/ofn77899/nipet/niftypet/nipet/src/aux_module.cu -o CMakeFiles/mmr_auxe.dir/src/aux_module.cu.o
/home/ofn77899/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h(84): error: expected a "}"

/home/ofn77899/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h(89): warning: parsing restarts here after previous syntax error

/home/ofn77899/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h(450): error: identifier "NPY_NTYPES_ABI_COMPATIBLE" is undefined

2 errors detected in the compilation of "/tmp/tmpxft_00005c59_00000000-6_aux_module.cpp1.ii".

I then tried to install CUDA Toolkit from NVidia, and got 10.1. With it it works, both with conda and stock python.

Maybe 9.1, which is installed by Ubuntu is not sufficient for NiftyPET?

@casperdcl
Copy link
Member

I think cuda 9.2 (which is quite old now) requires an old g++ (<7.3) yet based on SyneRBI/SIRF-SuperBuild#494 (comment) you have 7.5.

The cuda compiler version has to be compatible with the C++ compiler. The usual way of installing CUDA is via https://developer.nvidia.com/cuda-toolkit-archive, which firstly uses apt-get install cuda rather than nvidia-cuda-toolkit and secondly doesn't even provide CUDA 9 for Ubuntu 18.04.

Don't mix and match deprecated things with new things!

@casperdcl
Copy link
Member

By any chance, does replacing -std=c++14 with -std=c++11 fix things for you?

@paskino
Copy link
Author

paskino commented Feb 18, 2021

I installed nvidia-cuda-toolkit following a suggestion of ubuntu itself after I called nvcc on the machine where it wasn't installed!

-std=c++11 doesn't help.

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