예제 #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
        k = kokkos(...)
        Stage0 += k
        Stage1 += k.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('Kokkos'))
        instructions.append(
            copy(_from=_from, src=self.__prefix, dest=self.__prefix))
        instructions.append(environment(variables=self.environment_step()))
        return '\n'.join(str(x) for x in instructions)
예제 #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)
        if self.__environment_variables:
            self += environment(variables=self.__environment_variables)
예제 #3
0
    def __instructions(self):
        """Fill in container instructions"""

        if self.__comment:
            if self.url:
                self += comment(self.url, reformat=False)
            elif self.repository:
                self += comment(self.repository, reformat=False)
            elif self.package:
                self += comment(self.package, reformat=False)
        if self.package:
            self += copy(src=self.package,
                         dest=posixpath.join(self.__wd,
                                             os.path.basename(self.package)))
        self += shell(_arguments=self.__run_arguments,
                      commands=self.__commands)
        self += environment(variables=self.environment_step())
        self += label(metadata=self.annotate_step())
예제 #4
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)

        if self.__environment_variables:
            self += environment(variables=self.__environment_variables)
예제 #5
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()
        ```
        """
        instructions = []
        instructions.append(comment('PnetCDF'))
        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)
예제 #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
        n = nvshmem(...)
        Stage0 += n
        Stage1 += n.runtime()
        ```
        """
        self.rt += comment('NVSHMEM')
        if self.__binary_tarball:
            self.rt += copy(_from=_from, src=self.__prefix, dest=self.__prefix)
            self.rt += environment(variables=self.environment_step())
        else:
            self.rt += self.__bb.runtime(_from=_from)
        return str(self.rt)
예제 #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
        n = nccl(...)
        Stage0 += n
        Stage1 += n.runtime()
        ```
        """
        self.rt += comment('NCCL')
        if self.__build:
            self.rt += copy(_from=_from, src=self.__prefix, dest=self.__prefix)
            self.rt += environment(variables=self.environment_step())
        else:
            self.rt += packages(ospackages=self.__ospackages)
            self.rt += packages(
                apt=[
                    'libnccl2={0}+cuda{1}'.format(self.__version, self.__cuda)
                ],
                apt_keys=[
                    'https://developer.download.nvidia.com/compute/machine-learning/repos/{0}/{1}/7fa2af80.pub'
                    .format(self.__distro_label, get_cpu_architecture())
                ],
                apt_repositories=[
                    'deb https://developer.download.nvidia.com/compute/machine-learning/repos/{0}/{1} /'
                    .format(self.__distro_label, get_cpu_architecture())
                ],
                yum=[
                    'libnccl-{0}+cuda{1}'.format(self.__version, self.__cuda)
                ],
                yum_keys=[
                    'https://developer.download.nvidia.com/compute/machine-learning/repos/{0}/{1}/7fa2af80.pub'
                    .format(self.__distro_label, get_cpu_architecture())
                ],
                yum_repositories=[
                    'https://developer.download.nvidia.com/compute/machine-learning/repos/{0}/{1}'
                    .format(self.__distro_label, get_cpu_architecture())
                ])

        return str(self.rt)
