Skip to content

how to use libtorch library in cuda file with nvcc compiler(c++)? #27958

@CasonTsai

Description

@CasonTsai

❓ Questions and Help

Motivation

i want to implement nms in parallel processing with libtorch library.
i use this cuda code(https://github.com/gdlg/pytorch_nms)

Environment

PyTorch version : 1.2.0
CUDA (nvcc compiler ) : 10.0
libtorch version : 1.2.0
system : win10

Operation

the command :i use nvcc -c nms_kernel.cu -L -lcudart -I D:\Code-software\NNF\libtorch\libtorch\include -I D:\Code-software\NNF\libtorch\libtorch\include\torch\csrc\api\include to compiled it

ERROR

D:/Code-software/NNF/libtorch/libtorch/include\torch/csrc/jit/argument_spec.h(181): error: member "torch::jit::ArgumentSpecCreator::DEPTH_LIMIT" may not be initialized 1 error detected in the compilation of "C:/Users/Cason/AppData/Local/Temp/tmpxft_00001b28_00000000-10_nms_kernel.cpp1.ii"

as long as i add #include <torch/extension.h> or #include <torch/script.h> in cuda files,It makes this kind of mistake.

cc @yf225

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: cppRelated to C++ APItriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions