From dcf19967765be9da8970aa98871a0d017ddfa016 Mon Sep 17 00:00:00 2001 From: "nicolas.marie" <nicolas.marie@ensiie.eu> Date: Mon, 18 Dec 2023 11:05:09 +0100 Subject: [PATCH] start tp 3 --- TPs/TP3/CODE/ONGPU/Makefile | 4 ++-- TPs/TP3/CODE/ONGPU/ongpu.c | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/TPs/TP3/CODE/ONGPU/Makefile b/TPs/TP3/CODE/ONGPU/Makefile index 645485d..76dd3a1 100755 --- a/TPs/TP3/CODE/ONGPU/Makefile +++ b/TPs/TP3/CODE/ONGPU/Makefile @@ -1,8 +1,8 @@ -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 LDFLAGS=-lm -lrt -EXEC=dgemm.exe +EXEC=ongpu SRC=$(wildcard *.c) OBJ=$(SRC:.c=.o) diff --git a/TPs/TP3/CODE/ONGPU/ongpu.c b/TPs/TP3/CODE/ONGPU/ongpu.c index 8a9260c..901ab15 100755 --- a/TPs/TP3/CODE/ONGPU/ongpu.c +++ b/TPs/TP3/CODE/ONGPU/ongpu.c @@ -3,19 +3,19 @@ int main() { - int runningOnGPU = 0; - fprintf(stderr, "OpenMP Version: %d\n", _OPENMP); - /* Test if GPU is available using OpenMP4.5 */ + int runningOnGPU = 0; + fprintf(stderr, "OpenMP Version: %d\n", _OPENMP); + /* Test if GPU is available using OpenMP4.5 */ #pragma omp target map(from:runningOnGPU) - { - if (omp_is_initial_device() == 0) - runningOnGPU = 1; - } - /* If still running on CPU, GPU must not be available */ - if (runningOnGPU) - printf("### Able to use the GPU! ### \n"); - else - printf("### Unable to use the GPU, using CPU! ###\n"); + { + if (omp_is_initial_device() == 0) + runningOnGPU = 1; + } + /* If still running on CPU, GPU must not be available */ + if (runningOnGPU) + printf("### Able to use the GPU! ### \n"); + else + printf("### Unable to use the GPU, using CPU! ###\n"); - return 0; + return 0; } -- GitLab