HP3 CUDA Programming

Parallel Programming on the GPU

Tutorial 1: Basic CUDA Programs for vector addition and matrix multiplication

Objective

This assignment will simply help you understand the basics of understanding and running a standard CUDA project in google colab environment and HPC server. After going through this, you should have a clear idea of the following points.

  1. Using Google Colab environment for compiling and executing CUDA program.
  2. Understand the basic keywords associated with kernel functions and important functions in the host code for vector addition.
  3. Logging into a remote GPU cluster and using a workload manager to execute CUDA applications.
  4. Profiling and executing CUDA programs using nvprof.
  5. Understanding execution of 2D CUDA kernel for simple matrix multiplication.

Setting up Google Colab environment for running CUDA program.

Login to your gmail account and open google colab. Change the runtime type to GPU. Open the following colab file and follow the steps specified in every cell.

   Colab link for CUDA program (Tutorial 1) 

Running CUDA program on remote cluster

Logging in


  ssh username@10.5.18.114

Writing a Job Script


#!/bin/sh
# Torque script to submit CUDA C/C++ programs.

# Torque directives
#PBS -N helloCUDA
#PBS -W group_list=hp3
#PBS -q gpu
#PBS -l walltime=00:05:00,mem=400mb,nodes=compute-0-1:gpus=1
#PBS -V

# User Directives
nvcc vectorAdd.cu -o vectorAdd
./vectorAdd 1024
#End of script

Launching and Monitoring a Job


qsub cuda_test.pbs
qstat -j <job_id>


Viewing Output


vi cuda_test.pbs.o<job_id>


Viewing Error


vi cuda_test.pbs.e<job_id>


Student Compute-Node Mapping


compute-0-0
===========================================
18CS10031	Lanke Leela Manohar
18EC32001	Bipin Kumar Mandal
18EC32006	Mayur Manik Jiwatode
18EC35034	Utkarsh Patel
18IM30002	Aditya Pratap Singh
compute-0-1
=============================================
18MA20009	Aviraj Singh Bevli
19CH30043	Rohit Sutradhar
19CS10074	Kamalesh Garnayak
19CS30019	Girish Kumar
19CS30023	Khushboo Singhania
compute-0-2
=============================================
19CS30037	Rajas Bhatt
22CS60R03	Yatin Dixit
22CS60R75	Ankem Gopichand
22CS72P09	Amrita Bose