example to launch kernel
import grain.kernel; // : saxpy; // Populate input uint n = 16; auto hostA = new float[n]; auto hostB = new float[n]; auto hostC = new float[n]; foreach (i; 0 .. n) { hostA[i] = i; hostB[i] = 2 * i; hostC[i] = 0; } // Device data auto devA = CuPtr!float(hostA); auto devB = CuPtr!float(hostB); auto devC = CuPtr!float(n); // Kernel launch Global.kernel!(saxpy).call(devC.ptr, devA.ptr, devB.ptr, n).launch(n); // Validation devC.toHost(hostC); foreach (i; 0 .. n) { // writefln!"%f + %f = %f"(hostA[i], hostB[i], hostC[i]); assert(hostA[i] + hostB[i] == hostC[i]); }
cudnn error checker