/[escript]/branches/domexper/SConstruct
ViewVC logotype

Diff of /branches/domexper/SConstruct

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

revision 2334 by jfenwick, Thu Mar 26 03:05:33 2009 UTC revision 2388 by jfenwick, Wed Apr 15 06:21:25 2009 UTC
# Line 35  prefix = ARGUMENTS.get('prefix', Dir('#. Line 35  prefix = ARGUMENTS.get('prefix', Dir('#.
35    
36  # Read configuration options from file scons/<hostname>_options.py  # Read configuration options from file scons/<hostname>_options.py
37  hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])  hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
38  tmp = os.path.join("scons",hostname+"_options.py")  ehostname = scons_extensions.effectiveName(hostname)
39    tmp = os.path.join("scons",ehostname+"_options.py")
40  options_file = ARGUMENTS.get('options_file', tmp)  options_file = ARGUMENTS.get('options_file', tmp)
41  if not os.path.isfile(options_file):  if not os.path.isfile(options_file):
42    options_file = False    options_file = False
# Line 98  opts.AddOptions( Line 99  opts.AddOptions(
99    ('mpi_run', 'mpirun name' , 'mpiexec -np 1'),    ('mpi_run', 'mpirun name' , 'mpiexec -np 1'),
100    ('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),
101    ('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']),
102      ('mpi_flavour','Type of MPI execution environment','none'),
103  # ParMETIS  # ParMETIS
104    BoolOption('useparmetis', 'Compile parallel version using ParMETIS', 'yes'),    BoolOption('useparmetis', 'Compile parallel version using ParMETIS', 'yes'),
105    ('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 244  if env['omp_optim'] == "" and env['omp_d
244  try: env['ENV']['OMP_NUM_THREADS'] = os.environ['OMP_NUM_THREADS']  try: env['ENV']['OMP_NUM_THREADS'] = os.environ['OMP_NUM_THREADS']
245  except KeyError: env['ENV']['OMP_NUM_THREADS'] = 1  except KeyError: env['ENV']['OMP_NUM_THREADS'] = 1
246    
247    try: env['ENV']['ESCRIPT_NUM_THREADS'] = os.environ['ESCRIPT_NUM_THREADS']
248    except KeyError: pass
249    
250    try: env['ENV']['ESCRIPT_NUM_PROCS'] = os.environ['ESCRIPT_NUM_PROCS']
251    except KeyError: pass
252    
253    try: env['ENV']['ESCRIPT_NUM_NODES'] = os.environ['ESCRIPT_NUM_NODES']
254    except KeyError: pass
255    
256    try: env['ENV']['ESCRIPT_HOSTFILE'] = os.environ['ESCRIPT_HOSTFILE']
257    except KeyError: pass
258    
259  try: env['ENV']['PATH'] = os.environ['PATH']  try: env['ENV']['PATH'] = os.environ['PATH']
260  except KeyError: pass  except KeyError: pass
261    
# Line 408  if env['usevtk']: Line 422  if env['usevtk']:
422    
423  conf = Configure(clone_env(env))  conf = Configure(clone_env(env))
424    
 print "<1<<<<"+str(conf.env['ENV']['LD_LIBRARY_PATH'])  
   
   
425  if env['usenetcdf']:  if env['usenetcdf']:
426    conf.env.AppendUnique(CPPPATH = [env['netCDF_path']])    conf.env.AppendUnique(CPPPATH = [env['netCDF_path']])
427    conf.env.AppendUnique(LIBPATH = [env['netCDF_lib_path']])    conf.env.AppendUnique(LIBPATH = [env['netCDF_lib_path']])
# Line 423  if env['usenetcdf']: Line 434  if env['usenetcdf']:
434  if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0  if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0
435  if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0  if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0
436    
 print "<2<<<<"+str(conf.env['ENV']['LD_LIBRARY_PATH'])  
   
437  # Add NetCDF to environment env if it was found  # Add NetCDF to environment env if it was found
438  if env['usenetcdf']:  if env['usenetcdf']:
439    env = conf.Finish()    env = conf.Finish()
# Line 432  if env['usenetcdf']: Line 441  if env['usenetcdf']:
441  else:  else:
442    conf.Finish()    conf.Finish()
443    
 print "<A<<<<"+str(env['ENV']['LD_LIBRARY_PATH'])  
   
444  ############ PAPI (optional) ###################################  ############ PAPI (optional) ###################################
445    
446  # 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 473  if env['usemkl']: Line 480  if env['usemkl']:
480    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])
481    
482  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
483  if env['usemkl'] and not conf.CheckFunc('pardiso_'): env['usemkl'] = 0  if env['usemkl'] and not conf.CheckFunc('pardiso'): env['usemkl'] = 0
484    
485  # Add MKL to environment env if it was found  # Add MKL to environment env if it was found
486  if env['usemkl']:  if env['usemkl']:
# Line 549  else: Line 556  else:
556  env.Append(CCFLAGS      = env['cc_flags'])  env.Append(CCFLAGS      = env['cc_flags'])
557  env.Append(LIBS         = [env['omp_libs']])  env.Append(LIBS         = [env['omp_libs']])
558    
   
