7 static void HandleError(cudaError_t err,
10 if (err != cudaSuccess) {
11 printf(
"%s in %s at line %d\n", cudaGetErrorString(err),
16 #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) 19 #define HANDLE_NULL( a ) {if (a == NULL) { \ 20 printf( "Host memory failed in %s at line %d\n", \ 21 __FILE__, __LINE__ ); \ 22 exit( EXIT_FAILURE );}} 25 CUDA* CUDA::instance =
nullptr;
39 bool CUDA::printDevInfo()
45 LOG(
"GPU Spec : %s\n", devProp.name);
47 LOG(
" - Global Memory : %llu\n", devProp.totalGlobalMem);
48 LOG(
" - Const Memory : %llu\n", devProp.totalConstMem);
50 LOG(
" - Global Memory : %zu\n", devProp.totalGlobalMem);
51 LOG(
" - Const Memory : %zu\n", devProp.totalConstMem);
53 LOG(
" - MP(Multiprocessor) Count : %d\n", devProp.multiProcessorCount);
54 LOG(
" - Maximum Threads per MP : %d\n", devProp.maxThreadsPerMultiProcessor);
55 LOG(
" - Warp Size : %u\n", devProp.warpSize);
57 LOG(
" - Shared Memory per MP : %llu\n", devProp.sharedMemPerMultiprocessor);
59 LOG(
" - Shared Memory per MP : %zu\n", devProp.sharedMemPerMultiprocessor);
61 LOG(
" - Block per MP : %d\n", devProp.maxThreadsPerMultiProcessor / devProp.maxThreadsPerBlock);
63 LOG(
" - Shared Memory per Block : %llu\n", devProp.sharedMemPerBlock);
65 LOG(
" - Shared Memory per Block : %zu\n", devProp.sharedMemPerBlock);
67 LOG(
" - Maximum Threads per Block : %d\n", devProp.maxThreadsPerBlock);
68 LOG(
" - Maximum Threads of each Dimension of a Block (X: %d / Y: %d / Z: %d)\n",
69 devProp.maxThreadsDim[
_X], devProp.maxThreadsDim[
_Y], devProp.maxThreadsDim[
_Z]);
70 LOG(
" - Maximum Blocks of each Dimension of a Grid, (X: %d / Y: %d / Z: %d)\n",
71 devProp.maxGridSize[
_X], devProp.maxGridSize[
_Y], devProp.maxGridSize[
_Z]);
72 LOG(
" - Device supports allocating Managed Memory on this system : %d\n\n", devProp.managedMemory);
80 uint64_t gb = 1024 * 1024 * 1024;
81 LOG(
"CUDA Memory: %.1f/%.1fGB\n", static_cast<double>(total - free) / gb, static_cast<double>(total) / gb);
#define HANDLE_ERROR(err)
void printMemoryInfo(uint64_t total, uint64_t free)