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.__toolchain = kwargs.pop('toolchain', toolchain()) 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')) # Since gdrcopy does not use autotools or CMake, the toolchain # requires special handling. make_opts = vars(self.__toolchain) if 'CFLAGS' in make_opts: # CFLAGS is derived from COMMONCFLAGS, so rename. See # https://github.com/NVIDIA/gdrcopy/blob/master/src/Makefile#L9 make_opts['COMMONCFLAGS'] = make_opts.pop('CFLAGS') make_opts['PREFIX'] = self.__prefix make_opts_str = ' '.join([ '{0}={1}'.format(key, shlex_quote(value)) for key, value in sorted(make_opts.items()) ]) # 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 {} lib lib_install'.format(make_opts_str) ], comment=False, devel_environment=self.environment_variables, directory='gdrcopy-{}'.format(self.__version), libdir='lib64', prefix=self.__prefix, runtime_environment=self.environment_variables, url='{0}/v{1}.tar.gz'.format(self.__baseurl, self.__version), **kwargs) # Container instructions self += comment('GDRCOPY version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb
def __str__(self): """String representation of the building block""" instructions = [] instructions.append( comment('Intel MPI 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/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-2019.PUB' ], 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. instructions.append( shell(commands=[ 'echo "source /opt/intel/compilers_and_libraries/linux/mpi/bin64/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. instructions.append( environment( variables={ 'I_MPI_ROOT': '/opt/intel/compilers_and_libraries/linux/mpi', 'LD_LIBRARY_PATH': '/opt/intel/compilers_and_libraries/linux/mpi/lib64:$LD_LIBRARY_PATH', 'PATH': '/opt/intel/compilers_and_libraries/linux/mpi/bin64:$PATH' })) 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: if self.__comment: if self.url: self.rt += comment(self.url, reformat=False) elif self.repository: self.rt += comment(self.repository, reformat=False) if self.__runtime: for src in self.__runtime: if '*' in posixpath.basename(src): # When using COPY with more than one source file, # the destination must be a directory and end with # a / dest = posixpath.dirname(src) + '/' else: dest = src self.rt += copy(_from=_from, src=src, dest=dest) else: # Copy the entire prefix 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, self.__libdir))]) if self.runtime_environment_variables: self.rt += environment( variables=self.environment_step(runtime=True)) if self.annotate: self.rt += label(metadata=self.annotate_step()) return str(self.rt) else: # pragma: no cover return
def __str__(self): """String representation of the building block""" instructions = [] instructions.append(comment( 'CMake version {}'.format(self.__version))) instructions.append(packages(ospackages=self.__ospackages)) instructions.append(shell(commands=self.__commands)) return '\n'.join(str(x) for x in instructions)
def runtime(self, _from='0'): p = python(devel=True, python2=False) instructions = [ comment(__doc__, reformat=False), p.runtime(), shell(commands=['mkdir -p /apps /scratch /lustre /work /projects']) ] return '\n'.join(str(x) for x in instructions)
def runtime(self, _from='0'): """Install the runtime from a full build in a previous stage""" instructions = [] instructions.append(comment('Boost')) 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)
def __instructions(self): """Fill in container instructions""" self += comment('Anaconda') self += packages(ospackages=self.__ospackages) if self.__environment: self += copy(src=self.__environment, dest=posixpath.join( self.__wd, posixpath.basename(self.__environment))) self += shell(commands=self.__commands)
def __init__(self, **kwargs): """Initialize building block""" super(kokkos, self).__init__(**kwargs) self.__arch = kwargs.pop('arch', ['VOLTA70']) self.__baseurl = kwargs.pop( 'baseurl', 'https://github.com/kokkos/kokkos/archive') self.__check = kwargs.pop('check', False) self.__cmake_opts = kwargs.pop('cmake_opts', ['-DCMAKE_BUILD_TYPE=RELEASE']) self.__cuda = kwargs.pop('cuda', True) self.__default_repository = 'https://github.com/kokkos/kokkos.git' self.__hwloc = kwargs.pop('hwloc', True) self.__ospackages = kwargs.pop('ospackages', []) self.__powertools = False # enable the CentOS PowerTools repo self.__prefix = kwargs.pop('prefix', '/usr/local/kokkos') self.__version = kwargs.pop('version', '3.2.00') if self.repository: self.__directory = '' else: self.__directory = kwargs.pop('directory', 'kokkos-{}'.format(self.__version)) # Set the CMake options self.__cmake() # Set the Linux distribution specific parameters self.__distro() # Set the download specific parameters self.__download() kwargs['repository'] = self.repository kwargs['url'] = self.url # Setup the environment variables self.environment_variables['PATH'] = '{}/bin:$PATH'.format( self.__prefix) # Setup build configuration self.__bb = generic_cmake( annotations={'version': self.__version}, base_annotation=self.__class__.__name__, cmake_opts=self.__cmake_opts, comment=False, devel_environment=self.environment_variables, directory=self.__directory, prefix=self.__prefix, runtime_environment=self.environment_variables, **kwargs) # Container instructions self += comment('Kokkos version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages, powertools=self.__powertools) self += self.__bb
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)
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())
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 = pgi(...) Stage0 += p Stage1 += p.runtime() ``` """ instructions = [] instructions.append(comment('PGI compiler')) if self.__runtime_ospackages: instructions.append(packages(ospackages=self.__runtime_ospackages)) pgi_path = posixpath.join(self.__basepath, self.__version) src_path = pgi_path if (LooseVersion(self.__version) >= LooseVersion('19.4') and hpccm.config.g_cpu_arch == cpu_arch.X86_64): # Too many levels of symlinks for the Docker builder to # handle, so use the real path src_path = posixpath.join(self.__basepath_llvm, self.__version) instructions.append(copy(_from=_from, src=posixpath.join(src_path, 'REDIST', '*.so*'), dest=posixpath.join(pgi_path, 'lib', ''))) # REDIST workaround for incorrect libcudaforwrapblas.so # symlink if (LooseVersion(self.__version) >= LooseVersion('18.10') and LooseVersion(self.__version) < LooseVersion('19.10') and hpccm.config.g_cpu_arch == cpu_arch.X86_64): instructions.append( copy(_from=_from, src=posixpath.join(pgi_path, 'lib', 'libcudaforwrapblas.so'), dest=posixpath.join(pgi_path, 'lib', 'libcudaforwrapblas.so'))) if self.__mpi: mpi_path = posixpath.join(pgi_path, 'mpi', 'openmpi') if LooseVersion(self.__version) >= LooseVersion('19.4'): mpi_path = posixpath.join(pgi_path, 'mpi', 'openmpi-3.1.3') instructions.append(copy(_from=_from, src=mpi_path, dest=mpi_path)) if self.__runtime_commands: instructions.append(shell(commands=self.__runtime_commands)) instructions.append(environment(variables=self.environment_step( runtime=True))) return '\n'.join(str(x) for x in instructions)
def __instructions(self): """Fill in container instructions""" self += comment('CMake version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += shell(commands=self.__commands) self += environment( variables={ 'PATH': '{}:$PATH'.format(posixpath.join(self.__prefix, 'bin')) })
def __instructions(self): """Fill in container instructions""" self += comment('Python') self += packages(apt=self.__debs, yum=self.__rpms) if self.__alternatives: alternatives = ['alternatives --set python /usr/bin/python2'] if self.__devel: alternatives.append('alternatives --install /usr/bin/python-config python-config /usr/bin/python2-config 30') self += shell(commands=alternatives)
def __str__(self): """String representation of the building block""" instructions = [] instructions.append(comment('XPMEM branch {}'.format(self.__branch))) 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)
def runtime(self, _from='0'): """Runtime specification""" instructions = [] instructions.append(comment('GNU compiler runtime')) 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)
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 __init__(self, **kwargs): """Initialize building block""" super(mpich, self).__init__(**kwargs) self.__baseurl = kwargs.pop('baseurl', 'https://www.mpich.org/static/downloads') self.__check = kwargs.pop('check', False) self.__configure_opts = kwargs.pop('configure_opts', []) self.__ospackages = kwargs.pop('ospackages', []) self.__prefix = kwargs.pop('prefix', '/usr/local/mpich') self.__runtime_ospackages = [] # Filled in by __distro() # Input toolchain, i.e., what to use when building self.__toolchain = kwargs.pop('toolchain', toolchain()) self.__version = kwargs.pop('version', '3.3.2') # Output toolchain self.toolchain = toolchain(CC='mpicc', CXX='mpicxx', F77='mpif77', F90='mpif90', FC='mpifort') # Set the configuration options self.__configure() # Set the Linux distribution specific parameters self.__distro() # Set the environment variables 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, configure_opts=self.__configure_opts, devel_environment=self.environment_variables, # Run test suite (must be after install) postinstall=['cd /var/tmp/mpich-{}'.format(self.__version), 'RUNTESTS_SHOWPROGRESS=1 make testing'] if self.__check else None, prefix=self.__prefix, runtime_environment=self.environment_variables, toolchain=self.__toolchain, url='{0}/{1}/mpich-{1}.tar.gz'.format(self.__baseurl, self.__version), **kwargs) # Container instructions self += comment('MPICH version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb
def __instructions(self): """Fill in container instructions""" self += comment('LLVM compiler') if self.__ospackages: self += packages(ospackages=self.__ospackages) self += packages(apt=self.__compiler_debs, scl=bool(self.__version), # True / False yum=self.__compiler_rpms) if self.__commands: self += shell(commands=self.__commands) self += environment(variables=self.environment_step())
def runtime(self, _from='0'): """Install the runtime from a full build in a previous stage""" instructions = [] instructions.append(comment('Intel Parallel Studio XE')) instructions.append( copy(_from=_from, src=os.path.join(self.__wd, 'intel_psxe_runtime/*'), dest=os.path.join(self.__prefix, 'lib', 'intel64', ''))) instructions.append(environment( variables={'LD_LIBRARY_PATH': '{}:$LD_LIBRARY_PATH'.format( os.path.join(self.__prefix, 'lib', 'intel64'))})) return '\n'.join(str(x) for x in instructions)
def runtime(self, _from='0'): instructions = [] instructions.append( comment('OSU benchmarks version {}'.format(self.__version))) instructions.append( copy(_from=_from, src=self.prefix, dest=self.prefix)) if self.__environment_variables: instructions.append( environment(variables=self.__environment_variables)) if self.__labels: instructions.append(label(metadata=self.__labels)) return '\n'.join(str(x) for x in instructions)
def __instructions(self): """Fill in container instructions""" self += comment('GNU compiler') self += packages( apt=self.__compiler_debs, apt_ppas=self.__extra_repo_apt, scl=bool(self.__version), # True / False yum=self.__compiler_rpms) if self.__commands: self += shell(commands=self.__commands) if self.__environment: self += environment(variables=self.__environment)
def runtime(self, _from='0'): instructions = [ comment('OpenGeoSys build from repo {0}, branch {1}'.format( self.__repo, self.__branch)), copy(_from=_from, src=self.__prefix, dest=self.__prefix) ] if self.__environment_variables: instructions.append( environment(variables=self.__environment_variables)) if self.__labels: instructions.append(label(metadata=self.__labels)) 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.__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)) return '\n'.join(str(x) for x in instructions)
def __str__(self): """String representation of the building block""" instructions = [] instructions.append(comment('LLVM compiler')) instructions.append(packages(apt=self.__compiler_debs, scl=bool(self.__version), # True / False yum=self.__compiler_rpms)) if self.__commands: instructions.append(shell(commands=self.__commands)) if self.__environment: instructions.append(environment(variables=self.__environment)) return '\n'.join(str(x) for x in instructions)
def __str__(self): """String representation of the building block""" instructions = [] instructions.append( comment('ParaView Catalyst version {}'.format(self.__version))) instructions.append(packages(ospackages=self.__ospackages)) instructions.append(shell(commands=self.__commands)) 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'): """Install the runtime from a full build in a previous stage""" 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)
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) self += shell(commands=self.__commands) self += environment(variables=self.environment_step())
def __instructions(self): """Fill in container instructions""" self += comment('Arm Allinea Studio version {}'.format(self.__version)) if self.__ospackages: self += packages(ospackages=self.__ospackages) if self.__tarball: self += copy(src=self.__tarball, dest=self.__wd) self += shell(commands=self.__commands) self += environment(variables=self.environment_step())
def __instructions(self): self += comment('OpenGeoSys build from repo {0}, branch {1}'.format( self.__repo, self.__branch)) self += packages(ospackages=self.__ospackages) self += shell( commands=self.__commands, _arguments='--mount=type=bind,target=/scif/apps/ogs/src,rw') self += runscript(commands=['ogs']) if self.__environment_variables: self += environment(variables=self.__environment_variables) if self.__labels: self += label(metadata=self.__labels)
def __instructions(self): """Fill in container instructions""" self += comment('Intel Parallel Studio XE') self += packages(ospackages=self.__ospackages) self += copy(src=self.__tarball, dest=os.path.join(self.__wd, self.__tarball_name)) if self.__license and not '@' in self.__license: # License file self += copy(src=self.__license, dest=os.path.join(self.__wd, 'license.lic')) self += shell(commands=self.__commands) self += environment(variables=self.__environment_variables)