From 21412a655ac1fd938b9486775d7a53d369b3c732 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Tue, 25 Feb 2020 19:08:31 -0600 Subject: [PATCH] cuda: fix build errors when built without openmp --- SRC/dSchCompUdt-cuda.c | 14 +++++++++++--- SRC/zSchCompUdt-cuda.c | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/SRC/dSchCompUdt-cuda.c b/SRC/dSchCompUdt-cuda.c index 6ac47425b..e419be652 100644 --- a/SRC/dSchCompUdt-cuda.c +++ b/SRC/dSchCompUdt-cuda.c @@ -281,13 +281,18 @@ if ( msg0 && msg2 ) { /* L(:,k) and U(k,:) are not empty. */ firstprivate(luptr,lptr) default (shared) #endif { - int thread_id = omp_get_thread_num(); + int thread_id = 1; + int num_threads = 1; +#ifdef _OPENMP + thread_id = omp_get_thread_num(); + num_threads = omp_get_num_threads(); +#endif int* indirect_thread = indirect + ldt*thread_id; int* indirect2_thread = indirect2 + ldt*thread_id; double* tempv1; - if (ncpu_blks< omp_get_num_threads()) { + if (ncpu_blks< num_threads) { // TAU_STATIC_TIMER_START("SPECIAL_CPU_SCATTER"); for (j = jjj_st; j < jjj_st+ncpu_blks; ++j) { @@ -471,7 +476,10 @@ if ( msg0 && msg2 ) { /* L(:,k) and U(k,:) are not empty. */ firstprivate(luptr,lptr) default (shared) #endif { - int thread_id = omp_get_thread_num(); + int thread_id = 1; +#ifdef _OPENMP + thread_id = omp_get_thread_num(); +#endif int* indirect_thread = indirect + ldt*thread_id; int* indirect2_thread = indirect2 + ldt*thread_id; diff --git a/SRC/zSchCompUdt-cuda.c b/SRC/zSchCompUdt-cuda.c index 4bed7a9ec..291bbff57 100644 --- a/SRC/zSchCompUdt-cuda.c +++ b/SRC/zSchCompUdt-cuda.c @@ -284,13 +284,18 @@ if ( msg0 && msg2 ) { /* L(:,k) and U(k,:) are not empty. */ firstprivate(luptr,lptr) default (shared) #endif { - int thread_id = omp_get_thread_num(); + int thread_id = 1; + int num_threads = 1; +#ifdef _OPENMP + thread_id = omp_get_thread_num(); + num_threads = omp_get_num_threads(); +#endif int* indirect_thread = indirect + ldt*thread_id; int* indirect2_thread = indirect2 + ldt*thread_id; doublecomplex* tempv1; - if (ncpu_blks< omp_get_num_threads()) { + if (ncpu_blks< num_threads) { // TAU_STATIC_TIMER_START("SPECIAL_CPU_SCATTER"); for (j = jjj_st; j < jjj_st+ncpu_blks; ++j) { @@ -474,7 +479,10 @@ if ( msg0 && msg2 ) { /* L(:,k) and U(k,:) are not empty. */ firstprivate(luptr,lptr) default (shared) #endif { - int thread_id = omp_get_thread_num(); + int thread_id = 1; +#ifdef _OPENMP + thread_id = omp_get_thread_num(); +#endif int* indirect_thread = indirect + ldt*thread_id; int* indirect2_thread = indirect2 + ldt*thread_id;