Skip to content
Extraits de code Groupes Projets
Valider dcf19967 rédigé par Nicolas MARIE's avatar Nicolas MARIE
Parcourir les fichiers

start tp 3

parent 917150c5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
CC=clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 CC=clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_61
CFLAGS=-O3 -Wall CFLAGS=-O3 -Wall
LDFLAGS=-lm -lrt LDFLAGS=-lm -lrt
EXEC=dgemm.exe EXEC=ongpu
SRC=$(wildcard *.c) SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o) OBJ=$(SRC:.c=.o)
......
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
int main() int main()
{ {
int runningOnGPU = 0; int runningOnGPU = 0;
fprintf(stderr, "OpenMP Version: %d\n", _OPENMP); fprintf(stderr, "OpenMP Version: %d\n", _OPENMP);
/* Test if GPU is available using OpenMP4.5 */ /* Test if GPU is available using OpenMP4.5 */
#pragma omp target map(from:runningOnGPU) #pragma omp target map(from:runningOnGPU)
{ {
if (omp_is_initial_device() == 0) if (omp_is_initial_device() == 0)
runningOnGPU = 1; runningOnGPU = 1;
} }
/* If still running on CPU, GPU must not be available */ /* If still running on CPU, GPU must not be available */
if (runningOnGPU) if (runningOnGPU)
printf("### Able to use the GPU! ### \n"); printf("### Able to use the GPU! ### \n");
else else
printf("### Unable to use the GPU, using CPU! ###\n"); printf("### Unable to use the GPU, using CPU! ###\n");
return 0; return 0;
} }
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter