Commit ecfecf8c authored by mhdbashard's avatar mhdbashard

Update

parent de1bea2e
This diff is collapsed.
This diff is collapsed.
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "b6d3aebb",
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"ref:https://cuda-tutorial.readthedocs.io/en/latest/tutorials/tutorial01/"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c8eff613",
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"import cupy\n",
"\n",
"# size of the vectors\n",
"size = 1024\n",
"\n",
"# allocating and populating the vectors\n",
"a_gpu = cupy.random.rand(size, dtype=cupy.float32)\n",
"b_gpu = cupy.random.rand(size, dtype=cupy.float32)\n",
"c_gpu = cupy.zeros(size, dtype=cupy.float32)\n",
"\n",
"# CUDA vector_add\n",
"vector_add_cuda_code = r'''\n",
"extern \"C\"\n",
"__global__ void vector_add(const float * A, const float * B, float * C, const int size)\n",
"{\n",
" int item = threadIdx.x;\n",
" C[item] = A[item] + B[item];\n",
"}\n",
"'''\n",
"vector_add_gpu = cupy.RawKernel(vector_add_cuda_code, \"vector_add\")\n",
"\n",
"vector_add_gpu((1, 1, 1), (size, 1, 1), (a_gpu, b_gpu, c_gpu, size))"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
# GPU Programming
A collection of notebooks for learning and practicing GPU programming with CUDA.
## Contents
### Notebooks
- **GPU-Introduction.ipynb** - Introduction to GPU computing concepts and fundamentals
- **GPU-Check ENV.ipynb** - Verify and check GPU environment setup and CUDA configuration
- **GPU-HW CUDA Programming.ipynb** - HomeWrok CUDA programming exercises
- **GPU-Lab C Kernel.ipynb** - CUDA kernel programming with C language
- **GPU-Lab Py Kernel.ipynb** - CUDA kernel programming using CuPy in Python
## Overview
This workspace contains practical exercises and examples for GPU programming, including:
- Vector operations on GPU
- CUDA kernel implementation and execution
- GPU memory management
- Performance optimization techniques
## Requirements
- CUDA Toolkit installed
- CuPy (for Python CUDA programming)
- Jupyter notebook environment
## Getting Started
Start with `GPU-Introduction.ipynb` for foundational concepts, then progress through the other notebooks to practice implementing CUDA kernels and GPU operations.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment