示例#1
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        m = mvapich2(...)
        Stage0 += m
        Stage1 += m.runtime()
        ```
        """
        self.rt += comment('MVAPICH2')
        # TODO: move the definition of runtime ospackages
        self.rt += packages(ospackages=self.__runtime_ospackages)
        self.rt += self.__bb.runtime(_from=_from)
        return str(self.rt)
示例#2
0
    def __instructions(self):
        """Fill in container instructions"""

        if self.__directory:
            self += comment('HDF5')
        else:
            self += comment('HDF5 version {}'.format(self.__version))

        self += packages(ospackages=self.__ospackages)

        if self.__directory:
            # Use source from local build context
            self += copy(src=self.__directory,
                         dest=posixpath.join(self.__wd, self.__directory))

        self += shell(commands=self.__commands)
        self += environment(variables=self.environment_step())
示例#3
0
    def __instructions(self):
        """Fill in container instructions"""

        comments = ['NetCDF version {}'.format(self.__version)]
        if self.__cxx:
            comments.append('NetCDF C++ version {}'.format(self.__version_cxx))
        if self.__fortran:
            comments.append('NetCDF Fortran version {}'.format(
                self.__version_fortran))
        self += comment(', '.join(comments))

        if self.__ospackages:
            self += packages(ospackages=self.__ospackages)

        self += shell(commands=self.__commands)

        self += environment(variables=self.environment_step())
示例#4
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        p = pnetcdf(...)
        Stage0 += p
        Stage1 += p.runtime()
        ```
        """
        self.rt += comment('PnetCDF')
        if self.__runtime_ospackages:
            self.rt += packages(ospackages=self.__runtime_ospackages)
        self.rt += self.__bb.runtime(_from=_from)
        return str(self.rt)
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.
        """

        instructions = []
        instructions.append(comment('OFED'))

        if self.__ospackages:
            instructions.append(packages(ospackages=self.__ospackages))

        # Suppress warnings from libibverbs
        instructions.append(shell(commands=['mkdir -p /etc/libibverbs.d']))

        instructions.append(
            copy(_from=_from, dest=self.__prefix, src=self.__prefix))
        return '\n'.join(str(x) for x in instructions)
示例#6
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        p = python(...)
        Stage0 += p
        Stage1 += p.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('Python'))
        instructions.append(packages(apt=self.__debs, epel=self.__epel,
                                     yum=self.__rpms))
        return '\n'.join(str(x) for x in instructions)
示例#7
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        u = ucx(...)
        Stage0 += u
        Stage1 += u.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('UCX'))
        instructions.append(packages(ospackages=self.__runtime_ospackages))
        instructions.append(self.__bb.runtime(_from=_from))
        return '\n'.join(str(x) for x in instructions)
示例#8
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(gdrcopy, self).__init__(**kwargs)

        # Parameters
        self.__baseurl = kwargs.pop('baseurl', 'https://github.com/NVIDIA/gdrcopy/archive')
        self.__ospackages = kwargs.pop('ospackages', ['make', 'wget'])
        self.__prefix = kwargs.pop('prefix', '/usr/local/gdrcopy')
        self.__version = kwargs.pop('version', '2.1')

        # Setup the environment variables
        self.environment_variables['CPATH'] = '{}:$CPATH'.format(
            posixpath.join(self.__prefix, 'include'))
        self.environment_variables['LIBRARY_PATH'] = '{}:$LIBRARY_PATH'.format(
            posixpath.join(self.__prefix, 'lib64'))
        if not self.ldconfig:
            self.environment_variables['LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(
                posixpath.join(self.__prefix, 'lib64'))

        if StrictVersion(self.__version) >= StrictVersion('2.1'):
            url='{0}/{1}.tar.gz'.format(self.__baseurl, self.__version)
        else:
            url='{0}/v{1}.tar.gz'.format(self.__baseurl, self.__version)

        # Setup build configuration
        self.__bb = generic_build(
            annotations={'version': self.__version},
            base_annotation=self.__class__.__name__,
            # Work around "install -D" issue on CentOS
            build=['mkdir -p {0}/include {0}/lib64'.format(self.__prefix),
                   'make PREFIX={} lib lib_install'.format(self.__prefix)],
            comment=False,
            devel_environment=self.environment_variables,
            directory='gdrcopy-{}'.format(self.__version),
            libdir='lib64',
            prefix=self.__prefix,
            runtime_environment=self.environment_variables,
            url=url,
            **kwargs)

        # Container instructions
        self += comment('GDRCOPY version {}'.format(self.__version))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#9
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        l = llvm(...)
        Stage0 += l
        Stage1 += l.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('LLVM compiler runtime'))
        instructions.append(packages(apt=self.__runtime_debs,
                                     scl=bool(self.__version), # True / False
                                     yum=self.__runtime_rpms))
        return '\n'.join(str(x) for x in instructions)
