Request for comments: mpi and using multiple compilers

David Strubbe dstrubbe at mit.edu
Sat Jul 20 17:06:28 PDT 2013


On Sat, Jul 20, 2013 at 7:28 PM, Sean Farley <sean at macports.org> wrote:

> Hi all,
>
> I'm looking for comments and feedback for two new port groups:
> multiple compilers [1] and mpi [2]. My goal is to unify all the gcc4X
> variants and mpich / openmpi variants scattered throughout the port
> tree.
>

Sounds like a good idea to me.


> $ port install netcdf +mpich +gfortran
> --->  Computing dependencies for netcdf.
> --->  Configuring netcdf
> Error: org.macports.configure for port netcdf returned: mpich must be
> installed with +gfortran.
>

The netcdf port does not use fortran, the fortran interface is in
netcdf-fortran. So I don't understand what putting +gfortran here would do.

I think in most cases that if you use MPI, then there is no need to specify
the underlying compiler also (since compiling even non-MPI code in the
package with mpich +gfortran is the same as just using gfortran). Recently,
we sorted this out for the arpack port.

On the other hand, sometimes it is necessary to enforce the same Fortran
compiler used for MPI and for some dependency (when they use Fortran
modules). I am working on adding MPI support to the octopus port, and wrote
the following Portfile code to handle such a dependency. Perhaps you can
include something like this in MPI portgroup (and use your more extensive
list of Fortran compilers available).

set fortran unknown
set fortrans { gcc42 gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 g95 }
foreach fc_name ${fortrans} {
    if { [variant_isset ${fc_name}] } {
        set fortran ${fc_name}
    } elseif { [variant_isset openmpi] } {
        if { [active_variants openmpi ${fc_name}] } { set fortran
${fc_name} }
    } elseif { [variant_isset mpich] } {
        if { [_portnameactive mpich] } {
            if { [active_variants mpich ${fc_name}] } { set fortran
${fc_name} }
        } elseif { [_portnameactive mpich-devel] } {
            if { [active_variants mpich-devel ${fc_name}] } { set fortran
${fc_name} }
        }
    }
}

pre-fetch {
    if { ${fortran} == "unknown" } {
        if { [variant_isset openmpi] } {
            ui_error "Variant +openmpi requires openmpi to have been built
with Fortran support."
            return -code error "Variant +openmpi requires openmpi to have
been built with Fortran support."
        } elseif { [variant_isset mpich] } {
            ui_error "Variant +mpich requires mpich/mpich-devel to have
been built with Fortran support."
            return -code error "Variant +mpich requires mpich/mpich-devel
to have been built with Fortran support."
        } else {
            ui_error "Internal error: cannot determine Fortran compiler."
            return -code error "Internal error: cannot determine Fortran
compiler."
        }
    }
    ui_msg "Fortran compiler is ${fortran}."
}

require_active_variants libxc ${fortran}



> [2]
> https://bitbucket.org/seanfarley/scienceports/src/2832e9d9716e178f20b5ab0eb563f40d7fcce730/_resources/port1.0/group/mpi-1.0.tcl?at=default
>
>
Looks like you should call openmpi-devel "OpenMPI-devel" not "OpenMPI" in
the description, by analogy to MPICH.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20130720/32b0aad3/attachment.html>


More information about the macports-dev mailing list