Problems with kernel invocation how to use this syntax : function<<<1, N>>>(A, B,

hello!

i have to develop my project in CUDA but i am a beginner. Actually, i try to implement somes examples given in the documentation (programming guide).

I have this error C2059: syntax error :’<’

I think i forgot a library or an include but i don’t know which one. Because the problem comes from this syntaxe :

matAdd<<<1, dimBlock>>>(A, B, C);

this is my program:

#include <stdio.h>
#include <stdlib.h>
#include “cuda.h”
#include “host_defines.h”
#include “vector_types.h”

global void matAdd(float A[3][3], float B[3][3],float C[3][3])
{
uint3 threadIdx;
int i = threadIdx.x;
int j = threadIdx.y;
C[i][j] = A[i][j] + B[i][j];
}
int main()
{
float A[3][3], B[3][3], C[3][3];
// Kernel invocation
dim3 dimBlock(3, 3);
matAdd<<<1, dimBlock>>>(A, B, C);
}

Could somebody help me please?

Thank you!

Hi,
you mustn’t declare threadIdx since it is a built in variable. Comment out the line containing “uint3 threadIdx” and try again.

… and you may ommit

#include "host_defines.h"

#include "vector_types.h"

let try it :)

global void matAdd(float A[3][3], float B[3][3],float C[3][3])

{

int i = threadIdx.x + blockIdx.x*blockDim.x;

            int j = threadIdx.y + blockIdx.y*blockDim.y;

C[i][j] = A[i][j] + B[i][j];

}

Also, make sure you are compiling with nvcc. That looks like an error that visual studio would throw.