示例#10
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Example

        ```python
        c = cgns(...)
        Stage0 += c
        Stage1 += c.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('CGNS'))
        instructions.append(packages(ospackages=self.__runtime_ospackages))
        instructions.append(
            copy(_from=_from, src=self.prefix, dest=self.prefix))
        return '\n'.join(str(x) for x in instructions)
示例#11
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        m = mvapich2(...)
        Stage0 += m
        Stage1 += m.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('MVAPICH2'))
        # TODO: move the definition of runtime ospackages
        instructions.append(packages(ospackages=self.__runtime_ospackages))
        instructions.append(self.__bb.runtime(_from=_from))
        return '\n'.join(str(x) for x in instructions)
示例#12
0
    def __instructions(self):
        """Fill in container instructions"""

        self += comment('pip')
        if self.__debs or self.__rpms:
            self += packages(apt=self.__debs,
                             epel=self.__epel,
                             yum=self.__rpms)

        if self.__alternatives:
            self += shell(commands=[
                'alternatives --set python /usr/bin/python2',
                'alternatives --install /usr/bin/pip pip /usr/bin/pip2 30'
            ])

        if self.__pip:
            if self.__args:
                self.__pip = '{0} {1}'.format(self.__pip,
                                              ' '.join(self.__args))

            cmds = []

            if self.__upgrade:
                cmds.append('{0} install --upgrade pip'.format(self.__pip))

            if self.__requirements:
                self += copy(src=self.__requirements,
                             dest=posixpath.join(
                                 self.__wd,
                                 posixpath.basename(self.__requirements)))
                cmds.append('{0} install -r {1}'.format(
                    self.__pip,
                    posixpath.join(self.__wd,
                                   posixpath.basename(self.__requirements))))
                cmds.append(
                    self.cleanup_step(items=[
                        posixpath.join(self.__wd,
                                       posixpath.basename(self.__requirements))
                    ]))

            if self.__packages:
                cmds.append('{0} install {1}'.format(self.__pip, ' '.join(
                    self.__packages)))
            self += shell(commands=cmds)
示例#13
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(pmix, self).__init__(**kwargs)

        self.__baseurl = kwargs.pop(
            'baseurl',
            'https://github.com/openpmix/openpmix/releases/download')
        self.__check = kwargs.pop('check', False)
        self.__ospackages = kwargs.pop('ospackages', [])
        self.__prefix = kwargs.pop('prefix', '/usr/local/pmix')
        self.__runtime_ospackages = []  # Filled in by __distro()
        self.__version = kwargs.pop('version', '3.1.4')

        # Set the Linux distribution specific parameters
        self.__distro()

        # Set the environment variables
        self.environment_variables['CPATH'] = '{}:$CPATH'.format(
            posixpath.join(self.__prefix, 'include'))
        self.environment_variables['PATH'] = '{}:$PATH'.format(
            posixpath.join(self.__prefix, 'bin'))
        if not self.ldconfig:
            self.environment_variables[
                'LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(
                    posixpath.join(self.__prefix, 'lib'))

        # Setup build configuration
        self.__bb = generic_autotools(
            annotations={'version': self.__version},
            base_annotation=self.__class__.__name__,
            check=self.__check,
            comment=False,
            devel_environment=self.environment_variables,
            prefix=self.__prefix,
            runtime_environment=self.environment_variables,
            url='{0}/v{1}/pmix-{1}.tar.gz'.format(self.__baseurl,
                                                  self.__version),
            **kwargs)

        # Container instructions
        self += comment('PMIX version {}'.format(self.__version))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#14
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(xpmem, self).__init__(**kwargs)

        # Parameters
        self.__branch = kwargs.pop('branch', 'master')
        self.__configure_opts = kwargs.pop('configure_opts',
                                           ['--disable-kernel-module'])
        self.__ospackages = kwargs.pop('ospackages', [
            'autoconf', 'automake', 'ca-certificates', 'file', 'git',
            'libtool', 'make'
        ])
        self.__prefix = kwargs.pop('prefix', '/usr/local/xpmem')
        self.__repository = kwargs.pop('repository',
                                       'https://gitlab.com/hjelmn/xpmem.git')

        # Setup the environment variables
        self.environment_variables['CPATH'] = '{}:$CPATH'.format(
            posixpath.join(self.__prefix, 'include'))
        self.environment_variables['LIBRARY_PATH'] = '{}:$LIBRARY_PATH'.format(
            posixpath.join(self.__prefix, 'lib'))
        if not self.ldconfig:
            self.environment_variables[
                'LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(
                    posixpath.join(self.__prefix, 'lib'))

        # Setup build configuration
        self.__bb = generic_autotools(
            base_annotation=self.__class__.__name__,
            branch=self.__branch,
            comment=False,
            configure_opts=self.__configure_opts,
            devel_environment=self.environment_variables,
            preconfigure=['autoreconf --install'],
            prefix=self.__prefix,
            repository=self.__repository,
            runtime_environment=self.environment_variables,
            **kwargs)

        # Container instructions
        self += comment('XPMEM branch {}'.format(self.__branch))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#15
0
def main():
    ############################################################################
    # setup basics
    ############################################################################
    hpccm.config.set_container_format('singularity')
    hpccm.config.set_singularity_version('3.3')

    stage0 = hpccm.Stage()
    stage0 += baseimage(image='ubuntu:bionic')

    stage0 += packages(ospackages=[
        'git', 'g++', 'wget', 'pkg-config', 'less', 'uuid-dev', 'gdb',
        'locales', 'gpg-agent', 'gnupg2', 'locales-all', 'unzip'
    ])
    # set language to en_US.UTF-8 to avoid some problems with the cling output system
    stage0 += shell(
        commands=['locale-gen en_US.UTF-8', 'update-locale LANG=en_US.UTF-8'])

    ############################################################################
    # install clang/llvm
    ############################################################################
    stage0 += llvm(version='9', extra_repository=True)

    ############################################################################
    # install ninja build system
    ############################################################################
    stage0 += shell(commands=[
        'cd /opt', 'wget --no-check-certificate ' +
        'https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip',
        'unzip ninja-linux.zip', 'mv ninja /usr/local/bin/',
        'rm ninja-linux.zip', 'cd -'
    ])

    ############################################################################
    # install cmake
    ############################################################################
    stage0 += cmake(eula=True, version='3.16.1')

    ############################################################################
    # write recipe.def
    ############################################################################
    with open('recipe.def', 'w') as filehandle:
        filehandle.write(stage0.__str__())
示例#16
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(magma, self).__init__(**kwargs)

        self.__baseurl = kwargs.pop(
            'baseurl', 'http://icl.utk.edu/projectsfiles/magma/downloads')
        self.__cmake_opts = kwargs.pop('cmake_opts', [])
        self.__gpu_target = kwargs.pop('gpu_target',
                                       ['Pascal', 'Volta', 'Turing'])
        self.__ospackages = kwargs.pop('ospackages', ['tar', 'wget'])
        self.__prefix = kwargs.pop('prefix', '/usr/local/magma')
        self.__version = kwargs.pop('version', '2.5.3')

        # Set the cmake options
        self.__cmake()

        # Setup the environment variables
        self.environment_variables['CPATH'] = '{}:$CPATH'.format(
            posixpath.join(self.__prefix, 'include'))
        self.environment_variables['LIBRARY_PATH'] = '{}:$LIBRARY_PATH'.format(
            posixpath.join(self.__prefix, 'lib'))
        if not self.ldconfig:
            self.environment_variables[
                'LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(
                    posixpath.join(self.__prefix, 'lib'))

        # Setup build configuration
        self.__bb = generic_cmake(
            annotations={'version': self.__version},
            base_annotation=self.__class__.__name__,
            comment=False,
            cmake_opts=self.__cmake_opts,
            devel_environment=self.environment_variables,
            prefix=self.__prefix,
            runtime_environment=self.environment_variables,
            url='{0}/magma-{1}.tar.gz'.format(self.__baseurl, self.__version),
            **kwargs)

        # Container instructions
        self += comment('MAGMA version {}'.format(self.__version))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#17
0
    def __instructions(self):
        """Fill in container instructions"""

        self += comment('pip')
        if self.__debs or self.__rpms:
            self += packages(apt=self.__debs,
                             epel=self.__epel,
                             yum=self.__rpms)

        if self.__pip:
            cmds = []

            if self.__upgrade:
                cmds.append('{0} install --upgrade pip'.format(self.__pip))

            if self.__packages:
                cmds.append('{0} install {1}'.format(self.__pip, ' '.join(
                    self.__packages)))
            self += shell(commands=cmds)
示例#18
0
    def __str__(self):
        """String representation of the building block"""
        instructions = []
        instructions.append(comment('pip'))
        if self.__debs or self.__rpms:
            instructions.append(packages(apt=self.__debs, epel=self.__epel,
                                         yum=self.__rpms))

        if self.__pip:
            cmds = []

            if self.__upgrade:
                cmds.append('{0} install --upgrade pip'.format(self.__pip))

            if self.__packages:
                cmds.append('{0} install {1}'.format(self.__pip,
                                                     ' '.join(self.__packages)))
            instructions.append(shell(commands=cmds))
        return '\n'.join([str(x) for x in instructions])
示例#19
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples
        ```python
        o = openmpi(...)
        Stage0 += o
        Stage1 += o.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('OpenMPI'))
        instructions.append(packages(ospackages=self.__runtime_ospackages))
        instructions.append(copy(_from=_from, src=self.prefix,
                                 dest=self.prefix))
        instructions.append(environment(
            variables=self.__environment_variables))
        return '\n'.join(str(x) for x in instructions)
