Skip to content

An example of C++ written PyTorch extension build with scikit-build-core

Notifications You must be signed in to change notification settings

HernandoR/scikit-build-core-pytorch-extension-cpp

 
 

Repository files navigation

TODO LIST

feel free to raise PRs if you have interest and just enough knowledge to solve any of the following issues.

[ ] run test is not success by python test_extension.py but not python test_extension.py

[ ] cuda compile options are not set. please approch to the CMakeLists.txt file

[ ] the compiled _C.so file will show in the root of project

[ ] remove redundent files

[ ] add pybind11 example

C++/CUDA Extensions for PyTorch by scikit-build-core

An example of writing a C++/CUDA extension for PyTorch. See here for the accompanying tutorial. This repo demonstrates how to write an example extension_cpp.ops.mymuladd custom op that has both custom CPU and CUDA kernels.

The examples in this repo work with PyTorch 2.4+.

To build:

uv sync

To test:

  1. move the test_extension.py to the root directory
  2. run the following command
python test_extension.py

Authors

Liu Zhen

Thanks to the original authors

Peter Goldsborough, Richard Zou

About

An example of C++ written PyTorch extension build with scikit-build-core

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 43.4%
  • CMake 21.7%
  • C++ 18.4%
  • Cuda 16.5%