Skip to content

Commit

Permalink
int/size_t mismatches, nvhpc with omp offload
Browse files Browse the repository at this point in the history
  • Loading branch information
ristvan authored and bozbez committed Dec 11, 2024
1 parent 56fdf81 commit 6677657
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion makefiles/compilers/c/nvhpc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions op2/src/cuda/op_cuda_rt_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions op2/src/openmp4/op_openmp4_decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
9 changes: 5 additions & 4 deletions op2/src/openmp4/op_openmp4_rt_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 6677657

Please sign in to comment.