SyneRBI / SIRF-SuperBuild

SIRF CMake SuperBuild
http://www.ccpsynerbi.ac.uk
Apache License 2.0
15 stars 17 forks source link

CUDA enabled Gadgetron #619

Open Imraj-Singh opened 2 years ago

Imraj-Singh commented 2 years ago

I have partitioned my hard drive and I am running SIRF on Ubuntu 20.04 as part of a dual boot. After a fresh install of Ubuntu 20.04 I download the drivers necessary for my GPU (Nvidia GeForce GTX 1650 Ti) and the latest CUDA release (11.4 update 2). These seem to work fine when checking $ nvidia-smi and $ nvcc --version. I install some basic packages $ sudo apt install build-essential git g++. I run the install files which are used to set up the VM the prerequities, CMake, and python. In addition, I install $ sudo apt-get install autotools-dev automake autogen autoconf libtool cython3 python3-h5py python3-wget which are required to build CIL. I export gcc and g++ compilers with $ export CXX=g++-8 CC=gcc-8.

With CMake I configure the build with $ cmake ~/path/to/superbuild/ -DUSE_SYSTEM_SWIG=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_Armadillo=ON -DUSE_SYSTEM_FFTW3=ON DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_ITK=ON -DBUILD_CIL=ON. I build with $ make -k -j6 and it fails with Gadgetron. Once built I update the .bashrc with $ /path/to/env_sirf.sh, I restart the terminal and attempt to start Gadgetron, and the error $ gadgetron: command not found appears. Regardless I move on and run the $ ctest --verbose, as expected Gadgetron tests fail, but all other tests are passed with CUDA enabled and working. Changing the configuration by disabling CUDA for Gadgetron I am able to successfully build Gadgetron and pass all tests. Is there anything else required to build CUDA enabled Gadgetron? Thanks.

If you require any files please let me know.

KrisThielemans commented 2 years ago

best to load a log file for the failed compilation. e.g.

make -k -j6 Gadgetron 
make Gadgetron > comp.log
Imraj-Singh commented 2 years ago

comp.log

paskino commented 2 years ago

The log seems to be cut.

I see

-- Could NOT find CBLAS (missing: CBLAS_LIBRARY CBLAS_INCLUDE_DIR)

this should be in the libatlas-base-dev package, I think.

You seem to be missing a number of other packages: https://github.com/SyneRBI/SyneRBI_VM/blob/58aa7e323dcf72fa76937da5f28999529f9441e7/scripts/INSTALL_prerequisites_with_apt-get.sh#L23-L27

but I cannot say if that would be a problem for the build. You say it builds without CUDA.

paskino commented 2 weeks ago

Currently (7/2/24) with cuda enabled, Gadgetron build fails as

34 errors detected in the compilation of "/opt/SIRF-SuperBuild/sources/Gadgetron/toolboxes/nfft/gpu/cuGriddingConvolution.cu".

See also https://github.com/gadgetron/gadgetron/issues/1231

KrisThielemans commented 2 weeks ago

I see

-- Could NOT find CBLAS (missing: CBLAS_LIBRARY CBLAS_INCLUDE_DIR)

this should be in the libatlas-base-dev package, I think.

The cblas.h situation is a mess: https://github.com/conda-forge/blas-feedstock/issues/111. Gadgetron's requirements.yml uses MKL for blas, which installs mkl_cblas.h. When using MKL, you need to set Gadgetron_USE_MKL=ON (as documented in our README)