Skip to content

Instantly share code, notes, and snippets.

@nurpax
Last active November 27, 2020 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nurpax/30eb6426910519bf1bf87e009d4e78b8 to your computer and use it in GitHub Desktop.
Save nurpax/30eb6426910519bf1bf87e009d4e78b8 to your computer and use it in GitHub Desktop.
nvcc problem
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()
#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) {
}
#include "op.h"
void testfunc() {
Context ctx;
(void)ctx;
}
#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