Skip to content

Commit

Permalink
Merge pull request #23 from nwu63/updated-packages
Browse files Browse the repository at this point in the history
Updated packages
  • Loading branch information
eirikurj authored Feb 12, 2020
2 parents 04d0f2a + bc9d909 commit 8bb3ff2
Show file tree
Hide file tree
Showing 40 changed files with 530 additions and 827 deletions.
10 changes: 3 additions & 7 deletions config/defaults/config.LINUX_GFORTRAN.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ CC_REAL_PRECISION_FLAG =
# so it is included in ${PETSC_LIB}. Otherwise you will have to
# specify the HDF5 library.

# ----------- CGNS 3.2.x ------------------
CGNS_VERSION_FLAG=
# ----------- CGNS ------------------
# CGNS_VERSION_FLAG= # for CGNS 3.2.x
CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x
CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# # ----------- CGNS 3.3.x ------------------
# CGNS_VERSION_FLAG=-DUSECGNSMODULE
# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src
# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -fdefault-real-8 -fdefault-double-8 -g -O3 -march=native -ffast-math
C_FLAGS = -DHAS_ISNAN -O -fPIC -g
Expand Down
10 changes: 3 additions & 7 deletions config/defaults/config.LINUX_INTEL.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ CC_REAL_PRECISION_FLAG =
# so it is included in ${PETSC_LIB}. Otherwise you will have to
# specify the HDF5 library.

# ----------- CGNS 3.2.x ------------------
CGNS_VERSION_FLAG=
# ----------- CGNS ------------------
# CGNS_VERSION_FLAG= # for CGNS 3.2.x
CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x
CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# # ----------- CGNS 3.3.x ------------------
# CGNS_VERSION_FLAG=-DUSECGNSMODULE
# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src
# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -r8 -O2 -g
C_FLAGS = -DHAS_ISNAN -O -fPIC
Expand Down
10 changes: 3 additions & 7 deletions config/defaults/config.LINUX_INTEL_SAFE.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ CC_REAL_PRECISION_FLAG =
# so it is included in ${PETSC_LIB}. Otherwise you will have to
# specify the HDF5 library.

# ----------- CGNS 3.2.x ------------------
CGNS_VERSION_FLAG=
# ----------- CGNS ------------------
# CGNS_VERSION_FLAG= # for CGNS 3.2.x
CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x
CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# # ----------- CGNS 3.3.x ------------------
# CGNS_VERSION_FLAG=-DUSECGNSMODULE
# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src
# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -r8 -O1 -g
C_FLAGS = -DHAS_ISNAN -O -fPIC
Expand Down
10 changes: 3 additions & 7 deletions config/defaults/config.OSX_GFORTRAN.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ CC_REAL_PRECISION_FLAG =
# so it is included in ${PETSC_LIB}. Otherwise you will have to
# specify the HDF5 library.

# ----------- CGNS 3.2.x ------------------
CGNS_VERSION_FLAG=
# ----------- CGNS ------------------
# CGNS_VERSION_FLAG= # for CGNS 3.2.x
CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x
CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# # ----------- CGNS 3.3.x ------------------
# CGNS_VERSION_FLAG=-DUSECGNSMODULE
# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src
# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -fdefault-real-8 -fdefault-double-8 -g -O3 -march=native -ffast-math
C_FLAGS = -DHAS_ISNAN -O -fPIC -g
Expand Down
110 changes: 110 additions & 0 deletions python/reg_tests/mdo_regression_compare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
from __future__ import print_function
# This file contains two functions to help regression testing. The
# first is used to format float values with a specified absolute and
# relative tolerance. This information is used by the second function
# when it takes in two such formatted strings and decides if they are
# sufficiently close to be considered equal.
import os
import sys
REG_FILES_MATCH = 0
REG_FILES_DO_NOT_MATCH = 1
REG_ERROR = -1

def _reg_str_comp(str1, str2):
'''Compare the float values in str1 and str2 and determine if they
are equal. Returns True if they are the "same", False if different'''

aux1 = str1.split()
aux2 = str2.split()

if not aux1[0] == aux2[0] == '@value':
# This line does not need to be compared
return True

# Extract required tolerances and values
rel_tol = float(aux1[2])
abs_tol = float(aux1[3])
val1 = float(aux1[1])
val2 = float(aux2[1])

rel_err = 0
if val2 != 0:
rel_err = abs((val1-val2)/val2)
else:
rel_err = abs((val1-val2)/(val2 + 1e-16))

abs_err = abs(val1-val2)

if abs_err < abs_tol or rel_err < rel_tol:
return True
else:
return False


def reg_file_comp(ref_file, comp_file):
'''Compare the reference file 'ref_file' with 'comp_file'. The
order of these two files matter. The ref_file MUST be given
first. Only values specified by reg_write() are compared. All
other lines are ignored. Floating point values are compared based
on rel_tol and abs_tol'''

all_ref_lines = []
ref_values = []
comp_values = []
try:
f = open(ref_file, 'r')
except IOError:
print('File %s was not found. Cannot do comparison.'% ref_file)
return REG_ERROR
for line in f.readlines():
all_ref_lines.append(line)
if line[0:6] == '@value':
ref_values.append(line)

f.close()

try:
f = open(comp_file, 'r')
except IOError:
print('File %s was not found. Cannot do comparison.'% comp_file)
return REG_ERROR

for line in f.readlines():
if line[0:6] == '@value':
comp_values.append(line)

f.close()

# Copy the comp_file to compe_file.orig
os.system('cp %s %s.orig'% (comp_file, comp_file))

# We must check that we have the same number of @value's to compare:
if len(ref_values) != len(comp_values):
print('Error: number of @value lines in file not the same!')
return REG_FILES_DO_NOT_MATCH

# Open the (new) comp_file:
f = open(comp_file,'w')

# Loop over all the ref_lines, for value lines, do the
# comparison. If comparison is ok, write the ref line, otherwise
# write orig line.

j = 0
res = REG_FILES_MATCH
for i in range(len(all_ref_lines)):
line = all_ref_lines[i]
if line[0:6] == '@value':
if _reg_str_comp(line, comp_values[j]) is False:
f.write(comp_values[j])
res = REG_FILES_DO_NOT_MATCH
else:
f.write(line)

j += 1
else:
f.write(line)

f.close()

return res
Loading

0 comments on commit 8bb3ff2

Please sign in to comment.