Constantin
Constantin

Reputation: 17758

CUDA 5.0 Header Files

I am struggling with someone's terribly written project and I'm trying to get it compiled ASAP... (best approach would be to do this correctly but time is an issue) ... anyways, they seem to have written this with an older API, where #include <cuda.h> gave you access to the api functions.

It seems the API functions have been moved to other headers and #include <cuda.h> is no longer enough. What should I do:

  1. Include cuda_runtime_api.h and other header files
  2. Compile this cpp (no kernel function calls) with nvcc?

TIA

Upvotes: 2

Views: 14928

Answers (1)

4pie0
4pie0

Reputation: 29724

for example:

#include <cstdlib>
#include <stdio.h>

// includes CUDA Runtime
#include <cuda_runtime.h>

// maybe you need also helpers
#include <helper_cuda.h>
#include <helper_functions.h> // helper utility functions 

you need to add

/usr/local/cuda-5.0/bin/nvcc

as C++ Compiler -> Tool also. works with g++ 4.4

in your .cu file you need then #include <curand_kernel.h> if you are using CURAND library

as Robert Crovella said:

You should not need to explicitly include cuda.h if you are only using the cuda runtime API to access CUDA functionality. If you are using the driver API, things are different.

Upvotes: 4

Related Questions