I have the following files:
// Main.cpp
#include "kernel_util.cuh"
int main()
{
call_kernel();
}
// kernel_util.cuh
#ifndef KERNEL_UTIL
#define KERNEL_UTIL
#include <cuda_runtime.h>
void call_kernel();
#endif
// kernel_util.cu
#include "kernel_util.cuh"
#include "kernel.curnel"
#define thread 16
void call_kernel() {
dim3 blocks( ( width + thread - 1 ) / thread, ( height + thread - 1 ) / thread );
dim3 threads( thread, thread );
kernel<<<blocks, threads>>>();
}
// kernel.curnel
#ifndef KERNEL
#define KERNEL
#include <cuda_runtime.h>
__global__ void kernel() {
}
#endif
I have Visual Studio 2010 with 64 bit compiler and CUDA 5.0 toolkit installed. Above code compiles successfully but line
kernel<<<blocks, threads>>>();
3rd <
gives "expected an expression" error, but code compiles without problems and reaches kernel function.
Configuration properties:
- cpp file item type c/c++ compiler
- cu file item type cuda c/c++
- cuh file item type Does not participate in build
- curnel file item type Does not participate in build