{"id":51848026,"url":"https://github.com/architj6/gpu-parallel-computing","last_synced_at":"2026-07-23T15:01:21.933Z","repository":{"id":355647954,"uuid":"1228930174","full_name":"ArchitJ6/gpu-parallel-computing","owner":"ArchitJ6","description":"A structured exploration of GPU parallel computing using HIP and CUDA, covering kernels, memory patterns, matrix operations, and Docker-based execution.","archived":false,"fork":false,"pushed_at":"2026-05-04T16:26:32.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-04T17:33:46.567Z","etag":null,"topics":["cpp","cuda","docker","gpgpu","gpu","gpu-programming","high-performance-computing","hip","hpc","nvidia","parallel-computing","rocm"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArchitJ6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-04T14:22:23.000Z","updated_at":"2026-05-04T16:36:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ArchitJ6/gpu-parallel-computing","commit_stats":null,"previous_names":["architj6/parallel-computing-with-hip"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ArchitJ6/gpu-parallel-computing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArchitJ6%2Fgpu-parallel-computing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArchitJ6%2Fgpu-parallel-computing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArchitJ6%2Fgpu-parallel-computing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArchitJ6%2Fgpu-parallel-computing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArchitJ6","download_url":"https://codeload.github.com/ArchitJ6/gpu-parallel-computing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArchitJ6%2Fgpu-parallel-computing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35805966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-23T02:00:06.683Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cuda","docker","gpgpu","gpu","gpu-programming","high-performance-computing","hip","hpc","nvidia","parallel-computing","rocm"],"created_at":"2026-07-23T15:01:21.326Z","updated_at":"2026-07-23T15:01:21.919Z","avatar_url":"https://github.com/ArchitJ6.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 GPU Parallel Computing: HIP \u0026 CUDA\n\n\u003e A structured, hands-on exploration of GPU programming using **HIP (portable)** and **CUDA (NVIDIA)** — built from fundamentals to real-world parallel workloads.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/GPU-CUDA%20%7C%20HIP-blue\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Language-C%2B%2B-orange\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Parallel-Computing-green\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Docker-Enabled-blue\" /\u003e\n\u003c/p\u003e\n\n---\n\n# 📌 Overview\n\nThis repository demonstrates:\n\n* ⚡ GPU parallel programming fundamentals\n* 🧠 Thread hierarchy \u0026 execution model\n* 📊 Data-parallel algorithms\n* 🔁 Reduction \u0026 synchronization\n* 🧮 Matrix computations\n* 🧠 Memory access optimization\n* 🖼️ Image processing on GPU\n* 🔄 Portability from HIP → CUDA\n\n---\n\n# 📁 Project Structure\n\n```bash\n.\n├── 01_basics/\n├── 02_vector_ops/\n├── 03_reduction/\n├── 04_matrix/\n├── 05_memory_patterns/\n├── 06_image_processing/\n│\n├── cuda_versions/\n│   ├── (same structure as above)\n│\n├── Dockerfile\n├── docker-compose.yml\n```\n\n---\n\n# 🧠 GPU Execution Model\n\nAll programs follow this pipeline:\n\n```text\nCPU (Host)\n   ↓\nMemory Transfer (Host → Device)\n   ↓\nGPU Kernel Execution (Parallel Threads)\n   ↓\nMemory Transfer (Device → Host)\n```\n\n---\n\n# 📂 Module Breakdown (with File Explanation)\n\n## 🔹 01_basics/\n\n### ✔ `hello_threads`\n\n* Prints thread IDs from GPU\n* Demonstrates **parallel execution**\n\n### ✔ `thread_indexing`\n\n* Displays block and thread indices\n* Helps understand **thread hierarchy**\n\n---\n\n## 🔹 02_vector_ops/\n\n### ✔ `vector_add`\n\n* Each thread adds one element\n  👉 Demonstrates **data parallelism**\n\n### ✔ `vector_square`\n\n* Each thread squares one value\n  👉 Fully independent computation\n\n---\n\n## 🔹 03_reduction/\n\n### ✔ `dot_product_atomic`\n\n* Uses `atomicAdd` to accumulate results\n\n👉 Teaches:\n\n* Race conditions\n* Synchronization\n* Reduction patterns\n\n---\n\n## 🔹 04_matrix/\n\n### ✔ `matrix_add`\n\n* Uses 2D thread mapping\n  👉 Introduces **grid-based parallelism**\n\n### ✔ `matrix_mul`\n\n* Performs matrix multiplication\n\n👉 Core concept used in:\n\n* Machine Learning\n* Deep Learning (GEMM)\n\n---\n\n## 🔹 05_memory_patterns/\n\n### ✔ `reverse_array`\n\n* Demonstrates reverse indexing\n  👉 Memory remapping logic\n\n### ✔ `strided_access`\n\n* Accesses memory with stride\n\n👉 Shows:\n\n* Non-coalesced memory access\n* Performance implications\n\n---\n\n## 🔹 06_image_processing/\n\n### ✔ `grayscale`\n\n* Converts RGB image data → grayscale\n\n👉 First **real-world GPU workload**\n\n---\n\n# 🔄 HIP vs CUDA\n\nBoth implementations follow the same logic:\n\n| Concept           | HIP                  | CUDA                  |\n| ----------------- | -------------------- | --------------------- |\n| Memory Allocation | hipMalloc            | cudaMalloc            |\n| Memory Copy       | hipMemcpy            | cudaMemcpy            |\n| Synchronization   | hipDeviceSynchronize | cudaDeviceSynchronize |\n| Compiler          | hipcc                | nvcc                  |\n\n👉 Only API names differ — execution model is identical.\n\n---\n\n# ⚙️ How to Run\n\n## 🟣 HIP (AMD / Portable)\n\n```bash\nhipcc file.cpp -o output\n./output\n```\n\n---\n\n## 🟢 CUDA (NVIDIA)\n\n```bash\nnvcc file.cu -o output\n./output\n```\n\n---\n\n# 🐳 Docker Setup (CUDA Only)\n\nThis project includes Docker support for **CUDA execution using NVIDIA GPU**\n\n## ⚠️ Important\n\n* Works only with **NVIDIA GPUs**\n* Uses CUDA base image\n* HIP (ROCm) is **not supported in this container**\n\n---\n\n## ▶️ Start Container\n\n```bash\ndocker compose up -d\n```\n\n---\n\n## ▶️ Enter Container\n\n```bash\ndocker compose exec cuda-dev bash\n```\n\n---\n\n## ▶️ Run Example\n\n```bash\ncd cuda_versions/01_basics\nnvcc hello_threads.cu -o hello\n./hello\n```\n\n---\n\n## 🧪 Verify GPU Access\n\n```bash\ndocker run --rm --gpus all nvidia/cuda:12.2.0-base nvidia-smi\n```\n\n---\n\n# 📊 When GPU Helps\n\n| Workload         | CPU        | GPU       |\n| ---------------- | ---------- | --------- |\n| Vector Ops       | Moderate   | Fast      |\n| Matrix Ops       | Slow       | Very Fast |\n| Image Processing | Sequential | Parallel  |\n\n👉 GPU excels when:\n\n* Work is independent\n* Data size is large\n\n---\n\n# 🧠 Key Learnings\n\n* GPU requires **parallel thinking**, not sequential logic\n* Memory transfer can be a bottleneck\n* Thread mapping impacts performance\n* Memory access patterns matter\n\n---\n\n# 🚀 Future Improvements\n\n* Shared memory optimization\n* CPU vs GPU benchmarking\n* Real image input/output\n* Multi-GPU scaling\n\n---\n\n# 🏆 Why This Repo Stands Out\n\n* Structured learning progression\n* Covers both HIP \u0026 CUDA\n* Includes Docker-based execution\n* Demonstrates real-world GPU usage\n\n---\n\n# ⭐ Final Thought\n\n\u003e “Parallel computing isn’t just faster computing —\n\u003e it’s smarter computation at scale.”\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitj6%2Fgpu-parallel-computing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchitj6%2Fgpu-parallel-computing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitj6%2Fgpu-parallel-computing/lists"}