# [Neural Network CUDA](https://github.com/godweiyang/NN-CUDA-Example) We provide several ways to compile the CUDA kernels and their cpp wrappers, including setuptools and cmake. ## Code Structure ``` ├── csrc │ |── cpu | | ├── nms_3d_cpu.cpp | | └── vision.h │ |── cuda | | ├── deformable_conv_3d_cuda.cu | | ├── modulated_deformable_conv_3d_cuda.cu | | ├── nms_3d.cu | | ├── overlap_3d.cu | | ├── ROIAlign_3d_cuda.cu | | └── vision.h │ |── custom_ops | | └── custom_ops.cpp │ |── deformable_conv_3d.h │ |── modulated_deformable_conv_3d.h │ |── nms_3d.h │ |── overlap_3d.h │ └── ROIAlign_3d.h ├── custom_op │ └── setup.py │── deploy │ └── custom_op_cmake │ |── CMakeLists.txt │ |── custom_ops.cpp │ |── nms_3d.cu │ |── nms_3d.h │ |── ROIAlign_3d.h │ |── ROIAlign_3d_cuda.cu │ └── vision.h └── layers |── lib | └── custom_ops.cpp |── __init__.py |── deformable_conv_3d.py |── modulated_deformable_conv_3d.py |── nms_3d.py |── overlap_3d.py └── roi_align_3d.py ``` ## PyTorch ### Compile cpp and cuda - Setuptools ```shell # 用于python端训练 cd custom_op python setup.py install ``` - CMake ```shell # 用于c++端部署,亦可用于python端训练 # 在nvcr.io/nvidia/pytorch镜像内编译,版本与部署一致,例如:20.08 cd deploy/custom_op_cmake mkdir build cd build cmake ../ -DCMAKE_PREFIX_PATH=/opt/conda/lib/python3.6/site-packages/torch make -j 8 ```