Skip to content

Instantly share code, notes, and snippets.

@InnovArul
Last active February 7, 2016 09:50
Show Gist options
  • Save InnovArul/5b02f12fc46c57f32844 to your computer and use it in GitHub Desktop.
Save InnovArul/5b02f12fc46c57f32844 to your computer and use it in GitHub Desktop.
demonstration of the usage of helper API CudaCheckError()
#include <stdio.h>
/**
* A dummy cuda asynchronous function
*/
__global__ void fillContents(int N, int* output)
{
int correctIndex = threadIdx.x * N;
for(int i = correctIndex; i < N; i++)
{
output[i] = (i - correctIndex) * 2;
}
}
//get it from https://gist.github.com/InnovArul/68a720d6843aab6e246a
#include "CudaErrorCheck.cu"
int main()
{
int* unallocatedArray;
fillContents<<<>>>(5, unallocatedArray);
CudaCheckError();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment