Dana Vrajitoru
B424 Parallel and Distributed Programming

B424 B524 Lab 1

Date: Thursday, December 3, 2020.
Due date: Thursday, December 10, 2020.

Ex. 1. Cuda Settings

Edit the file .bashrc in your /home/username/ folder, and add the following path to the variable PATH, at the end of the current content, separated by the ":" character from the previous one:
/usr/local/cuda-10.1/bin/

Then still in your home folder, execute the command
source .bashrc
to make the content of this file take effect. Then execute the command
which nvcc
to make sure that the shell can find this command. It should return the path above as result.

Ex. 2. Running a Cuda application

Download the following files:
Makefile
hello_cuda.cc
sum1.cc

Compile the files with the command make. It creates two executables, hello and sum1. They can be run as simple commands.

Examine each of the files and try to explain the result.

Create a copy of the file sum1.cc as sum2.cc and modify the addition function to perform the addition using threads instead of blocks, then another copy called sum3.cc where the addition is using both blocks and threads. Modify the Makefile to add compilation commands and targets for these two new files.

Homework Submission

Upload: to Canvas, Assignments, Lab 1, the files sum2.cc and sum3.cc.