19 |
|
|
20 |
# Version number to check for in options file. Increment when new features are |
# Version number to check for in options file. Increment when new features are |
21 |
# added or existing options changed. |
# added or existing options changed. |
22 |
REQUIRED_OPTS_VERSION=200 |
REQUIRED_OPTS_VERSION=201 |
23 |
|
|
24 |
# MS Windows support, many thanks to PH |
# MS Windows support, many thanks to PH |
25 |
IS_WINDOWS = (os.name == 'nt') |
IS_WINDOWS = (os.name == 'nt') |
47 |
############################### Build options ################################ |
############################### Build options ################################ |
48 |
|
|
49 |
default_prefix='/usr' |
default_prefix='/usr' |
50 |
mpi_flavours=('none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI') |
mpi_flavours=('no', 'none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI') |
51 |
lapack_flavours=('none', 'clapack', 'mkl') |
lapack_flavours=('none', 'clapack', 'mkl') |
52 |
|
|
53 |
vars = Variables(options_file, ARGUMENTS) |
vars = Variables(options_file, ARGUMENTS) |
73 |
# Mandatory libraries |
# Mandatory libraries |
74 |
('boost_prefix', 'Prefix/Paths of boost installation', default_prefix), |
('boost_prefix', 'Prefix/Paths of boost installation', default_prefix), |
75 |
('boost_libs', 'Boost libraries to link with', ['boost_python-mt']), |
('boost_libs', 'Boost libraries to link with', ['boost_python-mt']), |
76 |
|
# Mandatory for tests |
77 |
|
('cppunit_prefix', 'Prefix/Paths of CppUnit installation', default_prefix), |
78 |
|
('cppunit_libs', 'CppUnit libraries to link with', ['cppunit']), |
79 |
# Optional libraries and options |
# Optional libraries and options |
80 |
EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours), |
EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours), |
81 |
('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix), |
('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix), |
96 |
BoolVariable('umfpack', 'Enable UMFPACK', False), |
BoolVariable('umfpack', 'Enable UMFPACK', False), |
97 |
('umfpack_prefix', 'Prefix/Paths to UMFPACK installation', default_prefix), |
('umfpack_prefix', 'Prefix/Paths to UMFPACK installation', default_prefix), |
98 |
('umfpack_libs', 'UMFPACK libraries to link with', ['umfpack']), |
('umfpack_libs', 'UMFPACK libraries to link with', ['umfpack']), |
99 |
|
BoolVariable('boomeramg', 'Enable BoomerAMG', False), |
100 |
|
('boomeramg_prefix', 'Prefix/Paths to BoomerAMG installation', default_prefix), |
101 |
|
('boomeramg_libs', 'BoomerAMG libraries to link with', ['boomeramg']), |
102 |
EnumVariable('lapack', 'Set LAPACK flavour', 'none', allowed_values=lapack_flavours), |
EnumVariable('lapack', 'Set LAPACK flavour', 'none', allowed_values=lapack_flavours), |
103 |
('lapack_prefix', 'Prefix/Paths to LAPACK installation', default_prefix), |
('lapack_prefix', 'Prefix/Paths to LAPACK installation', default_prefix), |
104 |
('lapack_libs', 'LAPACK libraries to link with', []), |
('lapack_libs', 'LAPACK libraries to link with', []), |
122 |
EnumVariable('forcecollres', 'For testing use only - set the default value for force resolving collective ops', 'leave_alone', allowed_values=('leave_alone', 'on', 'off')), |
EnumVariable('forcecollres', 'For testing use only - set the default value for force resolving collective ops', 'leave_alone', allowed_values=('leave_alone', 'on', 'off')), |
123 |
# finer control over library building, intel aggressive global optimisation |
# finer control over library building, intel aggressive global optimisation |
124 |
# works with dynamic libraries on windows. |
# works with dynamic libraries on windows. |
125 |
('share_esysutils', 'Build a dynamic esysUtils library', False), |
('build_shared', 'Build dynamic libraries only', False), |
|
('share_paso', 'Build a dynamic paso library', False), |
|
126 |
('sys_libs', 'Extra libraries to link with', []), |
('sys_libs', 'Extra libraries to link with', []), |
127 |
('escript_opts_version', 'Version of options file (do not specify on command line)'), |
('escript_opts_version', 'Version of options file (do not specify on command line)'), |
128 |
|
('SVN_VERSION', 'Do not use from options file', -2), |
129 |
) |
) |
130 |
|
|
131 |
##################### Create environment and help text ####################### |
##################### Create environment and help text ####################### |
284 |
# add system libraries |
# add system libraries |
285 |
env.AppendUnique(LIBS = env['sys_libs']) |
env.AppendUnique(LIBS = env['sys_libs']) |
286 |
|
|
287 |
# Get the global Subversion revision number for the getVersion() method |
|
288 |
try: |
global_revision=ARGUMENTS.get('SVN_VERSION', None) |
289 |
|
if global_revision: |
290 |
|
global_revision = re.sub(':.*', '', global_revision) |
291 |
|
global_revision = re.sub('[^0-9]', '', global_revision) |
292 |
|
if global_revision == '': global_revision='-2' |
293 |
|
else: |
294 |
|
# Get the global Subversion revision number for the getVersion() method |
295 |
|
try: |
296 |
global_revision = os.popen('svnversion -n .').read() |
global_revision = os.popen('svnversion -n .').read() |
297 |
global_revision = re.sub(':.*', '', global_revision) |
global_revision = re.sub(':.*', '', global_revision) |
298 |
global_revision = re.sub('[^0-9]', '', global_revision) |
global_revision = re.sub('[^0-9]', '', global_revision) |
299 |
if global_revision == '': global_revision='-2' |
if global_revision == '': global_revision='-2' |
300 |
except: |
except: |
301 |
global_revision = '-1' |
global_revision = '-1' |
302 |
env['svn_revision']=global_revision |
env['svn_revision']=global_revision |
303 |
env.Append(CPPDEFINES=['SVN_VERSION='+global_revision]) |
env.Append(CPPDEFINES=['SVN_VERSION='+global_revision]) |
304 |
|
|
305 |
if IS_WINDOWS: |
if IS_WINDOWS: |
306 |
if not env['share_esysutils']: |
if not env['build_shared']: |
307 |
env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB']) |
env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB']) |
|
if not env['share_paso']: |
|
308 |
env.Append(CPPDEFINES = ['PASO_STATIC_LIB']) |
env.Append(CPPDEFINES = ['PASO_STATIC_LIB']) |
309 |
|
|
310 |
###################### Copy required environment vars ######################## |
###################### Copy required environment vars ######################## |
421 |
print("Cannot find python library method Py_Main (tried %s in directory %s)" % (python_libs, python_lib_path)) |
print("Cannot find python library method Py_Main (tried %s in directory %s)" % (python_libs, python_lib_path)) |
422 |
Exit(1) |
Exit(1) |
423 |
|
|
424 |
|
# reuse conf to check for numpy header (optional) |
425 |
|
if conf.CheckCXXHeader(['Python.h','numpy/ndarrayobject.h']): |
426 |
|
conf.env.Append(CPPDEFINES = ['HAVE_NUMPY_H']) |
427 |
|
conf.env['numpy_h']=True |
428 |
|
else: |
429 |
|
conf.env['numpy_h']=False |
430 |
|
|
431 |
# Commit changes to environment |
# Commit changes to environment |
432 |
env = conf.Finish() |
env = conf.Finish() |
433 |
|
|
456 |
print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY) |
print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY) |
457 |
Exit(1) |
Exit(1) |
458 |
|
|
459 |
|
######## CppUnit (required for tests) |
460 |
|
|
461 |
|
try: |
462 |
|
cppunit_inc_path,cppunit_lib_path=findLibWithHeader(env, env['cppunit_libs'], 'cppunit/TestFixture.h', env['cppunit_prefix'], lang='c++') |
463 |
|
env.AppendUnique(CPPPATH = [cppunit_inc_path]) |
464 |
|
env.AppendUnique(LIBPATH = [cppunit_lib_path]) |
465 |
|
env.PrependENVPath(LD_LIBRARY_PATH_KEY, cppunit_lib_path) |
466 |
|
env['cppunit']=True |
467 |
|
except: |
468 |
|
env['cppunit']=False |
469 |
|
|
470 |
######## VTK (optional) |
######## VTK (optional) |
471 |
|
|
472 |
if env['pyvisi']: |
if env['pyvisi']: |
572 |
|
|
573 |
######## MPI (optional) |
######## MPI (optional) |
574 |
|
|
575 |
|
if env['mpi']=='no': |
576 |
|
env['mpi']='none' |
577 |
|
|
578 |
env['usempi'] = env['mpi']!='none' |
env['usempi'] = env['mpi']!='none' |
579 |
mpi_inc_path='' |
mpi_inc_path='' |
580 |
mpi_lib_path='' |
mpi_lib_path='' |
591 |
if env['netcdf'] and env['mpi'] in ['MPT','OPENMPI']: |
if env['netcdf'] and env['mpi'] in ['MPT','OPENMPI']: |
592 |
env.Append(CPPDEFINES = ['MPI_INCLUDED']) |
env.Append(CPPDEFINES = ['MPI_INCLUDED']) |
593 |
|
|
594 |
|
######## BOOMERAMG (optional) |
595 |
|
|
596 |
|
if env['mpi'] == 'none': env['boomeramg'] = False |
597 |
|
|
598 |
|
boomeramg_inc_path='' |
599 |
|
boomeramg_lib_path='' |
600 |
|
if env['boomeramg']: |
601 |
|
boomeramg_inc_path,boomeramg_lib_path=findLibWithHeader(env, env['boomeramg_libs'], 'HYPRE.h', env['boomeramg_prefix'], lang='c') |
602 |
|
env.AppendUnique(CPPPATH = [boomeramg_inc_path]) |
603 |
|
env.AppendUnique(LIBPATH = [boomeramg_lib_path]) |
604 |
|
env.AppendUnique(LIBS = env['boomeramg_libs']) |
605 |
|
env.PrependENVPath(LD_LIBRARY_PATH_KEY, boomeramg_lib_path) |
606 |
|
env.Append(CPPDEFINES = ['BOOMERAMG']) |
607 |
|
|
608 |
######## ParMETIS (optional) |
######## ParMETIS (optional) |
609 |
|
|
610 |
if not env['usempi']: env['parmetis'] = False |
if not env['usempi']: env['parmetis'] = False |
623 |
|
|
624 |
try: |
try: |
625 |
import subprocess |
import subprocess |
626 |
p=subprocess.Popen(['gmsh', '-version'], stderr=subprocess.PIPE) |
p=subprocess.Popen(['gmsh', '-info'], stderr=subprocess.PIPE) |
627 |
p.poll() |
_,e=p.communicate() |
628 |
env['gmsh']=True |
if e.split().count("MPI"): |
629 |
|
env['gmsh']='m' |
630 |
|
else: |
631 |
|
env['gmsh']='s' |
632 |
except OSError: |
except OSError: |
633 |
env['gmsh']=False |
env['gmsh']=False |
634 |
|
|
635 |
|
######## PDFLaTeX (for documentation) |
636 |
|
if 'PDF' in dir(env) and '.tex' in env.PDF.builder.src_suffixes(env): |
637 |
|
env['pdflatex']=True |
638 |
|
else: |
639 |
|
env['pdflatex']=False |
640 |
|
|
641 |
######################## Summarize our environment ########################### |
######################## Summarize our environment ########################### |
642 |
|
|
643 |
# keep some of our install paths first in the list for the unit tests |
# keep some of our install paths first in the list for the unit tests |
676 |
print(" LAPACK: DISABLED") |
print(" LAPACK: DISABLED") |
677 |
d_list=[] |
d_list=[] |
678 |
e_list=[] |
e_list=[] |
679 |
for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','silo','visit': |
for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit','vsl_random': |
680 |
if env[i]: e_list.append(i) |
if env[i]: e_list.append(i) |
681 |
else: d_list.append(i) |
else: d_list.append(i) |
682 |
for i in e_list: |
for i in e_list: |
683 |
print("%16s: YES"%i) |
print("%16s: YES"%i) |
684 |
for i in d_list: |
for i in d_list: |
685 |
print("%16s: DISABLED"%i) |
print("%16s: DISABLED"%i) |
686 |
if env['gmsh']: |
if env['cppunit']: |
687 |
|
print(" CppUnit: FOUND") |
688 |
|
else: |
689 |
|
print(" CppUnit: NOT FOUND") |
690 |
|
if env['gmsh']=='m': |
691 |
|
print(" gmsh: FOUND, MPI-ENABLED") |
692 |
|
elif env['gmsh']=='s': |
693 |
print(" gmsh: FOUND") |
print(" gmsh: FOUND") |
694 |
else: |
else: |
695 |
print(" gmsh: NOT FOUND") |
print(" gmsh: NOT FOUND") |
696 |
print(" vsl_random: %s"%env['vsl_random']) |
if env['numpy_h']: |
697 |
|
print(" numpy headers: FOUND") |
698 |
|
else: |
699 |
|
print(" numpy headers: NOT FOUND") |
700 |
|
|
701 |
if ((fatalwarning != '') and (env['werror'])): |
if ((fatalwarning != '') and (env['werror'])): |
702 |
print(" Treating warnings as errors") |
print(" Treating warnings as errors") |
726 |
] |
] |
727 |
) |
) |
728 |
|
|
|
env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='$BUILD_DIR/$PLATFORM/tools/CppUnitTest', duplicate=0) |
|
729 |
env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0) |
env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0) |
730 |
env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0) |
env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0) |
731 |
env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0) |
env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0) |
732 |
env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0) |
env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0) |
733 |
env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0) |
env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0) |
734 |
|
env.SConscript(dirs = ['pasowrap/src'], variant_dir='$BUILD_DIR/$PLATFORM/pasowrap', duplicate=0) |
735 |
env.SConscript(dirs = ['dudley/src'], variant_dir='$BUILD_DIR/$PLATFORM/dudley', duplicate=0) |
env.SConscript(dirs = ['dudley/src'], variant_dir='$BUILD_DIR/$PLATFORM/dudley', duplicate=0) |
736 |
env.SConscript(dirs = ['finley/src'], variant_dir='$BUILD_DIR/$PLATFORM/finley', duplicate=0) |
env.SConscript(dirs = ['finley/src'], variant_dir='$BUILD_DIR/$PLATFORM/finley', duplicate=0) |
737 |
env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0) |
env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0) |
777 |
buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path) |
buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path) |
778 |
buildvars.write("lapack=%s\n"%env['lapack']) |
buildvars.write("lapack=%s\n"%env['lapack']) |
779 |
buildvars.write("pyvisi=%d\n"%env['pyvisi']) |
buildvars.write("pyvisi=%d\n"%env['pyvisi']) |
780 |
buildvars.write("vsl_random=%d"%int(env['vsl_random'])) |
buildvars.write("vsl_random=%d\n"%int(env['vsl_random'])) |
781 |
for i in 'netcdf','parmetis','papi','mkl','umfpack','silo','visit': |
for i in 'netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit': |
782 |
buildvars.write("%s=%d\n"%(i, int(env[i]))) |
buildvars.write("%s=%d\n"%(i, int(env[i]))) |
783 |
if env[i]: |
if env[i]: |
784 |
buildvars.write("%s_inc_path=%s\n"%(i, eval(i+'_inc_path'))) |
buildvars.write("%s_inc_path=%s\n"%(i, eval(i+'_inc_path'))) |
787 |
|
|
788 |
################### Targets to build and install libraries ################### |
################### Targets to build and install libraries ################### |
789 |
|
|
790 |
target_init = env.Command(env['pyinstall']+'/__init__.py', None, Touch('$TARGET')) |
target_init = env.Command(os.path.join(env['pyinstall'],'__init__.py'), None, Touch('$TARGET')) |
791 |
env.Alias('target_init', [target_init]) |
env.Alias('target_init', [target_init]) |
792 |
|
# delete buildvars upon cleanup |
793 |
|
env.Clean('target_init', os.path.join(env['libinstall'], 'buildvars')) |
794 |
|
|
795 |
# The headers have to be installed prior to build in order to satisfy |
# The headers have to be installed prior to build in order to satisfy |
796 |
# #include <paso/Common.h> |
# #include <paso/Common.h> |
803 |
env.Alias('build_escript', ['install_escript_headers', 'build_escript_lib', 'build_escriptcpp_lib']) |
env.Alias('build_escript', ['install_escript_headers', 'build_escript_lib', 'build_escriptcpp_lib']) |
804 |
env.Alias('install_escript', ['build_escript', 'install_escript_lib', 'install_escriptcpp_lib', 'install_escript_py']) |
env.Alias('install_escript', ['build_escript', 'install_escript_lib', 'install_escriptcpp_lib', 'install_escript_py']) |
805 |
|
|
806 |
|
env.Alias('build_pasowrap', ['install_pasowrap_headers', 'build_pasowrap_lib', 'build_pasowrapcpp_lib']) |
807 |
|
env.Alias('install_pasowrap', ['build_pasowrap', 'install_pasowrap_lib', 'install_pasowrapcpp_lib', 'install_pasowrap_py']) |
808 |
|
|
809 |
|
|
810 |
env.Alias('build_dudley', ['install_dudley_headers', 'build_dudley_lib', 'build_dudleycpp_lib']) |
env.Alias('build_dudley', ['install_dudley_headers', 'build_dudley_lib', 'build_dudleycpp_lib']) |
811 |
env.Alias('install_dudley', ['build_dudley', 'install_dudley_lib', 'install_dudleycpp_lib', 'install_dudley_py']) |
env.Alias('install_dudley', ['build_dudley', 'install_dudley_lib', 'install_dudleycpp_lib', 'install_dudley_py']) |
812 |
|
|
824 |
build_all_list += ['build_esysUtils'] |
build_all_list += ['build_esysUtils'] |
825 |
build_all_list += ['build_paso'] |
build_all_list += ['build_paso'] |
826 |
build_all_list += ['build_escript'] |
build_all_list += ['build_escript'] |
827 |
|
build_all_list += ['build_pasowrap'] |
828 |
build_all_list += ['build_dudley'] |
build_all_list += ['build_dudley'] |
829 |
build_all_list += ['build_finley'] |
build_all_list += ['build_finley'] |
830 |
build_all_list += ['build_weipa'] |
build_all_list += ['build_weipa'] |
838 |
install_all_list += ['install_esysUtils'] |
install_all_list += ['install_esysUtils'] |
839 |
install_all_list += ['install_paso'] |
install_all_list += ['install_paso'] |
840 |
install_all_list += ['install_escript'] |
install_all_list += ['install_escript'] |
841 |
|
install_all_list += ['install_pasowrap'] |
842 |
install_all_list += ['install_dudley'] |
install_all_list += ['install_dudley'] |
843 |
install_all_list += ['install_finley'] |
install_all_list += ['install_finley'] |
844 |
install_all_list += ['install_weipa'] |
install_all_list += ['install_weipa'] |
855 |
|
|
856 |
################## Targets to build and run the test suite ################### |
################## Targets to build and run the test suite ################### |
857 |
|
|
858 |
env.Alias('build_cppunittest', ['install_cppunittest_headers', 'build_cppunittest_lib']) |
test_msg = env.Command('.dummy.', None, '@echo "Cannot run C/C++ unit tests, CppUnit not found!";exit 1') |
859 |
env.Alias('install_cppunittest', ['build_cppunittest', 'install_cppunittest_lib']) |
if not env['cppunit']: |
860 |
env.Alias('run_tests', ['install_all', 'install_cppunittest_lib']) |
env.Alias('run_tests', test_msg) |
861 |
env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests']) |
env.Alias('run_tests', ['install_all']) |
862 |
|
env.Alias('all_tests', ['install_all', 'run_tests', 'py_tests']) |
863 |
env.Alias('build_full',['install_all','build_tests','build_py_tests']) |
env.Alias('build_full',['install_all','build_tests','build_py_tests']) |
864 |
env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests') |
env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests') |
865 |
|
|
882 |
print("Error attempting to write unittests file.") |
print("Error attempting to write unittests file.") |
883 |
Exit(1) |
Exit(1) |
884 |
|
|
885 |
|
# delete utest.sh upon cleanup |
886 |
|
env.Clean('target_init', 'utest.sh') |
887 |
|
|
888 |
# Make sure that the escript wrapper is in place |
# Make sure that the escript wrapper is in place |
889 |
if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')): |
if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')): |
890 |
print("Copying escript wrapper.") |
print("Copying escript wrapper.") |