calling kernel directly

Sep 20, 2013 at 4:02 AM
Edited Sep 20, 2013 at 4:02 AM
I'm trying to call the kernel directly, for testing purposes.

my kernel looks like a standard kernel:
        public static void myKernel(GThread thread, float[] inp1)
            int ThreadID,TotalThreads;
            ThreadID = thread.blockIdx.x*thread.blockDim.x + thread.threadIdx.x;
            TotalThreads = thread.blockDim.x * thread.gridDim.x;

            for(int i=ThreadID;i<inp1.Length;i+=TotalThreads)
and my dummy calling method currently looks like this:
                GGrid gg = new GGrid(new dim3(BlockSize,GridSize));
                for(int i2=0;i2<BlockSize;i2++)
                    GBlock gb = new GBlock(gg, new dim3(GridSize, 1), i1, 0);
                    GThread aThread = new GThread(i2,0, gb);
                    myKernel(aThread, inp1);
You can see I'm trying to construct the GGrid, GBlock and GThread objects, which would normally be handled by Cudafy.

It's not quite right though - not iterating through the inp array once and only once.

Is it obvious what I am doing wrong?
Sep 20, 2013 at 8:56 AM
You should use the emulator instead.
Sep 20, 2013 at 10:49 PM
Edited Sep 20, 2013 at 10:52 PM
agreed, although firstly I am having problems with that, and secondly it would be good to understand how this works.

Also, for some purposes I want to be able to run my kernel functions with no dependency on Cudafy.