559  ############ Add some custom builders ##########################  ############ Add some custom builders ##########################
560    
561  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 561  env.Append(BUILDERS = {'RunUnitTest' : r Line 567  env.Append(BUILDERS = {'RunUnitTest' : r
567  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)
568  env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});  env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
569    
570    epstopdfbuilder = Builder(action = scons_extensions.eps2pdf, suffix=".pdf", src_suffix=".eps", single_source=True)
571    env.Append(BUILDERS = {'EpsToPDF' : epstopdfbuilder});
572    
573  ############ MPI (optional) ####################################  ############ MPI (optional) ####################################
574    if not env['usempi']: env['mpi_flavour']='none'
575    
576  # 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)
577  env_mpi = clone_env(env)  env_mpi = clone_env(env)
# Line 570  env_mpi = clone_env(env) Line 580  env_mpi = clone_env(env)
580  conf = Configure(clone_env(env_mpi))  conf = Configure(clone_env(env_mpi))
581    
582  if env_mpi['usempi']:  if env_mpi['usempi']:
583      VALID_MPIs=[ "MPT", "MPICH", "MPICH2", "OPENMPI", "INTELMPI" ]
584      if not env_mpi['mpi_flavour'] in VALID_MPIs:
585          raise ValueError,"MPI is enabled but mpi_flavour = %s is not a valid key from %s."%( env_mpi['mpi_flavour'],VALID_MPIs)
586    conf.env.AppendUnique(CPPPATH = [env_mpi['mpi_path']])    conf.env.AppendUnique(CPPPATH = [env_mpi['mpi_path']])
587    conf.env.AppendUnique(LIBPATH = [env_mpi['mpi_lib_path']])    conf.env.AppendUnique(LIBPATH = [env_mpi['mpi_lib_path']])
588    conf.env.AppendUnique(LIBS    = [env_mpi['mpi_libs']])    conf.env.AppendUnique(LIBS    = [env_mpi['mpi_libs']])
# Line 590  else: Line 603  else:
603    
604  env['usempi'] = env_mpi['usempi']  env['usempi'] = env_mpi['usempi']
605    
606    
607  ############ ParMETIS (optional) ###############################  ############ ParMETIS (optional) ###############################
608    
609  # 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 645  if env['usesilo']: print " Using Silo" Line 659  if env['usesilo']: print " Using Silo"
659  else: print "   Not using Silo"  else: print "   Not using Silo"
660  if env['useopenmp']: print "    Using OpenMP"  if env['useopenmp']: print "    Using OpenMP"
661  else: print "   Not using OpenMP"  else: print "   Not using OpenMP"
662  if env['usempi']: print "   Using MPI"  if env['usempi']: print "   Using MPI (flavour = %s)"%env['mpi_flavour']
663  else: print "   Not using MPI"  else: print "   Not using MPI"
664  if env['useparmetis']: print "  Using ParMETIS"  if env['useparmetis']: print "  Using ParMETIS"
665  else: print "   Not using ParMETIS (requires MPI)"  else: print "   Not using ParMETIS (requires MPI)"
# Line 753  if env['useopenmp']: Line 767  if env['useopenmp']:
767  else:  else:
768      out+="n"      out+="n"
769  buildvars.write(out+"\n")  buildvars.write(out+"\n")
770    buildvars.write("mpi_flavour="+env['mpi_flavour']+'\n')
771    
772  buildvars.close()  buildvars.close()
773    

Legend:
Removed from v.2334  
changed lines
  Added in v.2388

  ViewVC Help
Powered by ViewVC 1.1.26