|
QUDA v0.3.2
A library for QCD on GPUs
|
00001 #ifndef _UTIL_QUDA_H 00002 #define _UTIL_QUDA_H 00003 00004 #include <stdio.h> 00005 #include <stdlib.h> 00006 00007 #ifdef USE_QMP 00008 00009 #include <qmp.h> 00010 00011 #define printfQuda(...) do { \ 00012 if (QMP_get_node_number() == 0) { \ 00013 printf(__VA_ARGS__); \ 00014 fflush(stdout); \ 00015 } \ 00016 } while (0) 00017 00018 #define errorQuda(...) do { \ 00019 printf("QUDA error: " __VA_ARGS__); \ 00020 printf(" (node %d, " __FILE__ ":%d)\n", \ 00021 QMP_get_node_number(), __LINE__); \ 00022 QMP_abort(1); \ 00023 } while (0) 00024 00025 #else 00026 00027 #define printfQuda(...) do { printf(__VA_ARGS__); fflush(stdout); } while (0) 00028 00029 #define errorQuda(...) do { \ 00030 printf("QUDA error: " __VA_ARGS__); \ 00031 printf(" (" __FILE__ ":%d)\n", __LINE__); \ 00032 exit(1); \ 00033 } while (0) 00034 00035 #endif // USE_QMP 00036 00037 #define warningQuda(...) do { \ 00038 printfQuda("QUDA warning: " __VA_ARGS__); \ 00039 printfQuda("\n"); \ 00040 } while (0) 00041 00042 #define checkCudaError() do { \ 00043 cudaThreadSynchronize(); \ 00044 cudaError_t error = cudaGetLastError(); \ 00045 if (error != cudaSuccess) \ 00046 errorQuda("(CUDA) %s", cudaGetErrorString(error)); \ 00047 } while (0) 00048 00049 #ifdef __cplusplus 00050 extern "C" { 00051 #endif 00052 00053 void stopwatchStart(); 00054 double stopwatchReadSeconds(); 00055 00056 #ifdef __cplusplus 00057 } 00058 #endif 00059 00060 #endif // _UTIL_QUDA_H
1.7.3