Parallel Programming With CUDA Tutorial (Part-1: Setup)

STEP 1: Installing CUDA toolkit

sudo apt-get install nvidia-cuda-toolkit

STEP 2: Installing g++ 4.8

sudo apt-get install g++-4.8

STEP 3: Installing Geany

sudo apt-get install geany
  • Save your code in a text file with extension .cu . Example:
  • Compile code using nvcc -o filename command.
  • Run code using ./filename command.
  • In order to run your code with profiling use nvprof --unified-memory-profiling off ./filename This “--unified-memory-profiling off” is used because without it nvprof creates error sometimes. So you may give it a try without using it and see if you get any error. (What is profiling? It helps us measure the performance of our code.)

STEP 4: Configuring Geany

  1. Open Geany
  2. Open a new file and save it with .cu extension
  3. Copy the following block of codes. I will explain the code in the next tutorial.



CS @ U of Dhaka.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store