Skip to content

Commit

Permalink
Update setup.py
Browse files Browse the repository at this point in the history
detect device and set `--generate-code` automatically
  • Loading branch information
vchiley authored Jul 26, 2023
1 parent 0032d97 commit 7c9a26d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from setuptools import setup, find_packages
from torch import cuda
from torch.utils.cpp_extension import BuildExtension, CUDAExtension


_dc = cuda.get_device_capability()
_dc = f"{_dc[0]}{_dc[1]}"
ext_modules = [
CUDAExtension(
"megablocks_ops",
Expand All @@ -12,7 +15,7 @@
"nvcc": [
"--ptxas-options=-v",
"--optimize=2",
"--generate-code=arch=compute_80,code=sm_80"
f"--generate-code=arch=compute_{_dc},code=sm_{_dc}"
]
})
]
Expand Down

0 comments on commit 7c9a26d

Please sign in to comment.