/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2324 by jfenwick, Thu Mar 19 04:35:30 2009 UTC revision 2416 by gross, Wed May 13 06:03:59 2009 UTC
# Line 33  IS_WINDOWS_PLATFORM = (os.name== "nt") Line 33  IS_WINDOWS_PLATFORM = (os.name== "nt")
33    
34  prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)  prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)
35    
36  # Read configuration options from file scons/<hostname>_options.py  #Determine where to read options from use:
37  hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])  #1. command line
38  tmp = os.path.join("scons",hostname+"_options.py")  #2. scons/<hostname>_options.py
39  options_file = ARGUMENTS.get('options_file', tmp)  #3. name as part of a cluster
40    options_file=ARGUMENTS.get('options_file', None)
41    if not options_file:
42      hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
43      options_file = os.path.join("scons",hostname+"_options.py")
44      #If there is no options file with that name see if there is a substitute
45      if not os.path.isfile(options_file):
46        tmp = scons_extensions.effectiveName(hostname)
47        options_file = os.path.join("scons",tmp+"_options.py")
48    
49  if not os.path.isfile(options_file):  if not os.path.isfile(options_file):
50      print "Options file not found (expected '%s')" % options_file
51    options_file = False    options_file = False
   print "Options file not found (expected '%s')" % tmp  
52  else:  else:
53    print "Options file is", options_file    print "Options file is", options_file
54    
# Line 98  opts.AddOptions( Line 107  opts.AddOptions(
107    ('mpi_run', 'mpirun name' , 'mpiexec -np 1'),    ('mpi_run', 'mpirun name' , 'mpiexec -np 1'),
108    ('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)', usr_lib),    ('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)', usr_lib),
109    ('mpi_libs', 'MPI libraries to link with (needs to be shared!)', ['mpich' , 'pthread', 'rt']),    ('mpi_libs', 'MPI libraries to link with (needs to be shared!)', ['mpich' , 'pthread', 'rt']),
110      ('mpi_flavour','Type of MPI execution environment','none'),
111  # ParMETIS  # ParMETIS
112    BoolOption('useparmetis', 'Compile parallel version using ParMETIS', 'yes'),    BoolOption('useparmetis', 'Compile parallel version using ParMETIS', 'yes'),
113    ('parmetis_path', 'Path to ParMETIS includes', '/usr/include'),    ('parmetis_path', 'Path to ParMETIS includes', '/usr/include'),
# Line 242  if env['omp_optim'] == "" and env['omp_d Line 252  if env['omp_optim'] == "" and env['omp_d
252  try: env['ENV']['OMP_NUM_THREADS'] = os.environ['OMP_NUM_THREADS']  try: env['ENV']['OMP_NUM_THREADS'] = os.environ['OMP_NUM_THREADS']
253  except KeyError: env['ENV']['OMP_NUM_THREADS'] = 1  except KeyError: env['ENV']['OMP_NUM_THREADS'] = 1
254    
255    try: env['ENV']['ESCRIPT_NUM_THREADS'] = os.environ['ESCRIPT_NUM_THREADS']
256    except KeyError: pass
257    
258    try: env['ENV']['ESCRIPT_NUM_PROCS'] = os.environ['ESCRIPT_NUM_PROCS']
259    except KeyError: env['ENV']['ESCRIPT_NUM_PROCS']=1
260    
261    try: env['ENV']['ESCRIPT_NUM_NODES'] = os.environ['ESCRIPT_NUM_NODES']
262    except KeyError: env['ENV']['ESCRIPT_NUM_NODES']=1
263    
264    try: env['ENV']['ESCRIPT_HOSTFILE'] = os.environ['ESCRIPT_HOSTFILE']
265    except KeyError: pass
266    
267  try: env['ENV']['PATH'] = os.environ['PATH']  try: env['ENV']['PATH'] = os.environ['PATH']
268  except KeyError: pass  except KeyError: pass
269    
# Line 296  if env['usepedantic']: env.Append(CCFLAG Line 318  if env['usepedantic']: env.Append(CCFLAG
318    
319  # MS Windows  # MS Windows
320  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
321    env.PrependENVPath('PATH',    [env['boost_lib_path']])    env.AppendENVPath('PATH', [env['boost_lib_path']])
322    env.PrependENVPath('PATH',    [env['libinstall']])    env.AppendENVPath('PATH', [env['libinstall']])
323    if not env['share_esysUtils'] :    if not env['share_esysUtils'] :
324      env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])      env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])
325    if not env['share_paso'] :    if not env['share_paso'] :
326      env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])      env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])
327    
328    if env['usenetcdf']:    if env['usenetcdf']:
329      env.PrependENVPath('PATH',  [env['netCDF_lib_path']])      env.AppendENVPath('PATH',   [env['netCDF_lib_path']])
330    
331  env.Append(ARFLAGS = env['ar_flags'])  env.Append(ARFLAGS = env['ar_flags'])
332    
# Line 466  if env['usemkl']: Line 488  if env['usemkl']:
488    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])
489    
490  if env['usemkl'] and not conf.CheckCHeader('mkl_solver.h'): env['usemkl'] = 0  if env['usemkl'] and not conf.CheckCHeader('mkl_solver.h'): env['usemkl'] = 0
491  if env['usemkl'] and not conf.CheckFunc('pardiso_'): env['usemkl'] = 0  if env['usemkl'] and not conf.CheckFunc('pardiso'): env['usemkl'] = 0
492    
493  # Add MKL to environment env if it was found  # Add MKL to environment env if it was found
494  if env['usemkl']:  if env['usemkl']:
# Line 542  else: Line 564  else:
564  env.Append(CCFLAGS      = env['cc_flags'])  env.Append(CCFLAGS      = env['cc_flags'])
565  env.Append(LIBS         = [env['omp_libs']])  env.Append(LIBS         = [env['omp_libs']])
566    
   
