https://github.com/kwea123/pytorch_cppcuda_practice
Practice to write cpp/cuda extension for pytorch
https://github.com/kwea123/pytorch_cppcuda_practice
Last synced: 3 months ago
JSON representation
Practice to write cpp/cuda extension for pytorch
- Host: GitHub
- URL: https://github.com/kwea123/pytorch_cppcuda_practice
- Owner: kwea123
- Created: 2022-06-10T07:30:47.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-10T07:36:32.000Z (over 3 years ago)
- Last Synced: 2025-04-07T15:54:37.343Z (6 months ago)
- Language: Cuda
- Size: 3.91 KB
- Stars: 28
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pytorch_cppcuda_practice
Practice to write cpp/cuda extension for pytorchThis simple example writes a custom matrix addition in cuda, and provides python binding with forward/backward operations.
Sources: [1](https://qiita.com/windfall/items/5031d70c649b06a1534f) [2](https://pytorch.org/tutorials/advanced/cpp_extension.html)
# Installation
1. Install pytorch.
2. From this repo, run `pip install . --use-feature=in-tree-build`# Test
Run `python test.py`.
# Misc
For vscode to resolve ``, add the following lines to the include path (change python path and version):
```
"/include/python3.8",
"/lib/python3.8/site-packages/torch/include",
"/lib/python3.8/site-packages/torch/include/torch/csrc/api/include"
```