Last active
November 27, 2020 22:09
-
-
Save nurpax/30eb6426910519bf1bf87e009d4e78b8 to your computer and use it in GitHub Desktop.
nvcc problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.utils.cpp_extension | |
def compile(): | |
ext_name = 'ext1' | |
torch.utils.cpp_extension.load(name=ext_name, sources=['ext1.cpp', 'ext1cuda.cu'], with_cuda=True, verbose=True) | |
def main(): | |
compile() | |
if __name__ == "__main__": | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <torch/extension.h> | |
#include <ATen/cuda/CUDAContext.h> | |
#include <ATen/cuda/CUDAUtils.h> | |
#include <pybind11/numpy.h> | |
#include "op.h" | |
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "op.h" | |
void testfunc() { | |
Context ctx; | |
(void)ctx; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
typedef struct { | |
int foo; | |
} Context; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment