Skip to content

Commit

Permalink
handle old intel versions
Browse files Browse the repository at this point in the history
  • Loading branch information
georgu committed Apr 28, 2020
1 parent 61a77b7 commit c655031
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 32 deletions.
15 changes: 15 additions & 0 deletions COMMIT
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
============================================================

Tue Apr 28 12:06:11 CEST 2020

handle old intel versions

Rules.make | 36 ++++++++++++--------
fembin/cmv.sh | 71 ++++++++++++++++++++++++++++++++++++++++
femcheck/rules/Rules.dist | 36 ++++++++++++--------
femcheck/servers/check_server.sh | 2 --
femcheck/servers/fluxus.sh | 2 --
5 files changed, 115 insertions(+), 32 deletions(-)
new file:
fembin/cmv.sh

============================================================

Tue Apr 28 00:40:02 CEST 2020

still more on fluxus
Expand Down
36 changes: 22 additions & 14 deletions Rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -427,24 +427,31 @@ endif
#
##############################################

# determines major version for gfortran
# determines major version for compilers

GMV := $(shell $(FEMBIN)/gmv.sh)
GMV := $(shell $(FEMBIN)/cmv.sh gfortran)
IMV := $(shell $(FEMBIN)/cmv.sh intel)
GMV_LE_4 := $(shell [ $(GMV) -le 4 ] && echo true || echo false )
IMV_LE_14 := $(shell [ $(IMV) -le 14 ] && echo true || echo false )

#------------- print version of gfortran ------------
#gversion:
# @echo "GMV=$(GMV) WTABS=$(WTABS)"
# @$(FEMBIN)/gmv.sh -info
#------------------------------------------------------------
MVDEBUG := true
MVDEBUG := false
ifeq ($(MVDEBUG),true)
$(info gfortran major version = $(GMV) )
$(info gfortran major version <= 4: $(GMV_LE_4) )
$(info intel major version = $(IMV) )
$(info intel major version <= 14: $(IMV_LE_14) )
endif

# next solves incompatibility of option -Wtabs between version 4 and higher

WTABS = -Wno-tabs
ifeq ($(GMV),4)
ifeq ($(GMV_LE_4),true)
WTABS = -Wtabs
endif
#$(warning gmv=$(GMV) wtabs=$(WTABS))
#WTABS = -Wtabs #NEMUNAS_FIX_OLD
ifeq ($(MVDEBUG),true)
$(info WTABS = $(WTABS) )
endif

FGNU_GENERAL =
ifdef MODDIR
Expand Down Expand Up @@ -720,11 +727,12 @@ FINTEL_OMP =
ifeq ($(PARALLEL_OMP),true)
FINTEL_OMP = -threads -qopenmp
FINTEL_OMP = -qopenmp
#$(info INTEL_SHYFEM_OMPFLAG = $(INTEL_SHYFEM_OMPFLAG) )
ifneq ($(INTEL_SHYFEM_OMPFLAG),)
FINTEL_OMP = $(INTEL_SHYFEM_OMPFLAG)
ifeq ($(IMV_LE_14),true)
FINTEL_OMP = -openmp
endif
ifeq ($(MVDEBUG),true)
$(info FINTEL_OMP = $(FINTEL_OMP) )
endif
#$(info FINTEL_OMP = $(FINTEL_OMP) )
endif

ifeq ($(FORTRAN_COMPILER),INTEL)
Expand Down
2 changes: 2 additions & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version 7_5_69 06-03-2020 VERS_7_5_69 commit_2020-04-28

version 7_5_69 06-03-2020 VERS_7_5_69 commit_2020-04-28

version 7_5_69 06-03-2020 VERS_7_5_69 commit_2020-04-27

version 7_5_69 06-03-2020 VERS_7_5_69 commit_2020-04-27
Expand Down
71 changes: 71 additions & 0 deletions fembin/cmv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/sh
#
#------------------------------------------------------------------------
#
# Copyright (C) 1985-2018 Georg Umgiesser
#
# This file is part of SHYFEM.
#
#------------------------------------------------------------------------
#
# returns major version of compilers (gfortran and intel)
#
#-----------------------------------------------------------

Usage()
{
echo "Usage: cmv.sh [-info] {gfortran|intel}"
}

info="NO"
if [ "$1" = "-info" ]; then
info="YES"
shift
fi

