Compile custom kernel file

Does anybody know how to compile custom kernel files?

I am trying to make a my_kernel.cu file and add a bunch headers as suggested in guide.

#include <cuda.h>
#include <host_defines.h>

#define CUDA_PATHWAY
#include "cuda_gvdb_scene.cuh"
#include "cuda_gvdb_nodes.cuh"
#include "cuda_gvdb_geom.cuh"
#include "cuda_gvdb_raycast.cuh"
#include "GVDB/cuda_gvdb_operators.cuh"

extern "C" __global__ void myKernel(float* d_ptr)
{
...
}

I compiled it in a separate project and a lot of errors appeared because there is no include list in most of those cuh header files. I guess there is something to do with the cmake file while compiling the gvdb library. Can I have a simple tutorial of how to make my own gvdb ptx module?

My method is as follows (note this is using GVDB version 1.1):

  1. create the .cu file in GVDB’s _output/include folder

  2. the includes for my kernel are:

#define CUDA_PATHWAY
#include "cuda_gvdb_scene.cuh"
#include "cuda_math.cuh"
#include "cuda_gvdb_nodes.cuh"
#include "cuda_gvdb_geom.cuh"
#include "cuda_gvdb_operators.cuh" // contains the voxel type definitions
  1. I compile using “Developer Command Prompt for VS2015” run in administrator mode.

  2. I point the command prompt to the _output/include folder using the command “cd C:\gvdb_output\include”

  3. I compile with the command “nvcc -ptx my_kernel.cu”

  4. Once it has successfully compiled I copy the compiled ptx file to my solution folder.

I’m sure there are more elegant ways to accomplish this, but this is my work flow.

hi, thanks for reply, I have found my way as well. I had a long post in one of the issues in gvdb repo in github
https://github.com/NVIDIA/gvdb-voxels/issues/20