 
 extern __shared__ unsigned char sharedMemory[];
 
-#define cudaErrorCheck(code) { cudaAssert(code, __FILE__, __LINE__); }
-
-void cudaAssert(cudaError_t code, const char* file, int line) {
+void errorCheck(cudaError_t code) {
   if (code != cudaSuccess) {
-    fprintf(stderr, "cudaAssert: %s at %s:%d\n", cudaGetErrorString(code), file, line);
+    fprintf(stderr, "CUDA error: %s\n", cudaGetErrorString(code));
     exit(code);
   }
 }

}

int main(int argc, char** argv) {
  int numBlocks = 1;
  int numThreadsPerBlock = 1;
  int sharedMemoryOffset = 0;

  printf("one\n");

  initialize<<<numBlocks, numThreadsPerBlock, numThreadsPerBlock * sizeof(Aggregator)>>>(sharedMemoryOffset);
  cudaErrorCheck(cudaPeekAtLastError());
  cudaErrorCheck(cudaDeviceSynchronize());

  printf("two\n");


  printf("eight\n");

  Aggregator* sumOverBlock = NULL;
  errorCheck(cudaMalloc((void**)&sumOverBlock, numBlocks * sizeof(Aggregator)));

  printf("nine\n");

  extractFromBlock<<<numBlocks, 1, sharedMemoryOffset + numThreadsPerBlock * sizeof(Aggregator)>>>(sharedMemoryOffset, numThreadsPerBlock, sumOverBlock);
  errorCheck(cudaPeekAtLastError());
  errorCheck(cudaDeviceSynchronize());

  printf("ten\n");

