Skip to content

Commit ccd1efa

Browse files
committed
updated README
1 parent e3b672d commit ccd1efa

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ CXXFLAGS += -pthread -fPIC -fwrapv -std=c++14 $(COMMON_FLAGS) $(WARNINGS)
6060
NVCCFLAGS += -std=c++14 -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
6161

6262
all: $(STATIC_LIB)
63-
#python setup.py install --force
6463

6564
debug:
6665
@ echo $(INCLUDE_DIRS)

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
# cuda-torch-custom-kernel
1+
# Custom CUDA Kernel for PyTorch
2+
3+
This codebase demonstrates how to:
4+
- implement a simple CUDA kernel function
5+
- interface it to PyTorch using pybind11 / ATen
6+
7+
Shortly I will add more code to this extension module that:
8+
- demonstrates some common CUDA/GPU optimization techniques
9+
- implements a custom layer of a PyTorch neural network
10+
11+
To Build:
12+
13+
- Create a Python virtualenv based on Python 3.8 and activate it.
14+
15+
- Install requirements:
16+
17+
pip3 install -r requirements.txt
18+
19+
- Build extension module:
20+
21+
python3 setup.py install --force
22+
23+
From a terminal window, launch JupyterLAB and load up test.ipynb - run that...
24+
25+
jupyter lab

test.ipynb

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 4,
6-
"id": "dedicated-billion",
5+
"execution_count": 1,
6+
"id": "pretty-advocate",
77
"metadata": {},
88
"outputs": [],
99
"source": [
@@ -12,8 +12,8 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 5,
16-
"id": "utility-elimination",
15+
"execution_count": 2,
16+
"id": "certified-james",
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
@@ -22,15 +22,15 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 6,
26-
"id": "indoor-british",
25+
"execution_count": 3,
26+
"id": "southern-journalism",
2727
"metadata": {},
2828
"outputs": [
2929
{
3030
"name": "stdout",
3131
"output_type": "stream",
3232
"text": [
33-
"tensor([-0.5502, 0.4615, -0.6627, -1.2349], device='cuda:0') tensor([0.1335, 0.1309, 0.6156, 0.5665], device='cuda:0') tensor([-0.4167, 0.5923, -0.0471, -0.6684], device='cuda:0')\n"
33+
"tensor([-0.9224, -0.0188, -0.7667, 1.1617], device='cuda:0') tensor([ 0.3536, -0.1907, 0.4413, -0.8640], device='cuda:0') tensor([-0.5688, -0.2094, -0.3254, 0.2977], device='cuda:0')\n"
3434
]
3535
}
3636
],
@@ -47,7 +47,7 @@
4747
{
4848
"cell_type": "code",
4949
"execution_count": null,
50-
"id": "hidden-supplement",
50+
"id": "substantial-treasury",
5151
"metadata": {},
5252
"outputs": [],
5353
"source": []

0 commit comments

Comments
 (0)