From 28aa8dfe00a2e0daa69ab43c8bd97ed37e5aa0b9 Mon Sep 17 00:00:00 2001 From: ristvan Date: Wed, 20 Dec 2023 14:09:11 -0800 Subject: [PATCH] int/size_t mismatches, nvhpc with omp offload --- makefiles/compilers/c/nvhpc.mk | 2 +- op2/src/cuda/op_cuda_rt_support.cpp | 4 ++-- op2/src/openmp4/op_openmp4_decl.cpp | 4 ++-- op2/src/openmp4/op_openmp4_rt_support.cpp | 9 +++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/makefiles/compilers/c/nvhpc.mk b/makefiles/compilers/c/nvhpc.mk index 0245eda5c..68a7af3fc 100644 --- a/makefiles/compilers/c/nvhpc.mk +++ b/makefiles/compilers/c/nvhpc.mk @@ -20,5 +20,5 @@ CONFIG_CPP_HAS_OMP ?= true GPU_FFLAG := -gpu=fastmath,ptxinfo,lineinfo $(foreach arch,$(CUDA_GEN),$(eval GPU_FFLAG := $(GPU_FFLAG),cc$(arch))) -CONFIG_OMP_OFFLOAD_CPPFLAGS ?= -mp=gpu $(GPU_FFLAG) +CONFIG_OMP_OFFLOAD_CXXFLAGS ?= -mp=gpu $(GPU_FFLAG) CONFIG_CPP_HAS_OMP_OFFLOAD ?= true diff --git a/op2/src/cuda/op_cuda_rt_support.cpp b/op2/src/cuda/op_cuda_rt_support.cpp index 52414e54d..673d353c1 100644 --- a/op2/src/cuda/op_cuda_rt_support.cpp +++ b/op2/src/cuda/op_cuda_rt_support.cpp @@ -94,7 +94,7 @@ void __cutilCheckMsg(const char *errorMessage, const char *file, // routines to move arrays to/from GPU device // -void op_mvHostToDevice(void **map, int size) { +void op_mvHostToDevice(void **map, size_t size) { if (!OP_hybrid_gpu || size == 0) return; void *tmp; @@ -105,7 +105,7 @@ void op_mvHostToDevice(void **map, int size) { *map = tmp; } -void op_cpHostToDevice(void **data_d, void **data_h, int size) { +void op_cpHostToDevice(void **data_d, void **data_h, size_t size) { if (!OP_hybrid_gpu) return; if (*data_d != NULL) cutilSafeCall(cudaFree(*data_d)); diff --git a/op2/src/openmp4/op_openmp4_decl.cpp b/op2/src/openmp4/op_openmp4_decl.cpp index da8048c12..d8ef6980f 100644 --- a/op2/src/openmp4/op_openmp4_decl.cpp +++ b/op2/src/openmp4/op_openmp4_decl.cpp @@ -9,9 +9,9 @@ void cutilDeviceInit(int argc, char **argv); -void op_mvHostToDevice(void **map, int size); +void op_mvHostToDevice(void **map, size_t size); -void op_cpHostToDevice(void **data_d, void **data_h, int size); +void op_cpHostToDevice(void **data_d, void **data_h, size_t size); void op_cuda_exit(); diff --git a/op2/src/openmp4/op_openmp4_rt_support.cpp b/op2/src/openmp4/op_openmp4_rt_support.cpp index 078484915..32a59f7ad 100644 --- a/op2/src/openmp4/op_openmp4_rt_support.cpp +++ b/op2/src/openmp4/op_openmp4_rt_support.cpp @@ -19,7 +19,7 @@ // routines to move arrays to/from GPU device // -void op_mvHostToDevice(void **map, int size) { +void op_mvHostToDevice(void **map, size_t size) { if (!OP_hybrid_gpu) return; char *temp = (char*)*map; @@ -28,7 +28,7 @@ void op_mvHostToDevice(void **map, int size) { //TODO test } -void op_cpHostToDevice(void **data_d, void **data_h, int size) { +void op_cpHostToDevice(void **data_d, void **data_h, size_t size) { if (!OP_hybrid_gpu) return; *data_d = (char*)op_malloc(size); @@ -121,8 +121,9 @@ void op_cuda_exit() { return; op_dat_entry *item; TAILQ_FOREACH(item, &OP_dat_list, entries) { - #pragma omp target exit data map(from: (item->dat)->data_d) - free((item->dat)->data_d); + char *data_d = (item->dat)->data_d; + #pragma omp target exit data map(from: data_d) + free(data_d); } /* for (int ip = 0; ip < OP_plan_index; ip++) {