Sha256: bc7c3b86d90a06268e9fb055451b0ed3bb15a2e7d67b29cf7ed3d4a1fe24ff3f
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
//////////////////////////////////////// //////////// Globals /////////////////// //////////////////////////////////////// #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) // CUDA timers cudaEvent_t bones_start2; cudaEvent_t bones_stop2; // Function to initialize the GPU (for fair measurements, streams, timers) void bones_initialize_target(void) { int* bones_temporary = 0; cudaMalloc((void**)&bones_temporary, sizeof(int)); cudaFree(bones_temporary); cudaStreamCreate(&kernel_stream); cudaEventCreate(&bones_start2); cudaEventCreate(&bones_stop2); } // Declaration of the original function int bones_main(void); //////////////////////////////////////// //////////// Main function ///////////// //////////////////////////////////////// // New main function for initialisation and clean-up int main(void) { // Initialisation of the scheduler bones_initialize_scheduler(); pthread_t bones_scheduler_thread; pthread_create(&bones_scheduler_thread, NULL, bones_scheduler, NULL); // Initialisation of the target bones_initialize_target(); // Original main function int bones_return = bones_main(); // Clean-up bones_scheduler_done = 1; pthread_join(bones_scheduler_thread, NULL); cudaStreamDestroy(kernel_stream); return bones_return; } //////////////////////////////////////// ////////// Accelerated functions /////// ////////////////////////////////////////
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bones-compiler-1.6.0 | skeletons/GPU-CUDA/common/globals.c |
bones-compiler-1.3.1 | skeletons/GPU-CUDA/common/globals.c |