示例#20
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(fftw, self).__init__(**kwargs)

        self.__baseurl = kwargs.pop('baseurl', 'ftp://ftp.fftw.org/pub/fftw')
        self.__check = kwargs.pop('check', False)
        self.__configure_opts = kwargs.pop('configure_opts', [])
        self.__directory = kwargs.pop('directory', '')
        self.__mpi = kwargs.pop('mpi', False)
        self.__ospackages = kwargs.pop('ospackages', ['file', 'make', 'wget'])
        self.__prefix = kwargs.pop('prefix', '/usr/local/fftw')
        self.__version = kwargs.pop('version', '3.3.8')

        # Set the configure options
        self.__configure()

        # Set the environment variables
        if not self.ldconfig:
            self.environment_variables[
                'LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(
                    posixpath.join(self.__prefix, 'lib'))

        # Setup build configuration
        self.__bb = generic_autotools(
            annotations={'version': self.__version},
            base_annotation=self.__class__.__name__,
            check=self.__check,
            configure_opts=self.__configure_opts,
            comment=False,
            devel_environment=self.environment_variables,
            # PGI compiler needs a larger stack size
            postconfigure=['ulimit -s unlimited'] if self.__check else None,
            prefix=self.__prefix,
            runtime_environment=self.environment_variables,
            url='{0}/fftw-{1}.tar.gz'.format(self.__baseurl, self.__version),
            **kwargs)

        # Container instructions
        self += comment('FFTW version {}'.format(self.__version))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#21
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(openblas, self).__init__(**kwargs)

        self.__baseurl = kwargs.pop(
            'baseurl', 'https://github.com/xianyi/OpenBLAS/archive')
        self.__make_opts = kwargs.pop('make_opts',
                                      [])  # Filled in by __cpu_arch()
        self.__ospackages = kwargs.pop('ospackages',
                                       ['make', 'perl', 'tar', 'wget'])
        self.__prefix = kwargs.pop('prefix', '/usr/local/openblas')
        self.__toolchain = kwargs.pop('toolchain', toolchain())
        self.__version = kwargs.pop('version', '0.3.10')

        # Set the make options
        self.__make()

        # Setup the environment variables
        if not self.ldconfig:
            self.environment_variables[
                'LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(
                    posixpath.join(self.__prefix, 'lib'))

        # Setup build configuration
        self.__bb = generic_build(
            annotations={'version': self.__version},
            base_annotation=self.__class__.__name__,
            build=['make {}'.format(' '.join(self.__make_opts))],
            comment=False,
            directory='OpenBLAS-{}'.format(self.__version),
            devel_environment=self.environment_variables,
            install=['make install PREFIX={}'.format(self.__prefix)],
            prefix=self.__prefix,
            runtime_environment=self.environment_variables,
            url='{0}/v{1}.tar.gz'.format(self.__baseurl, self.__version),
            **kwargs)

        # Container instructions
        self += comment('OpenBLAS version {}'.format(self.__version))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#22
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        g = gnu(...)
        Stage0 += g
        Stage1 += g.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('GNU compiler runtime'))
        if self.__source:
            instructions.append(
                copy(_from=_from,
                     dest=posixpath.join(self.prefix, 'lib64'),
                     src=posixpath.join(self.prefix, 'lib64')))
            if self.ldconfig:
                instructions.append(
                    shell(commands=[
                        self.ldcache_step(
                            directory=posixpath.join(self.prefix, 'lib64'))
                    ]))
            else:
                instructions.append(
                    environment(
                        variables={
                            'LD_LIBRARY_PATH':
                            '{}:$LD_LIBRARY_PATH'.format(
                                posixpath.join(self.prefix, 'lib64'))
                        }))
        else:
            instructions.append(
                packages(
                    apt=self.__runtime_debs,
                    apt_ppas=self.__extra_repo_apt,
                    scl=bool(self.__version),  # True / False
                    yum=self.__runtime_rpms))

        return '\n'.join(str(x) for x in instructions)
