Skip to content

Instantly share code, notes, and snippets.

@debsankha
Last active March 25, 2016 18:02
Show Gist options
  • Save debsankha/104eb48cda4b4104a1f7 to your computer and use it in GitHub Desktop.
Save debsankha/104eb48cda4b4104a1f7 to your computer and use it in GitHub Desktop.
mpids-CUDA First meeting

Take home messages

  1. Using CUDA makes sense for massively parallelizable code, like matrix multiplication.
  2. But copying data from host memory (RAM) to GPU is slow.
  3. MATLAB has many CUDA aware functions. For testin, you can use MATLAB on sunna (node 01 - 08 only, please).
  4. Generating random numbers and copying it back to host RAM was seen to be about 3 times faster while using CUDA.
  5. But "raw" CUDA C/C++ needs a lot of boilerplate code to be written. Hecke tells me that this is changing/has changed a lot in newer versions of CUDA.

Using CUDA on sunna

Tell bash about CUDA

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

Have to use older GCC

export PATH=/usr/nld/gcc-4.6.3/bin:$PATH
export LD_LIBRARY_PATH=/usr/nld/gcc-4.6.3/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/nld/gcc-4.6.3/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/nld/mpc-0.9/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/nld/mpfr-3.1.1/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/nld/gmp-5.0.5/lib:$LD_LIBRARY_PATH

Test that you have the compiler

dmanik@sunna02:~> nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2012 NVIDIA Corporation
Built on Fri_Sep_21_17:28:58_PDT_2012
Cuda compilation tools, release 5.0, V0.2.1221

References

  1. A Nice presentation from NVIDIA (maybe old: (http://www.nvidia.com/docs/IO/116711/sc11-cuda-c-basics.pdf)
  2. Getting started guide from NVIDIA (https://developer.nvidia.com/how-to-cuda-c-cpp)
  3. Follow the links at #2.
  4. PyCUDA (https://documen.tician.de/pycuda/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment