Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/soumik12345/several-days-of-cuda


https://github.com/soumik12345/several-days-of-cuda

cuda gpgpu

Last synced: 3 days ago
JSON representation

Awesome Lists containing this project

README

        

# Several Days of Cuda

## Instructions

### Instructions for building locally

1. Download and install cuda toolkit for your platform.

2. Check the GPU you're using by `nvidia-smi -L`.

3. For building on Linux, use `mkdir build && cd build && cmake ../ && make`.

### Instructions for building and running on Google Colab

- In order to build on Google Colab, run the `colab_execution.ipynb` Notebook [![](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/soumik12345/Several-Days-of-Cuda/blob/refactor/notebooks/colab_execution.ipynb)

- In order to develop on Google Colab:

- Run the `Cuda_Workspace.ipynb` Notebook on Google Colab [![](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/soumik12345/Several-Days-of-Cuda/blob/master/notebooks/Cuda_Workspace.ipynb)

- Check the GPU you're using by `nvidia-smi -L`.

- If you wish to ssh into the colab instance from your local VSCode, follow the instructions for `VSCode Remote SSH`. For setting up ssh connection between local VSCode to Google Colab, please follow the instructions this article: [Connect Local VSCode to Google Colab’s GPU Runtime](https://medium.com/swlh/connecting-local-vscode-to-google-colabs-gpu-runtime-bceda3d6cf64)

![](./assets/sample_execution_example.gif)

### Instructions for Development

In order to add a new program to the codebase, you can use a simple Python CLI. Simply install the required
dependencies for the CLI using `python3 -m pip install -r requirements.txt`. Now you can use the CLI to add a new
example to the codebase. Executing the `create_kernel.py` using the necessary parameters would add a cuda header file
with some simple starter code. The usage of the CLI is described below:

```
Usage: create_example.py [OPTIONS]

Options:
-k, --example_name TEXT Example Name in Camel Case
--help Show this message and exit.
```

## Examples


Example
Run Instructions (inside build directory)


1
Hello World
./src/hello-world/hello_world


2
Thread-ID Demo
./src/thread-id-demo/thread_id_demo


3
Block-Dim Demo
./src/block-dim-demo/block_dim_demo


4
Unique Index Calculation
./src/unique-index/unique_index


5
Unique Index Calculation in 2D
./src/unique-index-2d/unique_index_2d


6
Parallelized Loops
./src/parallel-loop/parallel_loop


7
Parallelized Loops in Multiple Blocks
./src/parallel-loop-multi-blocks/parallel_loop_multi_blocks


8
Array Manipulation
./src/array-manipulation/array_manipulation


9
Array Manipulation with Manual Memory Allocation
./src/array-manipulation-manual-memory/array_manipulation_manual_memory


10
Vector Addition
./src/vector-addition/vector_addition


11
Vector Addition with Unified Memory
./src/vector-addition-unified-memory/vector_addition_unified_memory