{"id":23207928,"url":"https://github.com/pkestene/pybind11-cuda","last_synced_at":"2025-08-13T01:03:25.599Z","repository":{"id":86494729,"uuid":"220471555","full_name":"pkestene/pybind11-cuda","owner":"pkestene","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-27T18:45:01.000Z","size":33,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-02-26T16:26:29.683Z","etag":null,"topics":["cmake","cuda","pybind11","python"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pkestene.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}},"created_at":"2019-11-08T13:22:53.000Z","updated_at":"2023-09-24T17:23:54.029Z","dependencies_parsed_at":"2023-09-24T17:52:33.486Z","dependency_job_id":null,"html_url":"https://github.com/pkestene/pybind11-cuda","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkestene%2Fpybind11-cuda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkestene%2Fpybind11-cuda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkestene%2Fpybind11-cuda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkestene%2Fpybind11-cuda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkestene","download_url":"https://codeload.github.com/pkestene/pybind11-cuda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230312449,"owners_count":18206858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cmake","cuda","pybind11","python"],"created_at":"2024-12-18T17:26:37.889Z","updated_at":"2024-12-18T17:26:38.519Z","avatar_url":"https://github.com/pkestene.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pybind11-cuda\n\nStarting point for GPU accelerated python libraries\n\nAdapted from original work from https://github.com/PWhiddy/pybind11-cuda\n\nPresent work uses [modern CMake/Cuda](https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9444-build-systems-exploring-modern-cmake-cuda-v2.pdf) approach\n\n# Prerequisites\n\nCuda\n\nPython 3.6 or greater\n\nCmake \u003e= 3.12 (for CUDA support and the new FindPython3 module)\n\n# Build instructions\n\n## cmake\n\nIf you use cmake version \u003e= 3.18, you can use [variable CMAKE_CUDA_ARCHITECTURES](https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_ARCHITECTURES.html) instead of CUDAFLAGS:\n\n\n```bash\nmkdir build; cd build\n# provide a default cuda hardware architecture to build for\ncmake -DCMAKE_CUDA_ARCHITECTURES=\"75\" -DPython3_EXECUTABLE=`which python` ..\nmake\n```\n\nPlease note that specifiying `Python3_EXECUTABLE` is not required, but recommended if you have multiple python executable on your system (e.g. one from OS, another from conda, etc...); this way you can control which python installation will be used.\n\nIf you have an older version cmake, you can pass nvcc flags to cmake using env variable `CUDAFLAGS`\n\n```bash\n# change CUDAFLAGS according to your target GPU architecture\nmkdir build; cd build\n# provide a default cuda hardware architecture to build for\nexport CUDAFLAGS=\"-arch=sm_75\"\ncmake -DPython3_EXECUTABLE=`which python` ..\nmake\n```\n\n## test\n\nTest it with\n```shell\ncd src\npython3 test_mul.py\n```\n\n_gpu_library.so_ and _test_mul.py_ must be in the same folder. Alternatively you can path to _gpu_library.so_ to your PYTHONPATH env variable.\n\n# Features demonstrated\n\n- Compiles out of the box with cmake\n- Numpy integration\n- C++ Templating for composable kernels with generic data types\n\nOriginally based on https://github.com/torstem/demo-cuda-pybind11\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkestene%2Fpybind11-cuda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkestene%2Fpybind11-cuda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkestene%2Fpybind11-cuda/lists"}