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

Diff of /branches/py3_attempt2/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 2391 by jfenwick, Thu Apr 16 01:08:57 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: pass
260    
261    try: env['ENV']['ESCRIPT_NUM_NODES'] = os.environ['ESCRIPT_NUM_NODES']
262    except KeyError: pass
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 408  if env['usevtk']: Line 430  if env['usevtk']:
430    
431  conf = Configure(clone_env(env))  conf = Configure(clone_env(env))
432    
 print "<1<<<<"+str(conf.env['ENV']['LD_LIBRARY_PATH'])  
   
   
433  if env['usenetcdf']:  if env['usenetcdf']:
434    conf.env.AppendUnique(CPPPATH = [env['netCDF_path']])    conf.env.AppendUnique(CPPPATH = [env['netCDF_path']])
435    conf.env.AppendUnique(LIBPATH = [env['netCDF_lib_path']])    conf.env.AppendUnique(LIBPATH = [env['netCDF_lib_path']])
# Line 423  if env['usenetcdf']: Line 442  if env['usenetcdf']:
442  if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0  if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0
443  if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0  if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0
444    
 print "<2<<<<"+str(conf.env['ENV']['LD_LIBRARY_PATH'])  
   
445  # Add NetCDF to environment env if it was found  # Add NetCDF to environment env if it was found
446  if env['usenetcdf']:  if env['usenetcdf']:
447    env = conf.Finish()    env = conf.Finish()
# Line 432  if env['usenetcdf']: Line 449  if env['usenetcdf']:
449  else:  else:
450    conf.Finish()    conf.Finish()
451    
 print "<A<<<<"+str(env['ENV']['LD_LIBRARY_PATH'])  
   
452  ############ PAPI (optional) ###################################  ############ PAPI (optional) ###################################
453    
454  # 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 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 549  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 561  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 570  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 590  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 645  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 753  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    

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

  ViewVC Help
Powered by ViewVC 1.1.26