Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extension_cpp/extension_cpp/csrc/muladd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {
The import from Python will load the .so consisting of this file
in this extension, so that the TORCH_LIBRARY static initializers
below are run. */
PyObject* PyInit__C(void)
PyMODINIT_FUNC PyInit__C(void)
{
static struct PyModuleDef module_def = {
PyModuleDef_HEAD_INIT,
Expand Down
12 changes: 9 additions & 3 deletions extension_cpp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,22 @@ def get_extensions():
use_cuda = use_cuda and torch.cuda.is_available() and CUDA_HOME is not None
extension = CUDAExtension if use_cuda else CppExtension

NVCC_FLAGS = [
"-O3" if not debug_mode else "-O0",
]
if os.name == "nt":
NVCC_FLAGS += [
"-DUSE_CUDA=1",
]

extra_link_args = []
extra_compile_args = {
"cxx": [
"-O3" if not debug_mode else "-O0",
"-fdiagnostics-color=always",
"-DPy_LIMITED_API=0x03090000", # min CPython version 3.9
],
"nvcc": [
"-O3" if not debug_mode else "-O0",
],
"nvcc": NVCC_FLAGS,
}
if debug_mode:
extra_compile_args["cxx"].append("-g")
Expand Down
2 changes: 1 addition & 1 deletion extension_cpp_stable/extension_cpp_stable/csrc/muladd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern "C" {
The import from Python will load the .so consisting of this file
in this extension, so that the STABLE_TORCH_LIBRARY static initializers
below are run. */
PyObject* PyInit__C(void)
PyMODINIT_FUNC PyInit__C(void)
{
static struct PyModuleDef module_def = {
PyModuleDef_HEAD_INIT,
Expand Down