Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10 from mkavulich/splib_no_openmp
Browse files Browse the repository at this point in the history
Bug fix for building libsp without openmp
  • Loading branch information
climbfuji authored Oct 17, 2019
2 parents 53680b0 + cc870d6 commit 4fc8335
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 14 deletions.
4 changes: 3 additions & 1 deletion macros.make.cheyenne.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = gcc

ifeq ($(OPENMP),1)
OMPFLAGS= -fopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.cheyenne.intel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = icc

ifeq ($(OPENMP),1)
OMPFLAGS= -qopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.cheyenne.pgi
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = pgcc

ifeq ($(OPENMP),1)
OMPFLAGS= -mp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.gaea.intel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = icc

ifeq ($(OPENMP),1)
OMPFLAGS= -qopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.hera.intel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = icc

ifeq ($(OPENMP),1)
OMPFLAGS= -qopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.jet.intel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = icc

ifeq ($(OPENMP),1)
OMPFLAGS= -qopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.linux.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ ARFLAGS =

ifeq ($(OPENMP),1)
OMPFLAGS= -fopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.linux.intel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = icc

ifeq ($(OPENMP),1)
OMPFLAGS= -qopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.macosx.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ ARFLAGS =

ifeq ($(OPENMP),1)
OMPFLAGS= -fopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.theia.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = gcc

ifeq ($(OPENMP),1)
OMPFLAGS= -fopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.theia.intel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = icc

ifeq ($(OPENMP),1)
OMPFLAGS= -qopenmp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion macros.make.theia.pgi
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ CC = pgcc

ifeq ($(OPENMP),1)
OMPFLAGS= -mp
OMPCPPFLAGS= -DOPENMP
else
OMPFLAGS=
OMPCPPFLAGS=
endif

# Number of parallel tasks for gmake
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion make_ncep_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/sp/v2.0.2/src/ncpus.F
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -41,6 +42,8 @@ FUNCTION NCPUS()
#else
NCPUS=NUM_PARTHDS()
#endif

#else
NCPUS=1
#endif
RETURN
END

0 comments on commit 4fc8335

Please sign in to comment.