Alternate C Compilers


Up: Details Next: Fortran Compilers Previous: Special Configure Options

More and more systems, particularly clusters, come with multiple compilers. In many cases, you can build mpich using just one of these compilers and then allow users to use their favorite compiler when building their code. In many cases, no extra steps are needed. Users can simply use the command-line argument -cc or the environment variable MPICH_CC to specify a different compiler.

Unfortunately, this won't always work. For example, in some cases, different libraries may be needed by different compilers when linking programs. Some compilers may need different options to support ANSI/ISO C. In particular, support for the longer datatypes such as long long and long double may rely on runtime library support routines that are specific to each compiler. To handle all of these cases, For C and C++, you can create a file with the name mpicc-<compilename>.conf, e.g., mpicc-gcc.conf or mpicc-pgcc.conf, that contains any specifications that are needed by the mpicc command. mpicxx uses mpicxx-<name>.conf. Currently, these files must be created by hand, starting from the file mpichlib.conf that is created in the mpich/util directory by the mpich configure. The simplest way to create each file is to use configure:

    setenv CC cc 
    configure --prefix=/usr/local/mpich-1.2.6 
    make  
    make install 
    cp util/mpichlib.conf /usr/local/mpich-1.2.6/etc/mpicc-cc.conf 
    setenv CC gcc 
    configure --prefix=/usr/local/mpich-1.2.6  
    make  
    cp util/mpichlib.conf /usr/local/mpich-1.2.6/etc/mpicc-gcc.conf 
In this example, the default value of sysconfdir, $prefix/etc, is used.

For example, if mpich was built with cc as the compiler but a user wanted to use gcc instead, either the commands

    MPICH_CC=gcc 
    mpicc ... 
or
    mpicc -config=gcc ... 
would case mpicc to load mpich-gcc.conf and use the appropriate definitions.



Up: Details Next: Fortran Compilers Previous: Special Configure Options