From d19130a0ab8722aa2c386e4e4e288b2f726276cf Mon Sep 17 00:00:00 2001 From: Jan Thorbecke <janth@xs4all.nl> Date: Mon, 12 Nov 2018 09:16:31 +0100 Subject: [PATCH] adding #ifdeg for OpenMP specific parts --- corrvir/corrvir.c | 6 ++++++ fdelmodc/threadAffinity.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/corrvir/corrvir.c b/corrvir/corrvir.c index 2ca64e0..2a17e98 100644 --- a/corrvir/corrvir.c +++ b/corrvir/corrvir.c @@ -11,10 +11,12 @@ double wallclock_time(void); +#ifdef _OPENMP int omp_get_max_threads(void); int omp_get_num_threads(void); int omp_get_thread_num(void); void omp_set_num_threads(int num_threads); +#endif typedef struct { /* complex number */ float r,i; @@ -383,7 +385,9 @@ int main (int argc, char **argv) c = (complex *)malloc((ntfft/2+1)*sizeof(complex)); //itrace_out=0; +#ifdef _OPENMP fprintf(stderr,"Number of OpenMP threads set = %d number=%d\n", omp_get_max_threads(), omp_get_thread_num()); +#endif ivs = 0; while (ivs<nvsrc) {/* loop over the number of virtual source positions to be created */ @@ -638,7 +642,9 @@ int main (int argc, char **argv) { if (verbose>=3) { t3_ivs = wallclock_time(); +#ifdef _OPENMP fprintf(stderr,"Number of OpenMP threads set = %d number=%d\n", omp_get_max_threads(), omp_get_thread_num()); +#endif //tlogic_ivs = ((t3_ivs-t1_ivs)-tread_ivs-tfft_ivs-tcorr_ivs-twrite_ivs-tmemcpy); fprintf(stderr,"************* Timings ************* vshot= %d (ivs = %d)\n", vspeg, ivs); //fprintf(stderr,"CPU-time read data = %.3f\n", tread_ivs); diff --git a/fdelmodc/threadAffinity.c b/fdelmodc/threadAffinity.c index 49ca7e9..bd9913c 100644 --- a/fdelmodc/threadAffinity.c +++ b/fdelmodc/threadAffinity.c @@ -94,7 +94,7 @@ void threadAffinity(void) /* for use inside parallel region */ #pragma omp critical { -#ifdef __USE_GNU +#ifdef _OPENMP thread = omp_get_thread_num(); #else thread = 1; -- GitLab