From 076eaba6e32f15031840c83a2ea019c14db5f6f2 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 27 Oct 2015 13:23:15 +0100 Subject: mvapich2 : fixed some issues with the package. Needs further improvment with respect to network and pm --- var/spack/packages/mvapich2/package.py | 162 +++++++++++++++++---------------- 1 file changed, 82 insertions(+), 80 deletions(-) diff --git a/var/spack/packages/mvapich2/package.py b/var/spack/packages/mvapich2/package.py index ca0b1287c1..1937564fc8 100644 --- a/var/spack/packages/mvapich2/package.py +++ b/var/spack/packages/mvapich2/package.py @@ -1,104 +1,106 @@ -import os from spack import * + class Mvapich2(Package): """mvapich2 is an MPI implmenetation for infiniband networks.""" homepage = "http://mvapich.cse.ohio-state.edu/" + version('2.2a', 'b8ceb4fc5f5a97add9b3ff1b9cbe39d2', + url='http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.2a.tar.gz') + + version('2.0', '9fbb68a4111a8b6338e476dc657388b4', + url='http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.0.tar.gz') + 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 - 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 + variant('slurm', default=True, description='Sets SLURM as the process manager') - def install(self, spec, prefix): - # we'll set different configure flags depending on our environment - configure_args = [] + # FIXME: those variants are mutually exclusive. A variant enum would fit here. + variant('psm', default=False, description='Configures a build for QLogic PSM-CH3') + variant('sock', default=False, description='Configures a build for TCP/IP-CH3') + # TODO : a lot of network variants are still missing. + # See http://mvapich.cse.ohio-state.edu/static/media/mvapich/mvapich2-2.0-userguide.html - # TODO: The MPICH*_FLAGS have a different name for 1.9 + def set_build_type_flags(self, spec, configure_args): + """ + Appends to configure_args the flags that depends only on the build type (i.e. release or debug) + :param spec: spec + :param configure_args: list of current configure arguments + """ 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" + build_type_options = [ + "--disable-fast", + "--enable-error-checking=runtime", + "--enable-error-messages=all" + ] 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") + build_type_options = ["--enable-fast=all"] + configure_args.extend(build_type_options) + + def set_process_manager(self, spec, configure_args): + """ + Appends to configure_args the flags that will select the process manager + + :param spec: spec + :param configure_args: list of current configure arguments + """ + # FIXME : supports only slurm so far + if '+slurm' in spec: + process_manager_options = [ + "--with-pm=no", + "--with-pmi=slurm" + ] + configure_args.extend(process_manager_options) + + def set_network_type(self, spec, configure_args): + # Check that at most one variant has been activated + # FIXME : ugly, as it does not scale at all (and is full of conditionals) + count = 0 + if '+psm' in spec: + count += 1 + if '+sock' in spec: + count += 1 + if count > 1: + raise RuntimeError('MVAPICH2 variants are mutually exclusive : only one can be selected at a time') + + # From here on I can suppose that ony one variant has been selected + if '+psm' in spec: + network_options = ["--with-device=ch3:psm"] + elif '+sock' in spec: + network_options = ["--with-device=ch3:sock"] else: - # throw this flag on IB systems - configure_args.append("--with-device=ch3:mrail", "--with-rdma=gen2") + network_options = ["--with-device=ch3:mrail", "--with-rdma=gen2"] - # TODO: shared-memory build + configure_args.extend(network_options) - # 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", + def install(self, spec, prefix): + # we'll set different configure flags depending on our environment + configure_args = [ + "--prefix=%s" % prefix, + "--enable-shared", + "--enable-romio", "--disable-silent-rules", - *configure_args) - + "--enable-debuginfo", + "--enable-g=dbg" + ] + if not self.compiler.f77 and not self.compiler.fc: + configure_args.append("--enable-fortran=none") + + # Set flags that depend only on the type of the build (debug, release) + self.set_build_type_flags(spec, configure_args) + # Set the process manager + self.set_process_manager(spec, configure_args) + # Determine network type by variant + self.set_network_type(spec, configure_args) + + configure(*configure_args) make() - make("install") -- cgit v1.2.3-70-g09d2 From 4a72bd791981ba799936a3f5fb9c843401036c8e Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 29 Oct 2015 10:45:29 +0100 Subject: mvapich2 : fixed typos. Added FIXME --- var/spack/packages/mvapich2/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/packages/mvapich2/package.py b/var/spack/packages/mvapich2/package.py index 1937564fc8..94da920c7c 100644 --- a/var/spack/packages/mvapich2/package.py +++ b/var/spack/packages/mvapich2/package.py @@ -2,7 +2,7 @@ from spack import * class Mvapich2(Package): - """mvapich2 is an MPI implmenetation for infiniband networks.""" + """MVAPICH2 is an MPI implementation for Infiniband networks.""" homepage = "http://mvapich.cse.ohio-state.edu/" version('2.2a', 'b8ceb4fc5f5a97add9b3ff1b9cbe39d2', @@ -13,6 +13,7 @@ class Mvapich2(Package): version('1.9', '5dc58ed08fd3142c260b70fe297e127c', url="http://mvapich.cse.ohio-state.edu/download/mvapich2/mv2/mvapich2-1.9.tgz") + # FIXME: the statement doesn't seem to take 'when' into account when applying patches patch('ad_lustre_rwcontig_open_source.patch', when='@1.9') provides('mpi@:2.2', when='@1.9') # MVAPICH2-1.9 supports MPI 2.2 -- cgit v1.2.3-70-g09d2 From 0ae05fdf99a8e22b2abb266831b3ea77bbd201b9 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 9 Nov 2015 13:58:34 +0100 Subject: mvapich2 : added variants for different process managers --- var/spack/packages/mvapich2/package.py | 39 +++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/var/spack/packages/mvapich2/package.py b/var/spack/packages/mvapich2/package.py index 94da920c7c..3747724915 100644 --- a/var/spack/packages/mvapich2/package.py +++ b/var/spack/packages/mvapich2/package.py @@ -13,14 +13,21 @@ class Mvapich2(Package): version('1.9', '5dc58ed08fd3142c260b70fe297e127c', url="http://mvapich.cse.ohio-state.edu/download/mvapich2/mv2/mvapich2-1.9.tgz") - # FIXME: the statement doesn't seem to take 'when' into account when applying patches patch('ad_lustre_rwcontig_open_source.patch', when='@1.9') 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 + variant('debug', default=False, description='Enables debug information and error messages at run-time') - variant('slurm', default=True, description='Sets SLURM as the process manager') + ########## + # TODO : Process managers should be grouped into the same variant, as soon as variant capabilities will be extended + # See https://groups.google.com/forum/#!topic/spack/F8-f8B4_0so + variant('slurm', default=False, description='Sets slurm as the only process manager') + variant('hydra', default=False, description='Sets hydra as one of the process managers') + variant('gforker', default=False, description='Sets gforker as one of the process managers') + variant('remshell', default=False, description='Sets remshell as one of the process managers') + ########## # FIXME: those variants are mutually exclusive. A variant enum would fit here. variant('psm', default=False, description='Configures a build for QLogic PSM-CH3') @@ -41,25 +48,41 @@ class Mvapich2(Package): "--enable-error-checking=runtime", "--enable-error-messages=all" ] - else: build_type_options = ["--enable-fast=all"] + configure_args.extend(build_type_options) def set_process_manager(self, spec, configure_args): """ - Appends to configure_args the flags that will select the process manager + Appends to configure_args the flags that will enable the appropriate process managers :param spec: spec :param configure_args: list of current configure arguments """ - # FIXME : supports only slurm so far + # Check that slurm variant is not activated together with other pm variants + has_slurm_incompatible_variant = any((x in spec for x in ['+hydra', '+gforker', '+remshell'])) + if '+slurm' in spec and has_slurm_incompatible_variant: + raise RuntimeError(" %s : 'slurm' cannot be activated together with other process managers" % self.name) + + process_manager_options = [] if '+slurm' in spec: process_manager_options = [ - "--with-pm=no", - "--with-pmi=slurm" + "--with-pm=slurm" + ] + elif has_slurm_incompatible_variant: + pm = [] + if '+hydra' in spec: + pm.append('hydra') + if '+gforker' in spec: + pm.append('gforker') + if '+remshell' in spec: + pm.append('remshell') + + process_manager_options = [ + "--with-pm=%s" % ':'.join(pm) ] - configure_args.extend(process_manager_options) + configure_args.extend(process_manager_options) def set_network_type(self, spec, configure_args): # Check that at most one variant has been activated -- cgit v1.2.3-70-g09d2 From 79ed9de4c12ac0decfd8a49cfe17fedb96f9e5af Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 9 Nov 2015 14:35:54 +0100 Subject: mvapich2 : added variants for different network types --- var/spack/packages/mvapich2/package.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/var/spack/packages/mvapich2/package.py b/var/spack/packages/mvapich2/package.py index 3747724915..fb5912fcef 100644 --- a/var/spack/packages/mvapich2/package.py +++ b/var/spack/packages/mvapich2/package.py @@ -29,11 +29,16 @@ class Mvapich2(Package): variant('remshell', default=False, description='Sets remshell as one of the process managers') ########## - # FIXME: those variants are mutually exclusive. A variant enum would fit here. + ########## + # TODO : Network types should be grouped into the same variant, as soon as variant capabilities will be extended variant('psm', default=False, description='Configures a build for QLogic PSM-CH3') variant('sock', default=False, description='Configures a build for TCP/IP-CH3') - # TODO : a lot of network variants are still missing. - # See http://mvapich.cse.ohio-state.edu/static/media/mvapich/mvapich2-2.0-userguide.html + variant('nemesisibtcp', default=False, description='Configures a build for both OFA-IB-Nemesis and TCP/IP-Nemesis') + variant('nemesisib', default=False, description='Configures a build for OFA-IB-Nemesis') + variant('nemesis', default=False, description='Configures a build for TCP/IP-Nemesis') + ########## + + # TODO : CUDA support is missing def set_build_type_flags(self, spec, configure_args): """ @@ -46,7 +51,8 @@ class Mvapich2(Package): build_type_options = [ "--disable-fast", "--enable-error-checking=runtime", - "--enable-error-messages=all" + "--enable-error-messages=all", + "--enable-g=dbg", "--enable-debuginfo" # Permits debugging with TotalView ] else: build_type_options = ["--enable-fast=all"] @@ -92,14 +98,26 @@ class Mvapich2(Package): count += 1 if '+sock' in spec: count += 1 + if '+nemesisibtcp' in spec: + count += 1 + if '+nemesisib' in spec: + count += 1 + if '+nemesis' in spec: + count += 1 if count > 1: - raise RuntimeError('MVAPICH2 variants are mutually exclusive : only one can be selected at a time') + raise RuntimeError('MVAPICH2 network variants are mutually exclusive : only one can be selected at a time') # From here on I can suppose that ony one variant has been selected if '+psm' in spec: network_options = ["--with-device=ch3:psm"] elif '+sock' in spec: network_options = ["--with-device=ch3:sock"] + elif '+nemesisibtcp' in spec: + network_options = ["--with-device=ch3:nemesis:ib,tcp"] + elif '+nemesisib' in spec: + network_options = ["--with-device=ch3:nemesis:ib"] + elif '+nemesis' in spec: + network_options = ["--with-device=ch3:nemesis"] else: network_options = ["--with-device=ch3:mrail", "--with-rdma=gen2"] -- cgit v1.2.3-70-g09d2 From 42bc552dd74cfe961b3f345321994dfa637549e7 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 9 Nov 2015 15:45:23 +0100 Subject: mvapich2 : variant strings are associated with a named variable --- var/spack/packages/mvapich2/package.py | 90 +++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/var/spack/packages/mvapich2/package.py b/var/spack/packages/mvapich2/package.py index fb5912fcef..53090ee05c 100644 --- a/var/spack/packages/mvapich2/package.py +++ b/var/spack/packages/mvapich2/package.py @@ -23,22 +23,43 @@ class Mvapich2(Package): ########## # TODO : Process managers should be grouped into the same variant, as soon as variant capabilities will be extended # See https://groups.google.com/forum/#!topic/spack/F8-f8B4_0so - variant('slurm', default=False, description='Sets slurm as the only process manager') - variant('hydra', default=False, description='Sets hydra as one of the process managers') - variant('gforker', default=False, description='Sets gforker as one of the process managers') - variant('remshell', default=False, description='Sets remshell as one of the process managers') + SLURM = 'slurm' + HYDRA = 'hydra' + GFORKER = 'gforker' + REMSHELL = 'remshell' + SLURM_INCOMPATIBLE_PMS = (HYDRA, GFORKER, REMSHELL) + variant(SLURM, default=False, description='Sets slurm as the only process manager') + variant(HYDRA, default=False, description='Sets hydra as one of the process managers') + variant(GFORKER, default=False, description='Sets gforker as one of the process managers') + variant(REMSHELL, default=False, description='Sets remshell as one of the process managers') ########## ########## # TODO : Network types should be grouped into the same variant, as soon as variant capabilities will be extended - variant('psm', default=False, description='Configures a build for QLogic PSM-CH3') - variant('sock', default=False, description='Configures a build for TCP/IP-CH3') - variant('nemesisibtcp', default=False, description='Configures a build for both OFA-IB-Nemesis and TCP/IP-Nemesis') - variant('nemesisib', default=False, description='Configures a build for OFA-IB-Nemesis') - variant('nemesis', default=False, description='Configures a build for TCP/IP-Nemesis') + PSM = 'psm' + SOCK = 'sock' + NEMESISIBTCP = 'nemesisibtcp' + NEMESISIB = 'nemesisib' + NEMESIS = 'nemesis' + SUPPORTED_NETWORKS = (PSM, SOCK, NEMESIS, NEMESISIB, NEMESISIBTCP) + variant(PSM, default=False, description='Configures a build for QLogic PSM-CH3') + variant(SOCK, default=False, description='Configures a build for TCP/IP-CH3') + variant(NEMESISIBTCP, default=False, description='Configures a build for both OFA-IB-Nemesis and TCP/IP-Nemesis') + variant(NEMESISIB, default=False, description='Configures a build for OFA-IB-Nemesis') + variant(NEMESIS, default=False, description='Configures a build for TCP/IP-Nemesis') ########## - # TODO : CUDA support is missing + # FIXME : CUDA support is missing + + @staticmethod + def enabled(x): + """ + Given a variant name returns the string that means the variant is enabled + + :param x: variant name + :return: + """ + return '+' + x def set_build_type_flags(self, spec, configure_args): """ @@ -67,56 +88,45 @@ class Mvapich2(Package): :param configure_args: list of current configure arguments """ # Check that slurm variant is not activated together with other pm variants - has_slurm_incompatible_variant = any((x in spec for x in ['+hydra', '+gforker', '+remshell'])) - if '+slurm' in spec and has_slurm_incompatible_variant: + has_slurm_incompatible_variants = any(self.enabled(x) in spec for x in Mvapich2.SLURM_INCOMPATIBLE_PMS) + if self.enabled(Mvapich2.SLURM) in spec and has_slurm_incompatible_variants: raise RuntimeError(" %s : 'slurm' cannot be activated together with other process managers" % self.name) process_manager_options = [] - if '+slurm' in spec: + if self.enabled(Mvapich2.SLURM) in spec: process_manager_options = [ "--with-pm=slurm" ] - elif has_slurm_incompatible_variant: - pm = [] - if '+hydra' in spec: - pm.append('hydra') - if '+gforker' in spec: - pm.append('gforker') - if '+remshell' in spec: - pm.append('remshell') - + elif has_slurm_incompatible_variants: + pms = [] + # The variant name is equal to the process manager name in the configuration options + for x in Mvapich2.SLURM_INCOMPATIBLE_PMS: + if self.enabled(x) in spec: + pms.append(x) process_manager_options = [ - "--with-pm=%s" % ':'.join(pm) + "--with-pm=%s" % ':'.join(pms) ] configure_args.extend(process_manager_options) def set_network_type(self, spec, configure_args): # Check that at most one variant has been activated - # FIXME : ugly, as it does not scale at all (and is full of conditionals) count = 0 - if '+psm' in spec: - count += 1 - if '+sock' in spec: - count += 1 - if '+nemesisibtcp' in spec: - count += 1 - if '+nemesisib' in spec: - count += 1 - if '+nemesis' in spec: - count += 1 + for x in Mvapich2.SUPPORTED_NETWORKS: + if self.enabled(x) in spec: + count += 1 if count > 1: - raise RuntimeError('MVAPICH2 network variants are mutually exclusive : only one can be selected at a time') + raise RuntimeError('network variants are mutually exclusive (only one can be selected at a time)') # From here on I can suppose that ony one variant has been selected - if '+psm' in spec: + if self.enabled(Mvapich2.PSM) in spec: network_options = ["--with-device=ch3:psm"] - elif '+sock' in spec: + elif self.enabled(Mvapich2.SOCK) in spec: network_options = ["--with-device=ch3:sock"] - elif '+nemesisibtcp' in spec: + elif self.enabled(Mvapich2.NEMESISIBTCP) in spec: network_options = ["--with-device=ch3:nemesis:ib,tcp"] - elif '+nemesisib' in spec: + elif self.enabled(Mvapich2.NEMESISIB) in spec: network_options = ["--with-device=ch3:nemesis:ib"] - elif '+nemesis' in spec: + elif self.enabled(Mvapich2.NEMESIS) in spec: network_options = ["--with-device=ch3:nemesis"] else: network_options = ["--with-device=ch3:mrail", "--with-rdma=gen2"] -- cgit v1.2.3-70-g09d2 From 27c64f77404ed3f8a201294596a8a607f18bd39b Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 9 Nov 2015 15:55:44 +0100 Subject: mvapich2 : changed method name for consistency. Removed possibly duplicated flags --- var/spack/packages/mvapich2/package.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/var/spack/packages/mvapich2/package.py b/var/spack/packages/mvapich2/package.py index 53090ee05c..dc2b2cb23f 100644 --- a/var/spack/packages/mvapich2/package.py +++ b/var/spack/packages/mvapich2/package.py @@ -61,7 +61,7 @@ class Mvapich2(Package): """ return '+' + x - def set_build_type_flags(self, spec, configure_args): + def set_build_type(self, spec, configure_args): """ Appends to configure_args the flags that depends only on the build type (i.e. release or debug) @@ -140,14 +140,12 @@ class Mvapich2(Package): "--enable-shared", "--enable-romio", "--disable-silent-rules", - "--enable-debuginfo", - "--enable-g=dbg" ] if not self.compiler.f77 and not self.compiler.fc: configure_args.append("--enable-fortran=none") - # Set flags that depend only on the type of the build (debug, release) - self.set_build_type_flags(spec, configure_args) + # Set the type of the build (debug, release) + self.set_build_type(spec, configure_args) # Set the process manager self.set_process_manager(spec, configure_args) # Determine network type by variant -- cgit v1.2.3-70-g09d2