This project is read-only.

Cudafy kernel does not compile

Mar 11, 2015 at 3:55 PM
Making my first steps with Cudafy and trying to write a function which will take its thread's location and based on that save some int value into an array element. My code:
[Cudafy]
public static void GenerateRipples(GThread thread, int[] results)
{
  int threadPosInBlockX = thread.threadIdx.x;
  int threadPosInBlockY = thread.threadIdx.y;

  int blockPosInGridX = thread.blockIdx.x;
  int blockPosInGridY = thread.blockIdx.y;

  int gridSizeX = thread.gridDim.x;
  int gridSizeY = thread.gridDim.y;

  int blockSizeX = thread.blockDim.x;
  int blockSizeY = thread.blockDim.y;

  //int threadX = blockSizeX*blockPosInGridX + threadPosInBlockX;

  //if i use only one variable, everything is fine:
  int threadY = blockSizeY;

  //if i add or multiply anything, it cannot compile:
  //int threadY = blockSizeY*blockPosInGridY + threadPosInBlockY;


//  results[gridSizeX*blockSizeX*threadY + threadX] = 255;
}
So I cannot calculate the threadY here. If I use more than one variable in the calculations, the Cudafy translating class throws an error (CudafyModule cm = CudafyTranslator.Cudafy(); throws a Cudafy.CudafyLanguageException).

What am I doing wrong?