13
My setup for CUDA
Visual Studio 2010 and 2008 SP1 (required by CUDA). Parallel NSight 1.51 CUDA 4.0 RC or 3.2 and Thrust
Basically, i followed the guide on: http://www.ademiller.com/blogs/tech/2011/03/using-cuda-and-thrust-with-visual-studio-2010/
I then proceeded to compile successfully without error messages.
So i tried with more CUDA code examples from the web. These errors surfaced on Visual Studios. I can still compile successfully without error messages but these errors are only visually highlighted
- "Error:identifer "blockIdx" is undfined."
- "Error:identifer "blockDim" is undfined."
- "Error:identifer "threadIdx" is undfined."
Here's the screenshot.
https://i.sstatic.net/v1LFx.png
Should i be concerned? Is it a Visual Studios bug or is my setup configuration wrong? Any help is appreciated. Thanks guys!
P.S I'm very new to both Visual Studios and CUDA.
// incrementArray.cu
#include "Hello.h"
#include <stdio.h>
#include <assert.h>
#include <cuda.h>
void incrementArrayOnHost(float *a, int N)
{
int i;
for (i=0; i < N; i++) a[i] = a[i]+1.f;
}
__global__ void incrementArrayOnDevice(float *a, int N)
{
int idx = blockIdx.x*blockDim.x + threadIdx.x;
if (idx<N) a[idx] = a[idx]+1.f;
}
int main(void)
{
float *a_h, *b_h; // pointers to host memory
float *a_d; // pointer to device memory
int i, N = 10;
size_t size = N*sizeof(float);
// allocate arrays on host
a_h = (float *)malloc(size);
b_h = (float *)malloc(size);
// allocate array on device
cudaMalloc((void **) &a_d, size);
// initialization of host data
for (i=0; i<N; i++) a_h[i] = (float)i;
// copy data from host