Welcome to the CUDA Practice repository! This project is a collection of exercises aimed at exploring and mastering GPU programming using CUDA (Compute Unified Device Architecture). This is an ongoing project that contains progressively more complex CUDA exercises to help understand core concepts of parallelism, memory management, kernel execution, and performance profiling on GPUs.
This repository is organized with a Projects directory containing individual CUDA programming exercises:
cuda-practice/
├── Projects/
│ ├── common/
│ │ ├── [shared utility files]
│ ├── vectorAdd/
│ │ ├── [implementation files]
│ │ ├── README.md
│ ├── [future-project-1]/
│ │ ├── [implementation files]
│ │ ├── README.md
│ └── ...
Each project directory contains:
- Implementation files (CUDA, C/C++)
- A dedicated README.md with specific instructions, explanations, and compilation commands
- The
commondirectory contains shared utilities that may be used across multiple projects
As I progress in my CUDA programming journey, this repository will expand with new projects covering various aspects of GPU programming:
- Vector Addition: A fundamental exercise demonstrating basic CUDA concepts
- Matrix Operations: Matrix multiplication and transformations
- Image Processing: Filters, transformations, and convolutions
- Reduction Operations: Sum, min/max, and other reduction algorithms
- Sorting Algorithms: Parallel implementations of sorting techniques
- Physics Simulations: N-body problems and particle systems
Each project will focus on specific CUDA concepts and optimization techniques.
Before you begin, make sure you have the following tools installed:
- CUDA Toolkit: Download and install the CUDA Toolkit to access nvcc (the CUDA compiler) and other essential tools.
- NVIDIA GPU: Ensure you have a compatible NVIDIA GPU to execute the CUDA programs.
- Profiling Tools: You'll need Nsight Systems (nsys) for profiling and analyzing the performance of your CUDA programs.
First, clone the repository to your local machine:
git clone https://github.com/pranavreddy23/cuda-practice.git
cd cuda-practicecd ProjectsNavigate to the project you want to explore:
cd vectorAdd # or any other project directoryEach project directory contains its own README.md with specific instructions for:
- Compiling the code
- Running the program
- Profiling the execution
- Understanding the concepts demonstrated
For performance analysis, use Nsight Systems (nsys) to profile your programs:
nsys nvprof ./[executable_name]This will generate detailed performance reports with insights into GPU usage, kernel execution time, and memory transfer patterns.
I recommend working through the projects in order, as they build upon concepts introduced in previous projects. Each project will introduce new CUDA programming concepts and optimization techniques.
Feel free to suggest improvements or additional projects that might be helpful in my CUDA learning journey!
This project is licensed under the MIT License - see the LICENSE file for details.