Example #1
0
        public static void FloatKernel(GpuArrayWrite <float> output, d3 gridDim,
                                       d3 blockDim, d3 blockId, d3 threadId)
        {
            var index       = blockId.d3Dex(gridDim) * blockDim.Volume() + threadId.d3Dex(blockDim);
            var totalVolume = blockDim.Volume() * gridDim.Volume();

            output.AddGpuData(
                val: (2 * index - totalVolume) / (float)totalVolume,
                index: index, block: blockId, thread: threadId);
        }
Example #2
0
 public static Action <d3, d3, d3, d3> FloatKernelWrap(GpuArrayWrite <float> gpuArrayWrite,
                                                       d3 gridDim, d3 blockDim)
 {
     return((d3 gd, d3 bd, d3 blockId, d3 threadId) =>
            FloatKernel(gpuArrayWrite, gd, bd, blockId, threadId));
 }
Example #3
0
 public static void IntKernel(GpuArrayWrite <int> output, d3 gridDim,
                              d3 blockDim, d3 blockId, d3 threadId)
 {
     output.AddGpuData(1, blockId.X * blockDim.X + threadId.X, blockId, threadId);
 }