Skip to content
Snippets Groups Projects
Commit b07e41ce authored by Ayoub Boughourfi's avatar Ayoub Boughourfi
Browse files

Update 2 files

- /pthwithcuda/algorithms/cuda/cuda_helpers.cuh
- /pthwithcuda/algorithms/cuda/cuda_helpers.cu
parent 24cee645
No related branches found
No related tags found
No related merge requests found
#include "cuda_helpers.cuh"
// Definition der externen Variable
bool g_cuda_info_printed = false;
\ No newline at end of file
......@@ -6,6 +6,9 @@
#include <stdio.h>
#include <algorithm>
// Externe Variable zur Kontrolle der CUDA-Info-Ausgabe
extern bool g_cuda_info_printed;
// Hilfsfunktion zur Fehlerprüfung von CUDA-Operationen
#define cudaCheckError() { \
cudaError_t e = cudaGetLastError(); \
......@@ -30,6 +33,8 @@ inline bool checkCudaDevice() {
return false;
}
// Geräteinformationen nur einmal ausgeben
if (!g_cuda_info_printed) {
// Geräteinformationen abrufen
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, 0);
......@@ -40,6 +45,9 @@ inline bool checkCudaDevice() {
printf(" Total Global Memory: %.2f GB\n", deviceProp.totalGlobalMem / (1024.0 * 1024.0 * 1024.0));
printf(" Multiprocessors: %d\n", deviceProp.multiProcessorCount);
g_cuda_info_printed = true;
}
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment