dblalock / MakePytorchPlusPlus

How and why you want to make your pytorch CUDA/CPP extension with a Makefile

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Developing a Pytorch CPP/CUDA Extension with a Makefile

Pytorch cpp extensions provides a good way to augment pytorch with custom functions. The cpp-extension uses the setuptool to compile files. However, as it is mainly used for deployment rather than debugging and development, using the setuptool for development can be slow and cumbersome.

In this repository, I provide an alternative way to compile and debug your custom extension with a makefile. The associated tutorial can be found at the blog post.

Installation

You must have torch installed in your current (virtual environment) python.

git clone https://github.com/chrischoy/MakePytorchPlusPlus
cd MakePytorchPlusPlus
python setup.py install

It automatically selects the maximum number of CPU for parallel compilation.

Running the example

python example.py

About

How and why you want to make your pytorch CUDA/CPP extension with a Makefile


Languages

Language:Makefile 39.9%Language:C++ 25.5%Language:Python 20.0%Language:Cuda 14.6%