{"id":29041859,"url":"https://github.com/ironjr/minimal-cuda-pytorch","last_synced_at":"2026-05-04T22:42:52.113Z","repository":{"id":300917568,"uuid":"1007578278","full_name":"ironjr/minimal-cuda-pytorch","owner":"ironjr","description":"Repository-level snippet for minimal implementation of a PyTorch CUDA extension.","archived":false,"fork":false,"pushed_at":"2025-06-24T08:12:29.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-04T22:42:36.721Z","etag":null,"topics":["cuda","minimal","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ironjr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-06-24T07:59:00.000Z","updated_at":"2025-06-24T08:12:32.000Z","dependencies_parsed_at":"2025-06-24T09:23:42.726Z","dependency_job_id":"701ec58c-29da-4365-a34a-2d675a74d547","html_url":"https://github.com/ironjr/minimal-cuda-pytorch","commit_stats":null,"previous_names":["ironjr/minimal-cuda-pytorch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ironjr/minimal-cuda-pytorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironjr%2Fminimal-cuda-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironjr%2Fminimal-cuda-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironjr%2Fminimal-cuda-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironjr%2Fminimal-cuda-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ironjr","download_url":"https://codeload.github.com/ironjr/minimal-cuda-pytorch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironjr%2Fminimal-cuda-pytorch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32628211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cuda","minimal","pytorch"],"created_at":"2025-06-26T15:02:55.592Z","updated_at":"2026-05-04T22:42:52.093Z","avatar_url":"https://github.com/ironjr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimal PyTorch CUDA Extension Example\n\nThis is a minimal implementation of a PyTorch model that uses a single CUDA function written in C++ CUDA.\n\n### Usage\n\nJust clone this repository and start building custom CUDA extensions for PyTorch.\n\n---\n\n## Generated Instructions\n\n### Files\n\n- `cuda_kernels.cu` - CUDA kernel implementation (element-wise addition)\n- `bindings.cpp` - Python bindings using pybind11\n- `setup.py` - Build configuration\n- `model.py` - PyTorch model that uses the custom CUDA function\n- `test.py` - Test script to verify the CUDA function works correctly\n\n### Requirements\n\n- PyTorch with CUDA support\n- CUDA toolkit\n- C++ compiler (gcc/g++ on Linux, MSVC on Windows)\n\n\n\n### Build Instructions\n\n1. Navigate to this directory:\n   ```bash\n   cd minimal_cuda_example\n   ```\n\n2. Build and install the extension:\n   ```bash\n   python setup.py install\n   ```\n\n   Or for development (builds in-place):\n   ```bash\n   python setup.py build_ext --inplace\n   ```\n\n### Usage\n\n- Test the CUDA function\n```bash\npython test.py\n```\n\n- Run the model example\n```bash\npython model.py\n```\n\n### How it works\n\n1. **CUDA Kernel** (`cuda_kernels.cu`): Implements a simple element-wise addition kernel that runs on GPU\n2. **Python Bindings** (`bindings.cpp`): Uses pybind11 to expose the CUDA function to Python\n3. **PyTorch Integration** (`model.py`): Wraps the CUDA function in a `torch.autograd.Function` for seamless integration with PyTorch's automatic differentiation\n4. **Model Usage**: The custom CUDA function is used within a standard PyTorch model\n\n### Extending this example\n\nYou can extend this example by:\n- Adding more complex CUDA kernels\n- Implementing custom backward passes\n- Adding support for different data types\n- Optimizing memory access patterns\n- Adding error checking and validation\n\n### Notes\n\n- This example uses float32 tensors only\n- The CUDA kernel is optimized for simplicity, not performance\n- Error checking is minimal - production code should have more robust error handling\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironjr%2Fminimal-cuda-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fironjr%2Fminimal-cuda-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironjr%2Fminimal-cuda-pytorch/lists"}