[Scons-users] How to use scons build parallel program(MPI)?

Dirk Bächle tshortik at gmx.de
Sat Apr 11 04:18:48 EDT 2015


Hi there,

On 11.04.2015 09:17, 罗飞 wrote:
> I set ‘FORTRAN’ env variable instead of ‘F90’.
> --------------------------------------------------------------------------------
> import os
>   env=Environment(ENV={'PATH':os.environ['PATH']},FORTRAN='mpif90')
>   env.Program('helloscons.f90')
> =======================================================
> it is still wrong!
> ---------------------------------------------
>   scons: Reading SConscript files ...
> [...]
> ================================================
> How to make an experiment with 'LINK'?
> ===================================

it seems that you're a bit confused and overwhelmed by all the different options and possibilities...which is perfectly normal for a 
starter. I would like to suggest that you start to read a little bit more about Environments/Programs and so on, here a few references:

   SCons UserGuide (start with chapters 1-7):
     http://scons.org/doc/production/HTML/scons-user.html
   SCons CrashCourse:
     http://scons.org/wiki/SConsCrashCourse
   Fortran Tutorial (might be outdated):
     http://www.scons.org/wiki/llarsen/FortranTutorial

What you have to understand is, that all commands that SCons executes are defined by variables in your environment (not 100% true, 
but it simplifies the following explanation). There is, for example, a variable named "LINK" which defines the path to your linker 
program. Another variable named "LINKCOM" will look like
"$LINK $LINKFLAGS -o $TARGET $SOURCES", where the single expressions get expanded at runtime, based on how you define the included 
variables in your current environment. You can always redefine these on your own (the manuals listed above will show you how to do 
that), after the constructor of Environment() has set them to their defaults.
In the UserGuide you can find a list of pre-defined variables and their explanation...

Hope this helps you further.

Best regards,

Dirk



More information about the Scons-users mailing list