示例#23
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples
        ```python
        c = catalyst(...)
        Stage0 += c
        Stage1 += c.runtime()
        ```
        """
        self.rt += comment('ParaView Catalyst')
        if self.__runtime_ospackages:
            self.rt += packages(ospackages=self.__runtime_ospackages)
        self.rt += copy(_from=_from, src=self.prefix, dest=self.prefix)
        if self.ldconfig:
            self.rt += shell(commands=[self.ldcache_step(
                directory=posixpath.join(self.prefix, 'lib'))])
        self.rt += environment(variables=self.environment_step())
        return str(self.rt)
示例#24
0
    def __str__(self):
        """String representation of the building block"""

        instructions = []
        if self.directory:
            instructions.append(comment('OpenMPI'))
        else:
            instructions.append(
                comment('OpenMPI version {}'.format(self.version)))
        instructions.append(packages(ospackages=self.__ospackages))
        if self.directory:
            # Use source from local build context
            instructions.append(
                copy(src=self.directory,
                     dest=os.path.join(self.__wd, self.directory)))
        instructions.append(shell(commands=self.__commands))
        instructions.append(
            environment(variables=self.__environment_variables))

        return '\n'.join(str(x) for x in instructions)
    def __instructions(self):
        """Fill in container instructions"""

        self += comment('Intel Parallel Studio XE')
        self += packages(ospackages=self.__ospackages)
        self += copy(src=self.__tarball,
                     dest=posixpath.join(self.__wd, self.__tarball_name))
        if self.__license and not '@' in self.__license:
            # License file
            self += copy(src=self.__license,
                         dest=posixpath.join(self.__wd, 'license.lic'))
        self += shell(commands=self.__commands)

        if self.__psxevars:
            # Source the mpivars environment script when starting the
            # container, but the variables not be available for any
            # subsequent build steps.
            self += shell(commands=['echo "source {0}/compilers_and_libraries/linux/bin/compilervars.sh intel64" >> {1}'.format(self.__prefix, self.__bashrc)])
        else:
            self += environment(variables=self.environment_step())
    def __instructions_runfile(self):
        """Fill in container instructions"""

        pkg = os.path.basename(self.__runfile)

        install_cmds = [
            'sh ./{} --nox11 -- -noprompt -targetpath={}'.format(
                pkg, self.__prefix)
        ]

        # Commands needed to predeploy target-specific files. When
        # connecting through the GUI on another machine to the
        # container, this removes the need to copy the files over.
        install_cmds += [
            'mkdir -p /tmp/var/target',
            'ln -sf {}/target/* /tmp/var/target'.format(self.__prefix),
            'ln -sf {}/sections /tmp/var/'.format(self.__prefix),
            'chmod -R a+w /tmp/var'
        ]

        kwargs = {}
        if self.__runfile.strip().startswith(('http://', 'https://')):
            kwargs['url'] = self.__runfile
        else:
            kwargs['package'] = self.__runfile

        self.__bb = generic_build(
            annotations={'runfile': pkg},
            base_annotation=self.__class__.__name__,
            comment = False,
            devel_environment={'PATH': '{}:$PATH'.format(self.__prefix)},
            directory=self.__wd,
            install=install_cmds,
            unpack=False,
            wd=self.__wd,
            **kwargs
        )

        self += comment('NVIDIA Nsight Compute {}'.format(pkg), reformat=False)
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#27
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(slurm_pmi2, self).__init__(**kwargs)

        self.__baseurl = kwargs.pop('baseurl',
                                    'https://download.schedmd.com/slurm')
        self.__environment = kwargs.pop('environment', False)
        self.__ospackages = kwargs.pop(
            'ospackages', ['bzip2', 'file', 'make', 'perl', 'tar', 'wget'])
        self.__prefix = kwargs.pop('prefix', '/usr/local/slurm-pmi2')
        self.__version = kwargs.pop('version', '20.02.5')

        # Setup the environment variables
        self.environment_variables['CPATH'] = '{}:$CPATH'.format(
            posixpath.join(self.__prefix, 'include', 'slurm'))
        if not self.ldconfig:
            self.environment_variables[
                'LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(
                    posixpath.join(self.__prefix, 'lib'))

        # Setup build configuration
        self.__bb = generic_autotools(
            annotations={'version': self.__version},
            base_annotation=self.__class__.__name__,
            comment=False,
            devel_environment=self.environment_variables,
            environment=self.__environment,
            install=False,
            make=False,
            postconfigure=['make -C contribs/pmi2 install'],
            prefix=self.__prefix,
            runtime_environment=self.environment_variables,
            url='{0}/slurm-{1}.tar.bz2'.format(self.__baseurl, self.__version),
            **kwargs)

        # Container instructions
        self += comment('SLURM PMI2 version {}'.format(self.__version))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb
示例#28
0
    def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples
        ```python
        o = openmpi(...)
        Stage0 += o
        Stage1 += o.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('OpenMPI'))
        instructions.append(packages(ospackages=self.__runtime_ospackages))
        instructions.append(copy(_from=_from, src=self.prefix,
                                 dest=self.prefix))
        if self.ldconfig:
            instructions.append(shell(
                commands=[self.ldcache_step(
                    directory=posixpath.join(self.prefix, 'lib'))]))
        instructions.append(environment(variables=self.environment_step()))
        return '\n'.join(str(x) for x in instructions)
示例#29
0
    def __str__(self):
        """String representation of the building block"""

        instructions = []

        comments = ['NetCDF version {}'.format(self.__version)]
        if self.__cxx:
            comments.append('NetCDF C++ version {}'.format(self.__version_cxx))
        if self.__fortran:
            comments.append('NetCDF Fortran version {}'.format(
                self.__version_fortran))
        instructions.append(comment(', '.join(comments)))

        if self.__ospackages:
            instructions.append(packages(ospackages=self.__ospackages))

        instructions.append(shell(commands=self.__commands))

        instructions.append(
            environment(variables=self.__environment_variables))

        return '\n'.join(str(x) for x in instructions)
示例#30
0
    def __init__(self, **kwargs):
        """Initialize building block"""

        super(cgns, self).__init__(**kwargs)

        self.__baseurl = kwargs.pop('baseurl', 'https://github.com/CGNS/CGNS/archive')
        self.__check = kwargs.pop('check', False)
        self.__configure_opts = kwargs.pop('configure_opts',
                                           ['--with-hdf5=/usr/local/hdf5',
                                            '--with-zlib'])
        self.__ospackages = kwargs.pop('ospackages', [])
        self.__prefix = kwargs.pop('prefix', '/usr/local/cgns')
        self.__toolchain = kwargs.pop('toolchain', toolchain())
        self.__version = kwargs.pop('version', '4.1.2')

        # Set the configuration options
        self.__configure()

        # Set the Linux distribution specific parameters
        self.__distro()

        # Setup build configuration
        self.__bb = generic_autotools(
            annotations={'version': self.__version},
            base_annotation=self.__class__.__name__,
            check=self.__check,
            comment=False,
            configure_opts=self.__configure_opts,
            directory=posixpath.join('CGNS-{}'.format(self.__version), 'src'),
            prefix=self.__prefix,
            toolchain=self.__toolchain,
            url='{0}/v{1}.tar.gz'.format(self.__baseurl, self.__version),
            **kwargs)

        # Container instructions
        self += comment('CGNS version {}'.format(self.__version))
        self += packages(ospackages=self.__ospackages)
        self += self.__bb