Hey guys
May I ask a beginner question here?
I am trying to make a cuda and optix interop sample code work, but I could not make it compile.
Here is my sample code:
#include <stdio.h>
#include <optix_world.h>
#include <cuda_runtime.h>
int main()
{
optix::Context context = optix::Context::create();
optix::Buffer vertex_buffer = context->createBufferForCUDA(RT_BUFFER_INPUT, RT_FORMAT_FLOAT3, 5);
float3 cuda_buffer;
cudaMalloc((void*)cuda_buffer, 5 * sizeof(float3));
}
to use cudaMalloc, I need to include cuda_runtime.h, to use optix::Context, I need to include optix_world.h, but if I include them both, then there is a error.
/usr/local/cuda/include/cuda_runtime_api.h:252:17: error: ‘cudaError_t’ does not name a type
extern host cudaError_t CUDARTAPI cudaDeviceReset(void);
^
/usr/local/cuda/include/cuda_runtime_api.h:269:36: error: ‘cudaError_t’ does not name a type
extern host cudart_builtin cudaError_t CUDARTAPI cudaDeviceSynchronize(void);
I think there are something I am missing. If somebody knows it, please let me know. Thanks.
Best regards
George Liao