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

Compiling instructions for new CUDA #11

Open
rodrigovimieiro opened this issue Dec 8, 2021 · 1 comment
Open

Compiling instructions for new CUDA #11

rodrigovimieiro opened this issue Dec 8, 2021 · 1 comment

Comments

@rodrigovimieiro
Copy link

Not really an issue. Just to help others who want to compile with new versions of CUDA.

CUDA Samples are not found in local installation anymore. Based on NVIDIA samples README:

Beginning in the next CUDA release, samples will be relocating from a local installation to GitHub! Please refer to our online repository for the most up-to-date CUDA samples and library examples: https://github.com/nvidia/cuda-samples

So, these are the steps:

  1. git clone https://github.com/NVIDIA/cuda-samples.git;
  2. Change -I/usr/local/cuda/samples/common/inc -I/usr/local/cuda/samples/shared/inc/ to -I/yourPath/cuda-samples/Common/ in the make_MC-GPU_v1.5b.sh file;
  3. Also, if using MPI, you need to install it sudo apt install libopenmpi-dev and the mpicc -showme command shows the path to the necessary libraries to compile mpi projects (based on this answer). Then substitute -I/usr/include/openmpi -L/usr/lib/ -lmpi with the output from the previous command.

This command works for me:

nvcc MC-GPU_v1.5b.cu -o MC-GPU_v1.5b.x -m64 -O3 -use_fast_math -DUSING_MPI -I. -I/usr/local/cuda/include -I/home/rodrigo/NVIDIA_CUDA-11.5_Samples/cuda-samples/Common/ -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi -lz --ptxas-options=-v -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_61,code=sm_61

Environment:

  • Ubuntu 21.1
  • CUDA 11.5
  • Nvidia Driver Version: 495.44
  • GeForce RTX 2080 SUPER
@jerichooconnell
Copy link

jerichooconnell commented Aug 8, 2022

Not really an issue either but I thought it would be good for me as much as anyone to leave instructions to run MCGPU on docker on a similar note to @rodrigovimieiro

First you need to install docker to work with your gpu drivers:

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html

Then:

  1. Pull the nvidia docker image docker pull nvidia/cuda:11.2.1-devel-ubuntu20.04 or whichever docker version you would like.
  2. Run the docker instance interactively with your shell using your gpu docker run -it --gpus all nvidia/cuda:11.2.0-devel-ubuntu20.04 bash
  3. Install libraries that you need:
apt-get update # update apt listings
apt install zlib1g-dev
apt install openmpi-dev
apt install git-all
apt install vim # optional for editing the makefile
  1. Follow the steps above for cloning the cuda samples and changing the makefile
  2. I had to include the compute 75 instructions in the makefile to get mine to run:
nvcc MC-GPU_v1.5b.cu -o MC-GPU_v1.5b.x -m64 -O3 -use_fast_math -DUSING_MPI -I. -I/usr/local/cuda/include -I/root/cuda-samples/Common/ -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi -lz --ptxas-options=-v -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_75,code=sm_75

Environment (locally, so shouldn't really matter other than GPU):

  • Ubuntu 20.04
  • CUDA 11.2
  • Nvidia driver 460.106
  • GeForce RTX 2070

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