예제 #8
0
def build(container_format='singularity',
          gnu_version='9',
          fermi_lite_version='0.1',
          macs_version='3.0.0a5'):
    image = 'ubuntu:20.04'
    config.set_container_format(container_format)
    stage0 = Stage(name='stage0')
    stage0 += baseimage(image=image, _bootstrap='docker')
    stage0 += label(metadata={
        'maintainer': 'Luhan Cheng',
        'email': '*****@*****.**'
    })
    stage0 += packages(apt=[
        'wget', 'software-properties-common', 'build-essential', 'git',
        'python-dev', 'zlib1g-dev'
    ])
    compilers = gnu(version=gnu_version)
    stage0 += compilers
    stage0 += generic_build(repository='https://github.com/lh3/fermi-lite',
                            branch=f'v{fermi_lite_version}',
                            build=['make'],
                            install=[
                                'mkdir -p /usr/local/fermi_lite/',
                                'mv * /usr/local/fermi_lite/'
                            ],
                            toolchain=compilers.toolchain)
    stage0 += environment(
        variables={
            'PATH': '/usr/local/fermi_lite/:/usr/local/anaconda/bin:$PATH',
            'LIBRARY_PATH': '/usr/local/fermi_lite/:$LIBRARY_PATH',
            'C_INCLUDE_PATH': '/usr/local/fermi_lite/:$C_INCLUDE_PATH'
        })
    stage0 += conda(packages=['python=3.8', 'numpy', 'cython', 'cykhash'],
                    channels=['anaconda', 'conda-forge'],
                    eula=True)
    stage0 += generic_build(
        repository='https://github.com/macs3-project/MACS.git',
        recursive=True,
        branch=f'v{macs_version}',
        build=['python3 setup.py install'],
    )

    return stage0
예제 #9
0
    def __instructions(self):
        """Fill in container instructions"""

        self += comment('Intel Parallel Studio XE runtime version {}'.format(self.__version))

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

        if not self.__eula:
            raise RuntimeError('Intel EULA was not accepted.  To accept, see the documentation for this building block')

        # The APT keys expired and had to be reissued.  They were only
        # reissued for 2019 and later.  Blindly (and insecurely!) trust
        # the 2018 and earlier repositories.
        if int(self.__year) >= 2019:
            apt_keys = ['https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-{}.PUB'.format(self.__year)]
            apt_repositories = ['deb https://apt.repos.intel.com/{0} intel-psxe-runtime main'.format(self.__year)]
        else:
            apt_keys = ['https://apt.repos.intel.com/{0}/GPG-PUB-KEY-INTEL-PSXE-RUNTIME-{0}'.format(self.__year)]
            apt_repositories = ['deb [trusted=yes] https://apt.repos.intel.com/{0} intel-psxe-runtime main'.format(self.__year)]

        self += packages(
            apt=self.__apt,
            apt_keys=apt_keys,
            apt_repositories=apt_repositories,
            aptitude=True,
            yum=self.__yum,
            yum_keys=['https://yum.repos.intel.com/{0}/setup/RPM-GPG-KEY-intel-psxe-runtime-{0}'.format(self.__year)],
            yum_repositories=['https://yum.repos.intel.com/{0}/setup/intel-psxe-runtime-{0}.repo'.format(self.__year)],
            yum4=True)

        # Set the environment
        if self.__psxevars:
            # Source the psxevars environment script when starting the
            # container, but the variables not be available for any
            # subsequent build steps.
            self += shell(commands=['echo "source /opt/intel/psxe_runtime/linux/bin/psxevars.sh intel64" >> {}'.format(self.__bashrc)])
        else:
            # Set the environment so that it will be available to
            # subsequent build steps and when starting the container,
            # but this may miss some things relative to the psxevars
            # environment script.
            self += environment(variables=self.environment_step())
예제 #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.

        # 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)
