diff --git a/macros.make.cheyenne.gnu b/macros.make.cheyenne.gnu index 1cf413d..b48f6e5 100644 --- a/macros.make.cheyenne.gnu +++ b/macros.make.cheyenne.gnu @@ -10,8 +10,10 @@ CC = gcc ifeq ($(OPENMP),1) OMPFLAGS= -fopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -fbacktrace -ffree-form -fconvert=big-endian SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.cheyenne.intel b/macros.make.cheyenne.intel index af20da6..17c9394 100644 --- a/macros.make.cheyenne.intel +++ b/macros.make.cheyenne.intel @@ -10,8 +10,10 @@ CC = icc ifeq ($(OPENMP),1) OMPFLAGS= -qopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -xHOST -traceback -free -convert big_endian - SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.cheyenne.pgi b/macros.make.cheyenne.pgi index a40fe01..94804e2 100644 --- a/macros.make.cheyenne.pgi +++ b/macros.make.cheyenne.pgi @@ -10,8 +10,10 @@ CC = pgcc ifeq ($(OPENMP),1) OMPFLAGS= -mp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -traceback -Mfree -byteswapio -c -fPIC SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -traceback -O3 -Mrecursive -i4 -r8 -byteswapio -Kieee -Mpreprocess -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -traceback -O3 -Mrecursive -i4 -r8 -byteswapio -Kieee -Mpreprocess -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.gaea.intel b/macros.make.gaea.intel index e1b2369..7be6cfd 100644 --- a/macros.make.gaea.intel +++ b/macros.make.gaea.intel @@ -10,8 +10,10 @@ CC = icc ifeq ($(OPENMP),1) OMPFLAGS= -qopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -xHOST -traceback -free -convert big_endian - SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.hera.intel b/macros.make.hera.intel index 4a4952c..c2e8ec1 100644 --- a/macros.make.hera.intel +++ b/macros.make.hera.intel @@ -10,8 +10,10 @@ CC = icc ifeq ($(OPENMP),1) OMPFLAGS= -qopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -xHOST -traceback -free -convert big_endian - SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.jet.intel b/macros.make.jet.intel index 4a4952c..c2e8ec1 100644 --- a/macros.make.jet.intel +++ b/macros.make.jet.intel @@ -10,8 +10,10 @@ CC = icc ifeq ($(OPENMP),1) OMPFLAGS= -qopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -xHOST -traceback -free -convert big_endian - SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.linux.gnu b/macros.make.linux.gnu index 83ddf28..c18ec42 100644 --- a/macros.make.linux.gnu +++ b/macros.make.linux.gnu @@ -10,8 +10,10 @@ ARFLAGS = ifeq ($(OPENMP),1) OMPFLAGS= -fopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -42,7 +44,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -fbacktrace -ffree-form -fconvert=big-endian SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.linux.intel b/macros.make.linux.intel index 8f8388a..70981d5 100644 --- a/macros.make.linux.intel +++ b/macros.make.linux.intel @@ -10,8 +10,10 @@ CC = icc ifeq ($(OPENMP),1) OMPFLAGS= -qopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -xHOST -traceback -free -convert big_endian - SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.macosx.gnu b/macros.make.macosx.gnu index d1454de..23d1edc 100644 --- a/macros.make.macosx.gnu +++ b/macros.make.macosx.gnu @@ -10,8 +10,10 @@ ARFLAGS = ifeq ($(OPENMP),1) OMPFLAGS= -fopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -fbacktrace -ffree-form -fconvert=big-endian SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.theia.gnu b/macros.make.theia.gnu index d942aeb..265cb30 100644 --- a/macros.make.theia.gnu +++ b/macros.make.theia.gnu @@ -10,8 +10,10 @@ CC = gcc ifeq ($(OPENMP),1) OMPFLAGS= -fopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -fbacktrace -ffree-form -fconvert=big-endian SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -fdefault-real-8 -fconvert=big-endian -cpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.theia.intel b/macros.make.theia.intel index 4a4952c..c2e8ec1 100644 --- a/macros.make.theia.intel +++ b/macros.make.theia.intel @@ -10,8 +10,10 @@ CC = icc ifeq ($(OPENMP),1) OMPFLAGS= -qopenmp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -xHOST -traceback -free -convert big_endian - SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -O3 -auto -i4 -r8 -convert big_endian -assume byterecl -fp-model strict -fpp -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/macros.make.theia.pgi b/macros.make.theia.pgi index bcef27a..b38b1f6 100644 --- a/macros.make.theia.pgi +++ b/macros.make.theia.pgi @@ -10,8 +10,10 @@ CC = pgcc ifeq ($(OPENMP),1) OMPFLAGS= -mp + OMPCPPFLAGS= -DOPENMP else OMPFLAGS= + OMPCPPFLAGS= endif # Number of parallel tasks for gmake @@ -50,7 +52,7 @@ SIGIO_FFLAGS = $(OMPFLAGS) -O0 -g -traceback -Mfree -byteswapio -c -fPIC SIGIO_ARFLAGS = crvs # Flags for sp library -SP_FFLAGS = $(OMPFLAGS) -traceback -O3 -Mrecursive -i4 -r8 -byteswapio -Kieee -Mpreprocess -DLINUX -fPIC +SP_FFLAGS = $(OMPFLAGS) -traceback -O3 -Mrecursive -i4 -r8 -byteswapio -Kieee -Mpreprocess -DLINUX -fPIC $(OMPCPPFLAGS) SP_ARFLAGS = -ruv # Flags for w3emc library diff --git a/make_ncep_libs.sh b/make_ncep_libs.sh index 4eb7b96..91fccc9 100755 --- a/make_ncep_libs.sh +++ b/make_ncep_libs.sh @@ -182,7 +182,9 @@ cp -v ${MACROS_FILE}.${SYSTEM}.${COMPILER} ${MACROS_FILE} #-------------------------------------------------------------- # Copy library source to BUILD_DIR and build #-------------------------------------------------------------- -export OPENMP=${OPENMP} +if [ "$OPENMP" == "1" ]; then + export OPENMP=${OPENMP} +fi rsync -a macros.make Makefile src ${BUILD_DIR} cd ${BUILD_DIR} if [ "$APP" == "all" ]; then diff --git a/src/sp/v2.0.2/src/ncpus.F b/src/sp/v2.0.2/src/ncpus.F index 4ff8ee0..33f3295 100644 --- a/src/sp/v2.0.2/src/ncpus.F +++ b/src/sp/v2.0.2/src/ncpus.F @@ -29,6 +29,7 @@ FUNCTION NCPUS() C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INTEGER NTHREADS, TID, OMP_GET_NUM_THREADS,OMP_GET_THREAD_NUM C Obtain thread number +#ifdef OPENMP #ifdef LINUX !$OMP PARALLEL PRIVATE(TID) TID = OMP_GET_THREAD_NUM() @@ -41,6 +42,8 @@ FUNCTION NCPUS() #else NCPUS=NUM_PARTHDS() #endif - +#else + NCPUS=1 +#endif RETURN END