checkCUDNN

cudnn error checker

version(grain_cuda)
void
checkCUDNN
(
string file = __FILE__
size_t line = __LINE__
)

Examples

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]);
}

Meta