예제 #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.

        # Example

        ```python
        c = charm(...)
        Stage0 += c
        Stage1 += c.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('Charm++'))
        instructions.append(copy(_from=_from, src=self.__installdir,
                                 dest=self.__installdir))
        instructions.append(environment(
            variables=self.__environment_variables))
        return '\n'.join(str(x) for x in instructions)
예제 #12
0
    def __instructions(self):
        """Fill in container instructions"""

        self += comment('NVIDIA HPC SDK version {}'.format(self.__version))

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

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

        if self.package or self.__tarball or self.__url:
            # tarball install
            self += shell(commands=self.__commands)
        else:
            # repository install
            self += packages(
                apt_repositories=['deb [trusted=yes] https://developer.download.nvidia.com/hpc-sdk/ubuntu/{} /'.format(self.__arch_label)],
                ospackages=[self.__nvhpc_package],
                yum_repositories=['https://developer.download.nvidia.com/hpc-sdk/rhel/nvhpc.repo'])

        if self.__toolchain:
            # Regenerate the localrc using the compilers from the specified
            # toolchain
            compiler_bin = posixpath.join(self.__basepath, 'compilers', 'bin')

            args = ['-x']
            if self.__toolchain.CC:
                args.append('-gcc {}'.format(self.__toolchain.CC))
            if self.__toolchain.CXX:
                args.append('-gpp {}'.format(self.__toolchain.CXX))
            if self.__toolchain.F77:
                args.append('-g77 {}'.format(self.__toolchain.F77))

            self += shell(commands=['{0} {1} {2}'.format(
                posixpath.join(compiler_bin, 'makelocalrc'), compiler_bin,
                ' '.join(args))])

        self += environment(variables=self.environment_step())
예제 #13
0
    def __instructions(self):
        """Fill in container instructions"""

        self += comment('Intel MPI version {}'.format(self.__version))

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

        if not self.__eula:
            raise RuntimeError('Intel EULA was not accepted.  To accept, see the documentation for this building block')

        self += packages(
            apt_keys=['https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-{}.PUB'.format(self.__year)],
            apt_repositories=['deb https://apt.repos.intel.com/mpi all main'],
            ospackages=['intel-mpi-{}'.format(self.__version)],
            yum_keys=['https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-{}.PUB'.format(self.__year)],
            yum_repositories=['https://yum.repos.intel.com/mpi/setup/intel-mpi.repo'])

        # Set the environment
        if self.__mpivars:
            # 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 /opt/intel/compilers_and_libraries/linux/mpi/intel64/bin/mpivars.sh intel64" >> {}'.format(self.__bashrc)])
        else:
            # Set the environment so that it will be available to
            # subsequent build steps and when starting the container,
            # but this may miss some things relative to the mpivars
            # environment script.
            if LooseVersion(self.__version) >= LooseVersion('2019.0'):
              self.environment_variables={
                  'FI_PROVIDER_PATH': '/opt/intel/compilers_and_libraries/linux/mpi/intel64/libfabric/lib/prov',
                  'I_MPI_ROOT': '/opt/intel/compilers_and_libraries/linux/mpi',
                  'LD_LIBRARY_PATH': '/opt/intel/compilers_and_libraries/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries/linux/mpi/intel64/libfabric/lib:$LD_LIBRARY_PATH',
                  'PATH': '/opt/intel/compilers_and_libraries/linux/mpi/intel64/bin:/opt/intel/compilers_and_libraries/linux/mpi/intel64/libfabric/bin:$PATH'}
            else:
              self.environment_variables={
                  'I_MPI_ROOT': '/opt/intel/compilers_and_libraries/linux/mpi',
                  'LD_LIBRARY_PATH': '/opt/intel/compilers_and_libraries/linux/mpi/intel64/lib:$LD_LIBRARY_PATH',
                  'PATH': '/opt/intel/compilers_and_libraries/linux/mpi/intel64/bin:$PATH'}

            self += environment(variables=self.environment_step())
예제 #14
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)
예제 #15
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)
예제 #16
0
    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())
예제 #17
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)
예제 #18
0
    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
        self += environment(variables=self.environment_variables)
예제 #19
0
    def test_allsections_docker(self):
        """One of each SCI-f section type"""
        # See comment in the test_defaults_docker test case
        scif_file = tempfile.NamedTemporaryFile(delete=False, suffix='.scif')
        s = scif(name='foo', file=scif_file.name)
        s += copy(src='file', dest='/tmp/file')
        s += comment('My app')
        s += environment(variables={'ONE': '1'})
        s += label(metadata={'A': 'B'})
        s += runscript(commands=['default_program'])
        s += shell(commands=['build_cmds'])
        s += shell(commands=['test_program'], _test=True)

        str(s)  # Force writing the SCI-F recipe file

        # slurp file content
        with open(scif_file.name) as f:
            content = f.read()
        os.unlink(scif_file.name)

        self.assertEqual(
            content, r'''%appenv foo
    export ONE=1

%appfiles foo
    file /tmp/file

%apphelp foo
My app

%appinstall foo
    build_cmds

%applabels foo
    A B

%apprun foo
    exec default_program "$@"

%apptest foo
    test_program''')
예제 #20
0
    def __instructions(self):
        self += comment(__doc__, reformat=False)
        # https://github.com/bincrafters/community/issues/880
        self += packages(ospackages=['pkg-config'])
        # For building curl:
        self += packages(ospackages=['autoconf-archive', 'libtool'])
        conan_version = "1.22.2"

        self += pip(pip='pip3', packages=['conan=={}'.format(conan_version)])
        self += shell(commands=self.__commands)
        if self.__user_home != '':
            self += environment(
                variables={'CONAN_USER_HOME': self.__user_home})
        self += label(
            metadata={
                'org.opengeosys.pm': 'conan',
                'org.opengeosys.pm.conan.version': conan_version
            })
        if self.__user_home != '':
            self += label(metadata={
                'org.opengeosys.pm.conan.user_home': self.__user_home
            })
예제 #21
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 = openblas(...)
        Stage0 += o
        Stage1 += o.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('OpenBLAS'))
        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)
예제 #22
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)
예제 #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
        m = mvapich2_gdr(...)
        Stage0 += m
        Stage1 += m.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('MVAPICH2-GDR'))
        instructions.append(packages(ospackages=self.__runtime_ospackages))
        instructions.append(copy(src=self.__install_path,
                                 dest=self.__install_path, _from=_from))
        # No need to workaround compiler wrapper issue for the runtime.
        # Copy the dictionary so not to modify the original.
        vars = dict(self.__environment_variables)
        del vars['PROFILE_POSTLIB']
        instructions.append(environment(variables=vars))
        return '\n'.join(str(x) for x in instructions)
예제 #24
0
 def runtime(self, _from='0'):
     """Install the runtime from a full build in a previous stage"""
     instructions = []
     instructions.append(comment('PGI compiler'))
     if self.__ospackages:
         instructions.append(packages(ospackages=self.__ospackages))
     instructions.append(
         copy(_from=_from,
              src=os.path.join(self.__basepath, self.__version, 'REDIST',
                               '*.so'),
              dest=os.path.join(self.__basepath, self.__version, 'lib',
                                '')))
     instructions.append(
         shell(commands=[
             'ln -s {0} {1}'.format(
                 os.path.join(self.__basepath, self.__version, 'lib',
                              'libpgnuma.so'),
                 os.path.join(self.__basepath, self.__version, 'lib',
                              'libnuma.so'))
         ]))
     instructions.append(
         environment(variables=self.__environment(runtime=True)))
     return '\n'.join(str(x) for x in instructions)
예제 #25
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 = charm(...)
        Stage0 += c
        Stage1 += c.runtime()
        ```
        """
        self.rt += comment('Charm++')
        self.rt += copy(_from=_from,
                        src=self.__installdir,
                        dest=self.__installdir)
        if self.ldconfig:
            self.rt += shell(commands=[
                self.ldcache_step(
                    directory=posixpath.join(self.__prefix, 'lib_so'))
            ])
        self.rt += environment(variables=self.environment_step())
        return str(self.rt)
예제 #26
0
    def __str__(self):
        """String representation of the building block"""

        instructions = []
        instructions.append(comment('MKL version {}'.format(self.version)))

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

        if not self.__eula:
            raise RuntimeError('Intel EULA was not accepted.  To accept, see the documentation for this building block')

        instructions.append(packages(
            apt_keys=['https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB'],
            apt_repositories=['deb https://apt.repos.intel.com/mkl all main'],
            ospackages=['intel-mkl-64bit-{}'.format(self.version)],
            yum_keys=['https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB'],
            yum_repositories=['https://yum.repos.intel.com/mkl/setup/intel-mkl.repo']))

        # Set the environment
        if self.__mklvars:
            # Source the mklvars environment script when starting the
            # container, but the variables not be available for any
            # subsequent build steps.
            instructions.append(shell(commands=['echo "source /opt/intel/mkl/bin/mklvars.sh intel64" >> {}'.format(self.__bashrc)]))
        else:
            # Set the environment so that it will be available to
            # subsequent build steps and when starting the container,
            # but this may miss some things relative to the mklvars
            # environment script.
            instructions.append(environment(variables={
                'CPATH': '/opt/intel/mkl/include:$CPATH',
                'LD_LIBRARY_PATH': '/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64:$LD_LIBRARY_PATH',
                'LIBRARY_PATH': '/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64:$LIBRARY_PATH',
                'MKLROOT': '/opt/intel/mkl'}))

        return '\n'.join(str(x) for x in instructions)
예제 #27
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 = charm(...)
        Stage0 += c
        Stage1 += c.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('Charm++'))
        instructions.append(copy(_from=_from, src=self.__installdir,
                                 dest=self.__installdir))
        if self.ldconfig:
            instructions.append(shell(
                commands=[self.ldcache_step(
                    directory=posixpath.join(self.__prefix, 'lib_so'))]))
        if self.__environment_variables:
            instructions.append(environment(
                variables=self.__environment_variables))
        return '\n'.join(str(x) for x in instructions)
예제 #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
        m = mpich(...)
        Stage0 += m
        Stage1 += m.runtime()
        ```
        """
        instructions = []
        instructions.append(comment('MPICH'))
        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=os.path.join(self.prefix, 'lib'))]))
        if self.__environment_variables:
            instructions.append(environment(
                variables=self.__environment_variables))
        return '\n'.join(str(x) for x in instructions)
    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 = generic_autotools(...)
        Stage0 += g
        Stage1 += g.runtime()
        ```
        """
        if self.prefix:
            instructions = []
            if self.__comment:
                if self.url:
                    instructions.append(comment(self.url, reformat=False))
                elif self.repository:
                    instructions.append(
                        comment(self.repository, reformat=False))
            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, self.__libdir))
                    ]))
            if self.runtime_environment_variables:
                instructions.append(
                    environment(variables=self.environment_step(runtime=True)))
            if self.annotate:
                instructions.append(label(metadata=self.annotate_step()))
            return '\n'.join(str(x) for x in instructions)
        else:  # pragma: no cover
            return
예제 #30
0
def build(container_format='singularity', os='ubuntu:18.04'):
    image = os
    config.set_container_format(container_format)
    stage0 = Stage(name='stage0')
    stage0 += baseimage(image=image, _bootstrap='docker')
    stage0 += environment(variables={
        'LC_ALL': 'en_AU.UTF-8',
        'LANGUAGE': 'en_AU.UTF-8',
    })
    stage0 += label(metadata={
        'maintainer': 'Luhan Cheng',
        'email': '*****@*****.**'
    })
    stage0 += shell(commands=[
        'rm /usr/bin/sh', 'ln -s /usr/bin/bash /usr/bin/sh', '/usr/bin/bash'
    ])
    stage0 += packages(apt=[
        'wget', 'git', 'software-properties-common', 'build-essential',
        'locales'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += shell(commands=[
        'cd /etc/apt/sources.list.d/',
        'wget http://downloads.perfsonar.net/debian/perfsonar-release.list',
        'wget -qO - http://downloads.perfsonar.net/debian/perfsonar-official.gpg.key | apt-key add -',
        'add-apt-repository -y universe', 'apt-get update'
    ])
    stage0 += packages(apt=[
        'perfsonar-tools', 'perfsonar-testpoint', 'perfsonar-core',
        'perfsonar-centralmanagement', 'perfsonar-toolkit'
    ])
    stage0 += shell(
        commands=['/usr/lib/perfsonar/scripts/install-optional-packages.py'])

    return stage0