summaryrefslogtreecommitdiff
path: root/var/spack/packages/mvapich2/package.py
blob: ca0b1287c1ce459128f1328d82108381266ae340 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import os
from spack import *

class Mvapich2(Package):
    """mvapich2 is an MPI implmenetation for infiniband networks."""
    homepage = "http://mvapich.cse.ohio-state.edu/"

    version('1.9', '5dc58ed08fd3142c260b70fe297e127c',
            url="http://mvapich.cse.ohio-state.edu/download/mvapich2/mv2/mvapich2-1.9.tgz")
    patch('ad_lustre_rwcontig_open_source.patch', when='@1.9')

    version('2.0', '9fbb68a4111a8b6338e476dc657388b4',
            url='http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.0.tar.gz')

    provides('mpi@:2.2', when='@1.9')    # MVAPICH2-1.9 supports MPI 2.2
    provides('mpi@:3.0', when='@2.0')    # MVAPICH2-2.0 supports MPI 3.0


    def install(self, spec, prefix):
        # we'll set different configure flags depending on our environment
        configure_args = []

        # TODO: The MPICH*_FLAGS have a different name for 1.9

        if '+debug' in spec:
            # set configure flags for debug build
            configure_args.append("--disable-fast")
            configure_args.append("--enable-g=dbg")
            configure_args.append("--enable-error-checking=runtime")
            configure_args.append("--enable-error-messages=all")
            configure_args.append("--enable-nmpi-as-mpi")

            if "%gnu" in spec:
                # set variables for GNU compilers
                os.environ['MPICHLIB_CFLAGS']   = "-g -O0"
                os.environ['MPICHLIB_CXXFLAGS'] = "-g -O0"
                os.environ['MPICHLIB_FFLAGS']   = "-g -O0 -fno-second-underscore"
                os.environ['MPICHLIB_F90FLAGS'] = "-g -O0 -fno-second-underscore"
            elif "%intel" in spec:
                # set variables for Inel compilers
                os.environ['MPICHLIB_CFLAGS']   = "-g -O0"
                os.environ['MPICHLIB_CXXFLAGS'] = "-g -O0"
                os.environ['MPICHLIB_FFLAGS']   = "-g -O0"
                os.environ['MPICHLIB_F90FLAGS'] = "-g -O0"
            elif "%pgi" in spec:
                # set variables for PGI compilers
                os.environ['MPICHLIB_CFLAGS']   = "-g -O0 -fPIC"
                os.environ['MPICHLIB_CXXFLAGS'] = "-g -O0 -fPIC"
                os.environ['MPICHLIB_FFLAGS']   = "-g -O0 -fPIC"
                os.environ['MPICHLIB_F90FLAGS'] = "-g -O0 -fPIC"

        else:
            # set configure flags for normal optimizations
            configure_args.append("--enable-fast=all")
            configure_args.append("--enable-g=dbg")
            configure_args.append("--enable-nmpi-as-mpi")

            if "%gnu" in spec:
                # set variables for what compilers
                os.environ['MPICHLIB_CFLAGS']   = "-g -O2"
                os.environ['MPICHLIB_CXXFLAGS'] = "-g -O2"
                os.environ['MPICHLIB_FFLAGS']   = "-g -O2 -fno-second-underscore"
                os.environ['MPICHLIB_F90FLAGS'] = "-g -O2 -fno-second-underscore"
            elif "%intel" in spec:
                # set variables for Inel compilers
                os.environ['MPICHLIB_CFLAGS']   = "-g -O2"
                os.environ['MPICHLIB_CXXFLAGS'] = "-g -O2"
                os.environ['MPICHLIB_FFLAGS']   = "-g -O2"
                os.environ['MPICHLIB_F90FLAGS'] = "-g -O2"
            elif "%pgi" in spec:
                # set variables for PGI compilers
                os.environ['MPICHLIB_CFLAGS']   = "-g -O2 -fPIC"
                os.environ['MPICHLIB_CXXFLAGS'] = "-g -O2 -fPIC"
                os.environ['MPICHLIB_FFLAGS']   = "-g -O2 -fPIC"
                os.environ['MPICHLIB_F90FLAGS'] = "-g -O2 -fPIC"

        # determine network type by variant
        if "+psm" in spec:
            # throw this flag on QLogic systems to use PSM
            configure_args.append("--with-device=ch3:psm")
        else:
            # throw this flag on IB systems
            configure_args.append("--with-device=ch3:mrail", "--with-rdma=gen2")

        # TODO: shared-memory build

        # TODO: CUDA

        # TODO: other file systems like panasis

        configure(
            "--prefix=" + prefix,
            "--enable-f77", "--enable-fc", "--enable-cxx",
            "--enable-shared", "--enable-sharedlibs=gcc",
            "--enable-debuginfo",
            "--with-pm=no", "--with-pmi=slurm",
            "--enable-romio", "--with-file-system=lustre+nfs+ufs",
            "--disable-mpe", "--without-mpe",
            "--disable-silent-rules",
            *configure_args)

        make()

        make("install")