567  ############ Add some custom builders ##########################  ############ Add some custom builders ##########################
568    
569  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
# Line 554  env.Append(BUILDERS = {'RunUnitTest' : r Line 575  env.Append(BUILDERS = {'RunUnitTest' : r
575  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
576  env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});  env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
577    
578    epstopdfbuilder = Builder(action = scons_extensions.eps2pdf, suffix=".pdf", src_suffix=".eps", single_source=True)
579    env.Append(BUILDERS = {'EpsToPDF' : epstopdfbuilder});
580    
581  ############ MPI (optional) ####################################  ############ MPI (optional) ####################################
582    if not env['usempi']: env['mpi_flavour']='none'
583    
584  # Create a modified environment for MPI programs (identical to env if usempi=no)  # Create a modified environment for MPI programs (identical to env if usempi=no)
585  env_mpi = clone_env(env)  env_mpi = clone_env(env)
# Line 563  env_mpi = clone_env(env) Line 588  env_mpi = clone_env(env)
588  conf = Configure(clone_env(env_mpi))  conf = Configure(clone_env(env_mpi))
589    
590  if env_mpi['usempi']:  if env_mpi['usempi']:
591      VALID_MPIs=[ "MPT", "MPICH", "MPICH2", "OPENMPI", "INTELMPI" ]
592      if not env_mpi['mpi_flavour'] in VALID_MPIs:
593          raise ValueError,"MPI is enabled but mpi_flavour = %s is not a valid key from %s."%( env_mpi['mpi_flavour'],VALID_MPIs)
594    conf.env.AppendUnique(CPPPATH = [env_mpi['mpi_path']])    conf.env.AppendUnique(CPPPATH = [env_mpi['mpi_path']])
595    conf.env.AppendUnique(LIBPATH = [env_mpi['mpi_lib_path']])    conf.env.AppendUnique(LIBPATH = [env_mpi['mpi_lib_path']])
596    conf.env.AppendUnique(LIBS    = [env_mpi['mpi_libs']])    conf.env.AppendUnique(LIBS    = [env_mpi['mpi_libs']])
# Line 583  else: Line 611  else:
611    
612  env['usempi'] = env_mpi['usempi']  env['usempi'] = env_mpi['usempi']
613    
614    
615  ############ ParMETIS (optional) ###############################  ############ ParMETIS (optional) ###############################
616    
617  # Start a new configure environment that reflects what we've already found  # Start a new configure environment that reflects what we've already found
# Line 638  if env['usesilo']: print " Using Silo" Line 667  if env['usesilo']: print " Using Silo"
667  else: print "   Not using Silo"  else: print "   Not using Silo"
668  if env['useopenmp']: print "    Using OpenMP"  if env['useopenmp']: print "    Using OpenMP"
669  else: print "   Not using OpenMP"  else: print "   Not using OpenMP"
670  if env['usempi']: print "   Using MPI"  if env['usempi']: print "   Using MPI (flavour = %s)"%env['mpi_flavour']
671  else: print "   Not using MPI"  else: print "   Not using MPI"
672  if env['useparmetis']: print "  Using ParMETIS"  if env['useparmetis']: print "  Using ParMETIS"
673  else: print "   Not using ParMETIS (requires MPI)"  else: print "   Not using ParMETIS (requires MPI)"
# Line 746  if env['useopenmp']: Line 775  if env['useopenmp']:
775  else:  else:
776      out+="n"      out+="n"
777  buildvars.write(out+"\n")  buildvars.write(out+"\n")
778    buildvars.write("mpi_flavour="+env['mpi_flavour']+'\n')
779    
780  buildvars.close()  buildvars.close()
781    
# Line 775  build_all_list += ['build_paso'] Line 805  build_all_list += ['build_paso']
805  build_all_list += ['build_escript']  build_all_list += ['build_escript']
806  build_all_list += ['build_finley']  build_all_list += ['build_finley']
807  if env['usempi']:       build_all_list += ['target_pythonMPI_exe']  if env['usempi']:       build_all_list += ['target_pythonMPI_exe']
808  if not IS_WINDOWS_PLATFORM: build_all_list += ['target_escript_wrapper']  #if not IS_WINDOWS_PLATFORM:    build_all_list += ['target_escript_wrapper']
809  if env['usesilo']:  build_all_list += ['target_escript2silo']  if env['usesilo']:  build_all_list += ['target_escript2silo']
810  env.Alias('build_all', build_all_list)  env.Alias('build_all', build_all_list)
811    
# Line 789  install_all_list += ['target_install_pyv Line 819  install_all_list += ['target_install_pyv
819  install_all_list += ['target_install_modellib_py']  install_all_list += ['target_install_modellib_py']
820  install_all_list += ['target_install_pycad_py']  install_all_list += ['target_install_pycad_py']
821  if env['usempi']:       install_all_list += ['target_install_pythonMPI_exe']  if env['usempi']:       install_all_list += ['target_install_pythonMPI_exe']
822  if not IS_WINDOWS_PLATFORM: install_all_list += ['target_install_escript_wrapper']  #if not IS_WINDOWS_PLATFORM:    install_all_list += ['target_install_escript_wrapper']
823  if env['usesilo']:  install_all_list += ['target_install_escript2silo']  if env['usesilo']:  install_all_list += ['target_install_escript2silo']
824  install_all_list += ['remember_options']  install_all_list += ['remember_options']
825  env.Alias('install_all', install_all_list)  env.Alias('install_all', install_all_list)
# Line 807  env.Alias('build_full',['install_all','b Line 837  env.Alias('build_full',['install_all','b
837    
838  ############ Targets to build the documentation ################  ############ Targets to build the documentation ################
839    
840  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html'])  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html','install_pdf'])
841    
842  if not IS_WINDOWS_PLATFORM:  if not IS_WINDOWS_PLATFORM:
843     try:     try:

Legend:
Removed from v.2324  
changed lines
  Added in v.2416

  ViewVC Help
Powered by ViewVC 1.1.26