Changeset 4856

Show
Ignore:
Timestamp:
06/29/09 14:55:15 (5 months ago)
Author:
balaji
Message:

Added a new set of environment variables (MPICH2_MPICC_FLAGS, etc.),
that will be appended to mpicc and friends, but do not affect MPICH2's
compilation itself. The README has also be updated appropriately to
explain all the available flags correctly.

Location:
mpich2/trunk
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • mpich2/trunk/README.vin

    r4669 r4856  
    381381=================== 
    382382 
    383 MPICH2 can be configured with two sets of compiler flags: CFLAGS, 
    384 CXXFLAGS, FFLAGS, F90FLAGS (abbreviated as xFLAGS) and 
    385 MPICH2LIB_CFLAGS, MPICH2LIB_CXXFLAGS, MPICH2LIB_FFLAGS, 
    386 MPICH2LIB_F90FLAGS (abbreviated as MPICH2LIB_xFLAGS) for compilation; 
    387 LDFLAGS and MPICH2LIB_LDFLAGS for linking. All these flags can be set 
    388 as part of configure command or through environment variables. 
    389 (CPPFLAGS stands for C preprocessor flags, which should NOT be set) 
    390  
    391 Both xFLAGS and MPICH2LIB_xFLAGS affect the compilation of the MPICH2 
    392 libraries. However, only xFLAGS are appended to MPI wrapper scripts, 
    393 mpicc and friends. 
    394  
    395 MPICH2 libraries are built with default compiler optimization, -O2, 
    396 which can be modified by --enable-fast configure option.  For 
    397 instance, --disable-fast disables the default optimization option. 
    398 --enable-fast=O<n> sets default compiler optimization as -O<n>.  For 
    399 more details of --enable-fast, see the output of "configure --help". 
    400 Any other complicated optimization flags for MPICH2 libraries have to 
    401 be set throught MPICH2LIB_xFLAGS.  CFLAGS and friends are empty by 
    402 default. 
    403  
    404 For example, to build a "production" MPICH2 environment with -O3 for all 
    405 language bindings, one can simply do 
     383MPICH2 allows several sets of compiler flags to be used. The first 
     384three sets are configure-time options for MPICH2, while the fourth is 
     385only relevant when compiling applications with mpicc and friends. 
     386 
     3871. CFLAGS, CXXFLAGS, FFLAGS, F90FLAGS and LDFLAGS (abbreviated as 
     388xFLAGS): Setting these flags would result in the MPICH2 library being 
     389compiled/linked with these flags and the flags internally being used 
     390in mpicc and friends. 
     391 
     3922. MPICH2LIB_CFLAGS, MPICH2LIB_CXXFLAGS, MPICH2LIB_FFLAGS, 
     393MPICH2LIB_F90FLAGS and MPICH2LIB_LDFLAGS (abbreviated as 
     394MPICH2LIB_xFLAGS): Setting these flags would result in the MPICH2 
     395library being compiled/linked with these flags. However, these flags 
     396will *not* be used by mpicc and friends. 
     397 
     3983. MPICH2_MAKE_CFLAGS: Setting these flags would result in MPICH2's 
     399configure tests to not use these flags, but the makefile's to use 
     400them. This is a temporary hack for certain cases that advanced 
     401developers might be interested in which break existing configure tests 
     402(e.g., -Werror) and are not recommended for regular users. 
     403 
     4044. MPICH2_MPICC_FLAGS, MPICH2_MPICXX_FLAGS, MPICH2_MPIF77_FLAGS, 
     405MPICH2_MPIF90_FLAGS and MPICH2_LDFLAGS (abbreviated as 
     406MPICH2_MPIX_FLAGS): These flags do *not* affect the compilation of the 
     407MPICH2 library itself, but will be internally used by mpicc and 
     408friends. 
     409 
     410 
     411  +--------------------------------------------------------------------+ 
     412  |                    |                      |                        | 
     413  |                    |    MPICH2 library    |    mpicc and friends   | 
     414  |                    |                      |                        | 
     415  +--------------------+----------------------+------------------------+ 
     416  |                    |                      |                        | 
     417  |     xFLAGS         |         Yes          |           Yes          | 
     418  |                    |                      |                        | 
     419  +--------------------+----------------------+------------------------+ 
     420  |                    |                      |                        | 
     421  |  MPICH2LIB_xFLAGS  |         Yes          |           No           | 
     422  |                    |                      |                        | 
     423  +--------------------+----------------------+------------------------+ 
     424  |                    |                      |                        | 
     425  | MPICH2_MAKE_xFLAGS |         Yes          |           No           | 
     426  |                    |                      |                        | 
     427  +--------------------+----------------------+------------------------+ 
     428  |                    |                      |                        | 
     429  | MPICH2_MPIX_FLAGS  |         No           |           Yes          | 
     430  |                    |                      |                        | 
     431  +--------------------+----------------------+------------------------+ 
     432 
     433 
     434All these flags can be set as part of configure command or through 
     435environment variables. (CPPFLAGS stands for C preprocessor flags, 
     436which should NOT be set) 
     437 
     438 
     439Default flags 
     440-------------- 
     441By default, MPICH2 automatically adds certain compiler optimizations 
     442to MPICH2LIB_CFLAGS. The currently used optimization level is -O2. 
     443 
     444** IMPORTANT NOTE: Remember that this only affects the compilation of 
     445the MPICH2 library and is not used in the wrappers (mpicc and friends) 
     446that are used to compile your applications or other libraries. 
     447 
     448This optimization level can be changed with the --enable-fast option 
     449passed to configure. For example, to build an MPICH2 environment with 
     450-O3 for all language bindings, one can simply do: 
    406451 
    407452  ./configure --enable-fast=O3 
    408453 
    409 or 
     454Or to disable all compiler optimizations, one can do: 
     455 
     456  ./configure --disable-fast 
     457 
     458For more details of --enable-fast, see the output of "configure 
     459--help". 
     460 
     461 
     462Examples 
     463-------- 
     464 
     465Example 1: 
    410466 
    411467  ./configure --disable-fast MPICH2LIB_CFLAGS=-O3 MPICH2LIB_FFLAGS=-O3 MPICH2LIB_CXXFLAGS=-O3 MPICH2LIB_F90FLAGS=-O3 
    412468 
    413 This will cause the MPICH2 libraries to be built with -O3, and -O3 will 
    414 not be included in the mpicc and other MPI wrapper script. 
     469This will cause the MPICH2 libraries to be built with -O3, and -O3 
     470will *not* be included in the mpicc and other MPI wrapper script. 
     471 
     472Example 2: 
     473 
     474  ./configure --disable-fast CFLAGS=-O3 FFLAGS=-O3 CXXFLAGS=-O3 F90FLAGS=-O3 
     475 
     476This will cause the MPICH2 libraries to be built with -O3, and -O3 
     477will be included in the mpicc and other MPI wrapper script. 
     478 
     479Example 3: 
    415480 
    416481There are certain compiler flags that should not be used with MPICH2's 
     
    421486MPICH2_MAKE_CFLAGS as follows: 
    422487 
    423   make VERBOSE=1 MPICH2_MAKE_CFLAGS="-Wall -Werror" 
    424  
    425 (assuming CC is set to gcc). The content of MPICH2_MAKE_CFLAGS is 
    426 appended to the CFLAGS in almost all Makefiles. 
     488  make MPICH2_MAKE_CFLAGS="-Wall -Werror" 
     489 
     490The content of MPICH2_MAKE_CFLAGS is appended to the CFLAGS in all 
     491relevant Makefiles. 
    427492 
    428493------------------------------------------------------------------------- 
  • mpich2/trunk/src/env/mpicc.bash.in

    r4441 r4856  
    246246        mpilibs="$C_LINKPATH_SHL$libdir $mpilibs" 
    247247    fi 
    248     $Show $CC $CFLAGS $LDFLAGS "${allargs[@]}" -I$includedir -L$libdir -L$opalibdir $mpilibs $MPI_OTHERLIBS 
     248    $Show $CC $MPICH2_MPICC_FLAGS $CFLAGS $LDFLAGS "${allargs[@]}" -I$includedir -L$libdir -L$opalibdir $MPICH2_LDFLAGS $mpilibs $MPI_OTHERLIBS 
    249249    rc=$? 
    250250else 
    251     $Show $CC $CFLAGS "${allargs[@]}" -I$includedir 
     251    $Show $CC $MPICH2_MPICC_FLAGS $CFLAGS "${allargs[@]}" -I$includedir 
    252252    rc=$? 
    253253fi 
  • mpich2/trunk/src/env/mpicc.in

    r4441 r4856  
    255255        mpilibs="$C_LINKPATH_SHL$libdir $mpilibs" 
    256256    fi 
    257     $Show $CC $CFLAGS $LDFLAGS $allargs -I$includedir -L$libdir -L$opalibdir $mpilibs $MPI_OTHERLIBS 
     257    $Show $CC $MPICH2_MPICC_FLAGS $CFLAGS $LDFLAGS $allargs -I$includedir -L$libdir -L$opalibdir $MPICH2_LDFLAGS $mpilibs $MPI_OTHERLIBS 
    258258    rc=$? 
    259259else 
    260     $Show $CC $CFLAGS $allargs -I$includedir 
     260    $Show $CC $MPICH2_MPICC_FLAGS $CFLAGS $allargs -I$includedir 
    261261    rc=$? 
    262262fi 
  • mpich2/trunk/src/env/mpicxx.bash.in

    r4441 r4856  
    246246        shllibpath="$CXX_LINKPATH_SHL$libdir" 
    247247    fi 
    248     $Show $CXX $CXXFLAGS $LDFLAGS "${allargs[@]}" -I$includedir -L$libdir -L$opalibdir $shllibpath $cxxlibs $mpilibs $MPI_OTHERLIBS 
     248    $Show $CXX $MPICH2_MPICXX_FLAGS $CXXFLAGS $LDFLAGS "${allargs[@]}" -I$includedir -L$libdir -L$opalibdir $shllibpath $MPICH2_LDFLAGS $cxxlibs $mpilibs $MPI_OTHERLIBS 
    249249    rc=$? 
    250250else 
    251     $Show $CXX $CXXFLAGS "${allargs[@]}" -I$includedir 
     251    $Show $CXX $MPICH2_MPICXX_FLAGS $CXXFLAGS "${allargs[@]}" -I$includedir 
    252252    rc=$? 
    253253fi 
  • mpich2/trunk/src/env/mpicxx.in

    r4441 r4856  
    255255        shllibpath="$CXX_LINKPATH_SHL$libdir" 
    256256    fi 
    257     $Show $CXX $CXXFLAGS $LDFLAGS $allargs -I$includedir -L$libdir -L$opalibdir $shllibpath $cxxlibs $mpilibs $MPI_OTHERLIBS 
     257    $Show $CXX $MPICH2_MPICXX_FLAGS $CXXFLAGS $LDFLAGS $allargs -I$includedir -L$libdir -L$opalibdir $shllibpath $MPICH2_LDFLAGS $cxxlibs $mpilibs $MPI_OTHERLIBS 
    258258    rc=$? 
    259259else 
    260     $Show $CXX $CXXFLAGS $allargs -I$includedir 
     260    $Show $CXX $MPICH2_MPICXX_FLAGS $CXXFLAGS $allargs -I$includedir 
    261261    rc=$? 
    262262fi 
  • mpich2/trunk/src/env/mpif77.bash.in

    r4441 r4856  
    294294        mpilibs="$FC_LINKPATH_SHL$libdir $mpilibs" 
    295295    fi 
    296     $Show $FC $FFLAGS $LDFLAGS "${allargs[@]}" -I$includedir -L$libdir -L$opalibdir $mpilibs $MPI_OTHERLIBS 
     296    $Show $FC $MPICH2_MPIF77_FLAGS $FFLAGS $LDFLAGS "${allargs[@]}" -I$includedir -L$libdir -L$opalibdir $MPICH2_LDFLAGS $mpilibs $MPI_OTHERLIBS 
    297297    rc=$? 
    298298else 
    299     $Show $FC $FFLAGS "${allargs[@]}" -I$includedir 
     299    $Show $FC $MPICH2_MPIF77_FLAGS $FFLAGS "${allargs[@]}" -I$includedir 
    300300    rc=$? 
    301301fi 
  • mpich2/trunk/src/env/mpif77.in

    r4441 r4856  
    316316        mpilibs="$FC_LINKPATH_SHL$libdir $mpilibs" 
    317317    fi 
    318     $Show $FC $FFLAGS $LDFLAGS $allargs -I$includedir -L$libdir -L$opalibdir $mpilibs $MPI_OTHERLIBS 
     318    $Show $FC $MPICH2_MPIF77_FLAGS $FFLAGS $LDFLAGS $allargs -I$includedir -L$libdir -L$opalibdir $MPICH2_LDFLAGS $mpilibs $MPI_OTHERLIBS 
    319319    rc=$? 
    320320else 
    321     $Show $FC $FFLAGS $allargs -I$includedir 
     321    $Show $FC $MPICH2_MPIF77_FLAGS $FFLAGS $allargs -I$includedir 
    322322    rc=$? 
    323323fi 
  • mpich2/trunk/src/env/mpif90.bash.in

    r4441 r4856  
    341341        mpilibs="$F90_LINKPATH_SHL$libdir $mpilibs" 
    342342    fi 
    343     $Show $F90 $F90FLAGS $LDFLAGS "${allargs[@]}" $F90INCDIRS $F90MODDIRS -L$libdir -L$opalibdir $F90MODLIBS $mpilibs $MPI_OTHERLIBS 
     343    $Show $F90 $MPICH2_MPIF90_FLAGS $F90FLAGS $LDFLAGS "${allargs[@]}" $F90INCDIRS $F90MODDIRS -L$libdir -L$opalibdir $MPICH2_LDFLAGS $F90MODLIBS $mpilibs $MPI_OTHERLIBS 
    344344    rc=$? 
    345345else 
    346     $Show $F90 $F90FLAGS "${allargs[@]}" $F90INCDIRS $F90MODDIRS 
     346    $Show $F90 $MPICH2_MPIF90_FLAGS $F90FLAGS "${allargs[@]}" $F90INCDIRS $F90MODDIRS 
    347347    rc=$? 
    348348fi 
  • mpich2/trunk/src/env/mpif90.in

    r4441 r4856  
    363363        mpilibs="$F90_LINKPATH_SHL$libdir $mpilibs" 
    364364    fi 
    365     $Show $F90 $F90FLAGS $LDFLAGS $allargs $F90INCDIRS $F90MODDIRS -L$libdir -L$opalibdir $F90MODLIBS $mpilibs $MPI_OTHERLIBS 
     365    $Show $F90 $MPICH2_MPIF90_FLAGS $F90FLAGS $LDFLAGS $allargs $F90INCDIRS $F90MODDIRS -L$libdir -L$opalibdir $MPICH2_LDFLAGS $F90MODLIBS $mpilibs $MPI_OTHERLIBS 
    366366    rc=$? 
    367367else 
    368     $Show $F90 $F90FLAGS $allargs $F90INCDIRS $F90MODDIRS 
     368    $Show $F90 $MPICH2_MPIF90_FLAGS $F90FLAGS $allargs $F90INCDIRS $F90MODDIRS 
    369369    rc=$? 
    370370fi