Sha256: aa5b7b5e08b479f7a565e47eb9a8a230998d2767f323a213b24921ea81177f5f

Contents?: true

Size: 705 Bytes

Versions: 1

Compression:

Stored size: 705 Bytes

Contents

#include <stdio.h>
#include <cuda_runtime.h>

#define BONES_MIN(a,b) ((a<b) ? a : b)
#define BONES_MAX(a,b) ((a>b) ? a : b)
#define DIV_CEIL(a,b)  ((a+b-1)/b)
#define DIV_FLOOR(a,b) (a/b)

// Function to initialize the GPU (for fair measurements)
void bones_initialize_target(void) {
  int* bones_temporary = 0;
  cudaMalloc((void**)&bones_temporary, sizeof(int));
  cudaFree(bones_temporary);
}

// Declaration of the original function
int bones_main(void);

// New main function for initialisation and clean-up
int main(void) {
  
  // Initialisation of the target
  bones_initialize_target();
  
  // Original main function
  int bones_return = bones_main();
  
  // Clean-up
  return bones_return;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bones-compiler-1.1.0 skeletons/GPU-CUDA/common/globals.c