Skip to content

Commit ad375a3

Browse files
committed
better control of Trilinos version
1 parent 0f39486 commit ad375a3

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

SConstruct

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ vars.AddVariables(
145145
('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix),
146146
('visit_libs', 'VisIt libraries to link with', ['simV2']),
147147
#ListVariable('domains', 'Which domains to build', 'all', all_domains),
148-
('domains', 'Which domains to build', all_domains),
148+
('domains', 'which domains to build', all_domains),
149149
BoolVariable('paso', 'Build Paso solver library', True),
150150
BoolVariable('weipa', 'Build Weipa data export library', True),
151151
('mathjax_path', 'Path to MathJax.js file', 'default'),
@@ -511,7 +511,7 @@ if not ( env['build_trilinos'] == "False" or env['build_trilinos'] == 'never' ):
511511

512512
print("Initialization of Trilinos build using", SHARGS )
513513
if env['trilinos_make_sh'] == 'default':
514-
if env['mpi'] not in [ 'none', 'no', True]:
514+
if env['mpi'] not in [ 'none', 'no', False]:
515515
#source=startdir + "/scripts/trilinos_mpi.sh"
516516
shutil.copy("scripts/trilinos_mpi.sh", env['trilinos_build'] + "/trilinos_mpi.sh ")
517517
print("Building (MPI) trilinos..............................")

site_scons/dependencies.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,26 @@ def checkForTrilinos(env):
443443
if env['trilinos'] == False:
444444
env['trilinos_version']='none'
445445
return env
446+
# Try to extract the trilinos version from Trilinos_version.h
447+
versionh = open(os.path.join(trilinos_inc_path, 'Trilinos_version.h'))
448+
env['trilinos_version'] = 'unknown'
449+
for line in versionh:
450+
ver = re.match(r'#define TRILINOS_MAJOR_MINOR_VERSION (\d+)', line)
451+
if ver:
452+
trilinos_version = ver.group(1)
453+
trilinos_version = int(trilinos_version)
454+
major = int(str(trilinos_version)[:2])
455+
minor = int(str(trilinos_version)[2:4])
456+
subminor = int(str(trilinos_version)[4:6])
457+
env['trilinos_version'] = str(major) + "." + str(minor) + "." + str(subminor)
458+
if major < 14:
459+
raise RuntimeError('Trilinos version greater than 14 expected.')
460+
# if major == 14 and minor <2 :
461+
# env.Append(CPPDEFINES = ['ESYS_TRILINOS_14'])
462+
# elif major == 14 and minor >=2:
463+
# env.Append(CPPDEFINES = ['ESYS_TRILINOS_14_2'])
464+
# else:
465+
env.Append(CPPDEFINES=[f'ESYS_TRILINOS_{major}'])
446466

447467
trilinos_inc_path=''
448468
trilinos_lib_path=''
@@ -452,10 +472,15 @@ def checkForTrilinos(env):
452472
'MatrixMarket_Tpetra.hpp', 'MueLu_CreateTpetraPreconditioner.hpp', \
453473
'Teuchos_DefaultComm.hpp', 'Teuchos_ParameterList.hpp', 'Tpetra_BlockCrsMatrix.hpp', \
454474
'Teuchos_Comm.hpp', 'Teuchos_TimeMonitor.hpp', 'Tpetra_CrsMatrix_decl.hpp', \
455-
'Tpetra_BlockCrsMatrix_decl.hpp', 'kokkos/Kokkos_Core.hpp', \
475+
'Tpetra_BlockCrsMatrix_decl.hpp', \
456476
'Tpetra_CrsGraph.hpp', 'Tpetra_CrsMatrix.hpp', 'Tpetra_RowMatrix.hpp', \
457477
'TpetraExt_TripleMatrixMultiply_def.hpp', 'Tpetra_BlockVector.hpp', \
458478
'Tpetra_Vector.hpp', 'Trilinos_version.h', 'Tpetra_BlockCrsMatrix_Helpers.hpp']
479+
480+
if major > 16 or ( major == 16 and minor > 0) :
481+
dependencies +=['kokkos/Kokkos_Core.hpp']
482+
else:
483+
dependencies +=['Kokkos_Core.hpp']
459484
packages = ['Tpetra', 'Kokkos', 'Belos', 'Amesos2', 'Ifpack2', 'MueLu']
460485

461486
# 'Tpetra_createDeepCopy_CrsMatrix.hpp', \
@@ -486,26 +511,7 @@ def checkForTrilinos(env):
486511
env.Append(CPPDEFINES = ['ESYS_HAVE_TPETRA_DP'])
487512
else:
488513
print("Checking for %s... %s" %('Tpetra_DefaultPlatform.hpp', "no"))
489-
# Try to extract the trilinos version from Trilinos_version.h
490-
versionh=open(os.path.join(trilinos_inc_path, 'Trilinos_version.h'))
491-
env['trilinos_version']='unknown'
492-
for line in versionh:
493-
ver=re.match(r'#define TRILINOS_MAJOR_MINOR_VERSION (\d+)',line)
494-
if ver:
495-
trilinos_version=ver.group(1)
496-
trilinos_version = int(trilinos_version)
497-
major=int(str(trilinos_version)[:2])
498-
minor=int(str(trilinos_version)[2:4])
499-
tmp=int(str(trilinos_version)[4:6])
500-
env['trilinos_version'] = str(major)+"."+str(minor)+"."+str(tmp)
501-
if major < 14 :
502-
raise RuntimeError('Trilinos version greater than 14 expected.')
503-
# if major == 14 and minor <2 :
504-
# env.Append(CPPDEFINES = ['ESYS_TRILINOS_14'])
505-
# elif major == 14 and minor >=2:
506-
# env.Append(CPPDEFINES = ['ESYS_TRILINOS_14_2'])
507-
# else:
508-
env.Append(CPPDEFINES = [f'ESYS_TRILINOS_{major}'])
514+
509515
# REVISE: remove 'ESYS_HAVE_TPETRA_EXPERIMENTAL_BLOCKCRS' 'ESYS_HAVE_TPETRA_EXPERIMENTAL_BLOCKCRSH' ESYS_HAVE_TPETRA_EXPERIMENTAL_BLOCKV
510516
if os.path.isfile(os.path.join(trilinos_inc_path,'Tpetra_BlockCrsMatrix.hpp')):
511517
print("Checking for %s... %s" % ('Tpetra_BlockCrsMatrix.hpp', "yes") )

0 commit comments

Comments
 (0)