if [ $# -eq 0 ]; then
Usage
exit 1
fi

#-----------------------------------------------------------

version=unknown
mversion=0

compiler=$1
compexe=$compiler
[ $compiler = intel ] && compexe=ifort

prog=$( which $compexe )

if [ -n "$prog" ]; then
if [ $compiler = gfortran ]; then
version=$( $prog -v 2>&1 | tail -1 | cut -d " " -f 3 )
if [ -n "$version" ]; then
mversion=$( echo $version | sed -e 's/\..*//' )
fi
elif [ $compiler = intel ]; then
version=$( $prog -v 2>&1 | sed -e 's/.*version *//' )
if [ -n "$version" ]; then
mversion=$( echo $version | sed -e 's/\..*//' )
fi
else
echo "compiler not supported: $compiler"
Usage
exit 1
fi
else
echo "cannot find compiler: $compiler"
Usage
exit 1
fi

if [ $info = "YES" ]; then
echo "$compiler version=$version major_version=$mversion"
else
echo "$mversion"
fi

#-----------------------------------------------------------

36 changes: 22 additions & 14 deletions femcheck/rules/Rules.dist
Original file line number Diff line number Diff line change
Expand Up @@ -427,24 +427,31 @@ endif
#
##############################################

# determines major version for gfortran
# determines major version for compilers

GMV := $(shell $(FEMBIN)/gmv.sh)
GMV := $(shell $(FEMBIN)/cmv.sh gfortran)
IMV := $(shell $(FEMBIN)/cmv.sh intel)
GMV_LE_4 := $(shell [ $(GMV) -le 4 ] && echo true || echo false )
IMV_LE_14 := $(shell [ $(IMV) -le 14 ] && echo true || echo false )

#------------- print version of gfortran ------------
#gversion:
# @echo "GMV=$(GMV) WTABS=$(WTABS)"
# @$(FEMBIN)/gmv.sh -info
#------------------------------------------------------------
MVDEBUG := true
MVDEBUG := false
ifeq ($(MVDEBUG),true)
$(info gfortran major version = $(GMV) )
$(info gfortran major version <= 4: $(GMV_LE_4) )
$(info intel major version = $(IMV) )
$(info intel major version <= 14: $(IMV_LE_14) )
endif

# next solves incompatibility of option -Wtabs between version 4 and higher

WTABS = -Wno-tabs
ifeq ($(GMV),4)
ifeq ($(GMV_LE_4),true)
WTABS = -Wtabs
endif
#$(warning gmv=$(GMV) wtabs=$(WTABS))
#WTABS = -Wtabs #NEMUNAS_FIX_OLD
ifeq ($(MVDEBUG),true)
$(info WTABS = $(WTABS) )
endif

FGNU_GENERAL =
ifdef MODDIR
Expand Down Expand Up @@ -720,11 +727,12 @@ FINTEL_OMP =
ifeq ($(PARALLEL_OMP),true)
FINTEL_OMP = -threads -qopenmp
FINTEL_OMP = -qopenmp
#$(info INTEL_SHYFEM_OMPFLAG = $(INTEL_SHYFEM_OMPFLAG) )
ifneq ($(INTEL_SHYFEM_OMPFLAG),)
FINTEL_OMP = $(INTEL_SHYFEM_OMPFLAG)
ifeq ($(IMV_LE_14),true)
FINTEL_OMP = -openmp
endif
ifeq ($(MVDEBUG),true)
$(info FINTEL_OMP = $(FINTEL_OMP) )
endif
#$(info FINTEL_OMP = $(FINTEL_OMP) )
endif

ifeq ($(FORTRAN_COMPILER),INTEL)
Expand Down
2 changes: 0 additions & 2 deletions femcheck/servers/check_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ ShowDirs()
echo "NETCDF_SHYFEM_LIBFDIR = $NETCDF_SHYFEM_LIBFDIR"
echo "NETCDF_SHYFEM_INCDIR = $NETCDF_SHYFEM_INCDIR"
echo "NETCDF_SHYFEM_MODDIR = $NETCDF_SHYFEM_MODDIR"
echo "INTEL_SHYFEM_OMPFLAG = $INTEL_SHYFEM_OMPFLAG"
echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH"
}

Expand All @@ -128,7 +127,6 @@ ResetDirsGeneric()
export NETCDF_SHYFEM_LIBFDIR=
export NETCDF_SHYFEM_INCDIR=
export NETCDF_SHYFEM_MODDIR=
export INTEL_SHYFEM_OMPFLAG=
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ORIG
}

Expand Down
2 changes: 0 additions & 2 deletions femcheck/servers/fluxus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ SetDirs_intel()
export NETCDF_SHYFEM_INCDIR=$basedir
export NETCDF_SHYFEM_MODDIR=$basedir

export INTEL_SHYFEM_OMPFLAG=-openmp

AddLibrary $NETCDF_SHYFEM_LIBCDIR lib
AddLibrary $NETCDF_SHYFEM_LIBFDIR lib

Expand Down

0 comments on commit c655031

Please sign in to comment.