def __init__(self, **kwargs): """Initialize building block""" super(pnetcdf, self).__init__(**kwargs) self.__baseurl = kwargs.get( 'baseurl', 'https://parallel-netcdf.github.io/Release') self.__configure_opts = kwargs.pop('configure_opts', ['--enable-shared']) self.__ospackages = kwargs.pop('ospackages', ['m4', 'make', 'tar', 'wget']) self.__prefix = kwargs.pop('prefix', '/usr/local/pnetcdf') self.__runtime_ospackages = [] # Filled in by __distro() self.__toolchain = kwargs.pop( 'toolchain', toolchain(CC='mpicc', CXX='mpicxx', F77='mpif77', F90='mpif90', FC='mpifort')) self.__url = None # Filled in by __download() self.__version = kwargs.get('version', '1.12.1') # Set the Linux distribution specific parameters self.__distro() # Set the download specific parameters self.__download() # 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( comment=False, configure_opts=self.__configure_opts, devel_environment=self.environment_variables, # For some compilers, --enable-shared leads to the following error: # GEN libpnetcdf.la # /usr/bin/ld: .libs/libpnetcdf.lax/libf77.a/strerrnof.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC # .libs/libpnetcdf.lax/libf77.a/strerrnof.o: error adding symbols: Bad value # Apply the workaround postconfigure=[ 'sed -i -e \'s#pic_flag=""#pic_flag=" -fpic -DPIC"#\' -e \'s#wl=""#wl="-Wl,"#\' libtool' ] if '--enable-shared' in self.__configure_opts else None, prefix=self.__prefix, runtime_environment=self.environment_variables, toolchain=self.__toolchain, url=self.__url, **kwargs) # Container instructions self += comment('PnetCDF version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb
def test_ldconfig_and_environment(self): """ldconfig and environment""" g = generic_autotools( devel_environment={ 'CPATH': '/usr/local/zeromq/include:$CPATH', 'PATH': '/usr/local/zeromq/bin:$PATH' }, ldconfig=True, preconfigure=['./autogen.sh'], prefix='/usr/local/zeromq', repository='https://github.com/zeromq/libzmq.git', runtime_environment={'PATH': '/usr/local/zeromq/bin:$PATH'}) self.assertEqual( str(g), r'''# https://github.com/zeromq/libzmq.git RUN mkdir -p /var/tmp && cd /var/tmp && git clone --depth=1 https://github.com/zeromq/libzmq.git libzmq && cd - && \ cd /var/tmp/libzmq && \ ./autogen.sh && \ cd /var/tmp/libzmq && ./configure --prefix=/usr/local/zeromq && \ make -j$(nproc) && \ make -j$(nproc) install && \ echo "/usr/local/zeromq/lib" >> /etc/ld.so.conf.d/hpccm.conf && ldconfig && \ rm -rf /var/tmp/libzmq ENV CPATH=/usr/local/zeromq/include:$CPATH \ PATH=/usr/local/zeromq/bin:$PATH''') r = g.runtime() self.assertEqual( r, r'''# https://github.com/zeromq/libzmq.git COPY --from=0 /usr/local/zeromq /usr/local/zeromq RUN echo "/usr/local/zeromq/lib" >> /etc/ld.so.conf.d/hpccm.conf && ldconfig ENV PATH=/usr/local/zeromq/bin:$PATH''')
def test_runtime(self): """Runtime""" g = generic_autotools( directory='tcl8.6.9/unix', prefix='/usr/local/tcl', url='https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz') r = g.runtime() self.assertEqual(r, r'''# https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz COPY --from=0 /usr/local/tcl /usr/local/tcl''')
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 test_package(self): """local package""" g = generic_autotools(package='packages/openmpi-4.0.1.tar.bz2', prefix='/usr/local/openmpi') self.assertEqual( str(g), r'''# packages/openmpi-4.0.1.tar.bz2 COPY packages/openmpi-4.0.1.tar.bz2 /var/tmp/openmpi-4.0.1.tar.bz2 RUN mkdir -p /var/tmp && tar -x -f /var/tmp/openmpi-4.0.1.tar.bz2 -C /var/tmp -j && \ cd /var/tmp/openmpi-4.0.1 && ./configure --prefix=/usr/local/openmpi && \ make -j$(nproc) && \ make -j$(nproc) install && \ rm -rf /var/tmp/openmpi-4.0.1 /var/tmp/openmpi-4.0.1.tar.bz2''')
def __init__(self, **kwargs): """Initialize building block""" super(hdf5, self).__init__(**kwargs) self.__baseurl = kwargs.pop( 'baseurl', 'http://www.hdfgroup.org/ftp/HDF5/releases') self.__check = kwargs.pop('check', False) self.__configure_opts = kwargs.pop( 'configure_opts', ['--enable-cxx', '--enable-fortran']) self.__ospackages = kwargs.pop('ospackages', []) self.__prefix = kwargs.pop('prefix', '/usr/local/hdf5') self.__runtime_ospackages = [] # Filled in by __distro() self.__version = kwargs.pop('version', '1.10.6') # Set the Linux distribution specific parameters self.__distro() # Set the download specific parameters self.__download() # Set the environment variables self.environment_variables['CPATH'] = '{}:$CPATH'.format( posixpath.join(self.__prefix, 'include')) self.environment_variables['HDF5_DIR'] = self.__prefix self.environment_variables['LIBRARY_PATH'] = '{}:$LIBRARY_PATH'.format( posixpath.join(self.__prefix, 'lib')) 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, configure_opts=self.__configure_opts, comment=False, devel_environment=self.environment_variables, prefix=self.__prefix, runtime_environment=self.environment_variables, url=self.__url, **kwargs) # Container instructions self += comment('HDF5 version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb
def test_defaults_ubuntu(self): """Default generic_autotools building block""" g = generic_autotools( directory='tcl8.6.9/unix', prefix='/usr/local/tcl', url='https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz') self.assertEqual(str(g), r'''# https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz && \ mkdir -p /var/tmp && tar -x -f /var/tmp/tcl8.6.9-src.tar.gz -C /var/tmp -z && \ cd /var/tmp/tcl8.6.9/unix && ./configure --prefix=/usr/local/tcl && \ make -j$(nproc) && \ make -j$(nproc) install && \ rm -rf /var/tmp/tcl8.6.9/unix /var/tmp/tcl8.6.9-src.tar.gz''')
def test_repository(self): """test repository option""" g = generic_autotools(preconfigure=['./autogen.sh'], prefix='/usr/local/zeromq', repository='https://github.com/zeromq/libzmq.git') self.assertEqual(str(g), r'''# https://github.com/zeromq/libzmq.git RUN mkdir -p /var/tmp && cd /var/tmp && git clone --depth=1 https://github.com/zeromq/libzmq.git libzmq && cd - && \ cd /var/tmp/libzmq && \ ./autogen.sh && \ cd /var/tmp/libzmq && ./configure --prefix=/usr/local/zeromq && \ make -j$(nproc) && \ make -j$(nproc) install && \ rm -rf /var/tmp/libzmq''')
def test_runtime_annotate(self): """Runtime""" g = generic_autotools( annotate=True, base_annotation='tcl', directory='tcl8.6.9/unix', prefix='/usr/local/tcl', url='https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz') r = g.runtime() self.assertEqual( r, r'''# https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz COPY --from=0 /usr/local/tcl /usr/local/tcl LABEL hpccm.tcl.configure='./configure --prefix=/usr/local/tcl' \ hpccm.tcl.url=https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz''' )
def test_configure_opts_check(self): """Configure options and check enabled""" g = generic_autotools( check=True, configure_opts=['--disable-getpwuid', '--enable-orterun-prefix-by-default'], prefix='/usr/local/openmpi', url='https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-4.0.1.tar.bz2') self.assertEqual(str(g), r'''# https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-4.0.1.tar.bz2 RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-4.0.1.tar.bz2 && \ mkdir -p /var/tmp && tar -x -f /var/tmp/openmpi-4.0.1.tar.bz2 -C /var/tmp -j && \ cd /var/tmp/openmpi-4.0.1 && ./configure --prefix=/usr/local/openmpi --disable-getpwuid --enable-orterun-prefix-by-default && \ make -j$(nproc) && \ make -j$(nproc) check && \ make -j$(nproc) install && \ rm -rf /var/tmp/openmpi-4.0.1 /var/tmp/openmpi-4.0.1.tar.bz2''')
def test_environment_and_toolchain(self): """environment and toolchain""" tc = toolchain(CC='gcc', CXX='g++', FC='gfortran') g = generic_autotools( build_directory='/tmp/build', directory='/var/tmp/tcl8.6.9/unix', environment={'FOO': 'BAR'}, prefix='/usr/local/tcl', toolchain=tc, url='https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz') self.assertEqual(str(g), r'''# https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz && \ mkdir -p /var/tmp && tar -x -f /var/tmp/tcl8.6.9-src.tar.gz -C /var/tmp -z && \ mkdir -p /tmp/build && cd /tmp/build && FOO=BAR CC=gcc CXX=g++ FC=gfortran /var/tmp/tcl8.6.9/unix/configure --prefix=/usr/local/tcl && \ make -j$(nproc) && \ make -j$(nproc) install && \ rm -rf /var/tmp/tcl8.6.9/unix /var/tmp/tcl8.6.9-src.tar.gz /tmp/build''')
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
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
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
def test_pre_and_post(self): """Preconfigure and postinstall options""" g = generic_autotools( directory='tcl8.6.9/unix', postinstall=['echo "post"'], preconfigure=['echo "pre"'], prefix='/usr/local/tcl', url='https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz') self.assertEqual(str(g), r'''# https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz && \ mkdir -p /var/tmp && tar -x -f /var/tmp/tcl8.6.9-src.tar.gz -C /var/tmp -z && \ cd /var/tmp/tcl8.6.9/unix && \ echo "pre" && \ cd /var/tmp/tcl8.6.9/unix && ./configure --prefix=/usr/local/tcl && \ make -j$(nproc) && \ make -j$(nproc) install && \ cd /usr/local/tcl && \ echo "post" && \ rm -rf /var/tmp/tcl8.6.9/unix /var/tmp/tcl8.6.9-src.tar.gz''')
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
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
def build(container_format='singularity', openmpi_version='2.0.4', gnu_version='10', cfdem_prefix='/usr/local/cfdem', cfdem_version='3.8.0', liggghts_prefix='/usr/local/ligghts', lpp_prefix='/usr/local/lpp', image='ubuntu:20.04', mlton_version='on-20210117-release', gmp_version='6.2.1'): config.set_container_format(container_format) stage0 = Stage(name='stage0') stage0 += baseimage(image=image, _bootstrap='docker') 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=[ 'locales', 'wget', 'software-properties-common', 'git', 'build-essential', 'flex', 'bison', 'cmake', 'zlib1g-dev', 'gnuplot', 'libreadline-dev', 'libncurses-dev', 'libxt-dev', 'libscotch-dev', 'libptscotch-dev', 'libvtk6-dev', 'python-numpy', 'python-dev', 'qt5-default', 'git-core', 'libboost-system-dev', 'libboost-thread-dev', 'libqt5x11extras5-dev', 'qttools5-dev', 'curl', 'libgl1-mesa-dev', 'libosmesa6-dev', 'libssh2-1', 'libtool' ]) compilers = gnu(version=gnu_version) stage0 += compilers openmpi_building_block = openmpi(version=openmpi_version, toolchain=compilers.toolchain, cuda=False) stage0 += openmpi_building_block stage0 += generic_autotools( url=f'https://gmplib.org/download/gmp/gmp-{gmp_version}.tar.xz', prefix='/usr/local/gmp', directory=f'gmp-{gmp_version}/', ) stage0 += environment(variables=from_library('/usr/local/gmp')) stage0 += generic_build(repository='https://github.com/MLton/mlton.git', branch=mlton_version, build=['make -j'], install=['make PREFIX=/usr/local/mlton']) if cfdem_version == '3.8.0': OF_release = '5.x' OF_commitHashtag = '538044ac05c4672b37c7df607dca1116fa88df88' else: raise Exception( 'Check https://github.com/CFDEMproject/CFDEMcoupling-PUBLIC/blob/master/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H' ) stage0 += comment('Obtain CFDEM source') stage0 += shell(commands=[ f'mkdir -p {cfdem_prefix} {liggghts_prefix} {lpp_prefix}', f'git clone --branch {cfdem_version} https://github.com/CFDEMproject/CFDEMcoupling-PUBLIC.git {cfdem_prefix}', f'git clone --branch {cfdem_version} https://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git {liggghts_prefix}', f'git clone https://github.com/CFDEMproject/LPP.git {lpp_prefix}' ]) stage0 += comment('Install OpenFoam') openfoam_prefix = f'/usr/local/OpenFOAM-{OF_release}' thirdparty_prefix = f'/usr/local/ThirdParty-{OF_release}' stage0 += shell(commands=[ f'mkdir -p {openfoam_prefix} {thirdparty_prefix}', f'git clone https://github.com/OpenFOAM/OpenFOAM-{OF_release}.git {openfoam_prefix} && cd {openfoam_prefix} && git checkout {OF_commitHashtag}', f'git clone https://github.com/OpenFOAM/ThirdParty-{OF_release}.git {thirdparty_prefix}', ]) stage0 += shell(commands=[ f'echo "source {openfoam_prefix}/etc/bashrc" >> ~/.bashrc', ]) # DLIB_PATH = '/usr/lib/x86_64-linux-gnu' # INCLUDE_PATH = '/usr/include' stage0 += shell_with_log(commands=[ f'{thirdparty_prefix}/Allwmake -j', # this breaks with openmpi >= 3, error: static assertion failed: "MPI_Type_extent was removed in MPI-3.0. Use MPI_Type_get_extent instead." # f'{thirdparty_prefix}/makeParaView -mpi -mesa -mesa-lib {DLIB_PATH}/libOSMesa.so -mesa-include {INCLUDE_PATH}/GL -verbose', f'{thirdparty_prefix}/makeParaView -mpi' 'wmRefresh' ]) stage0 += shell(commands=[ f'{openfoam_prefix}/Allwmake -j', ]) # /usr/bin/g++ -fPIC -O3 -DNDEBUG -Wl,--no-undefined -lc -shared -Wl,-soname,libvtkCommonSystem-pv5.4.so.1 -o ../../../lib/libvtkCommonSystem-pv5.4.so.1 CMakeFiles/vtkCommonSystem.dir/vtkClientSocket.cxx.o CMakeFiles/vtkCommonSystem.dir/vtkDirectory.cxx.o CMakeFiles/vtkCommonSystem.dir/vtkServerSocket.cxx.o CMakeFiles/vtkCommonSystem.dir/vtkSocket.cxx.o CMakeFiles/vtkCommonSystem.dir/vtkSocketCollection.cxx.o CMakeFiles/vtkCommonSystem.dir/vtkThreadMessager.cxx.o CMakeFiles/vtkCommonSystem.dir/vtkTimerLog.cxx.o -Wl,-rpath,/usr/local/ThirdParty-5.x/build/linux64Gcc/ParaView-5.4.0/lib: ../../../lib/libvtkCommonCore-pv5.4.so.1 ../../../lib/libvtksys-pv5.4.so.1 -lpthread -ldl return stage0
def __init__(self, **kwargs): """Initialize building block""" super(openmpi, self).__init__(**kwargs) self.__baseurl = kwargs.pop('baseurl', 'https://www.open-mpi.org/software/ompi') self.__configure_opts = kwargs.pop('configure_opts', ['--disable-getpwuid', '--enable-orterun-prefix-by-default']) self.__cuda = kwargs.pop('cuda', True) self.__default_repository = 'https://github.com/open-mpi/ompi.git' self.__infiniband = kwargs.pop('infiniband', True) self.__ospackages = kwargs.pop('ospackages', []) self.__pmi = kwargs.pop('pmi', False) self.__pmix = kwargs.pop('pmix', False) self.__prefix = kwargs.pop('prefix', '/usr/local/openmpi') self.__recursive = kwargs.pop('recursive', True) self.__runtime_ospackages = [] # Filled in by __distro() # Input toolchain, i.e., what to use when building # Create a copy of the toolchain so that it can be modified # without impacting the original self.__toolchain = _copy(kwargs.pop('toolchain', toolchain())) self.__version = kwargs.pop('version', '4.0.5') self.__ucx = kwargs.pop('ucx', False) # Output toolchain self.toolchain = toolchain(CC='mpicc', CXX='mpicxx', F77='mpif77', F90='mpif90', FC='mpifort') # Set the configure options self.__configure() # 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'] = '{}:$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} if not self.repository else {}, base_annotation=self.__class__.__name__, comment=False, configure_opts=self.__configure_opts, devel_environment=self.environment_variables, preconfigure=['./autogen.pl'] if self.repository else None, prefix=self.__prefix, recursive=self.__recursive, runtime_environment=self.environment_variables, toolchain=self.__toolchain, **kwargs) # Container instructions if self.repository: if self.branch: self += comment('OpenMPI {} {}'.format(self.repository, self.branch)) elif self.commit: self += comment('OpenMPI {} {}'.format(self.repository, self.commit)) else: self += comment('OpenMPI {}'.format(self.repository)) else: self += comment('OpenMPI version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb
def test_both_branch_and_commit(self): """both branch and commit""" with self.assertRaises(RuntimeError): g = generic_autotools(branch='dev', commit='deadbeef', repository='foo')
def __init__(self, **kwargs): """Initialize building block""" super(netcdf, self).__init__(**kwargs) self.__baseurl_c = 'https://github.com/Unidata/netcdf-c/archive' self.__baseurl_cxx = 'https://github.com/Unidata/netcdf-cxx4/archive' self.__baseurl_fortran = 'https://github.com/Unidata/netcdf-fortran/archive' self.__check = kwargs.pop('check', False) self.__cxx = kwargs.pop('cxx', True) self.__fortran = kwargs.pop('fortran', True) self.__ospackages = kwargs.pop('ospackages', []) self.__prefix = kwargs.pop('prefix', '/usr/local/netcdf') self.__runtime_ospackages = [] # Filled in by __distro() self.__version = kwargs.pop('version', '4.7.3') self.__version_cxx = kwargs.pop('version_cxx', '4.3.1') self.__version_fortran = kwargs.pop('version_fortran', '4.5.2') # Set the Linux distribution specific parameters self.__distro() # Set the download specific parameters self.__download() # 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')) 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 comments = ['NetCDF version {}'.format(self.__version)] self.__bb = [generic_autotools( check=self.__check, comment=False, devel_environment=self.environment_variables, directory=self.__directory_c, prefix=self.__prefix, runtime_environment=self.environment_variables, url=self.__url_c, **kwargs)] # Setup optional CXX build configuration if self.__cxx: comments.append('NetCDF C++ version {}'.format(self.__version_cxx)) self.__bb.append(generic_autotools( check=self.__check, comment=False, directory='netcdf-cxx4-{}'.format(self.__version_cxx), # Checks fail when using parallel make. Disable it. parallel=1 if self.__check else '$(nproc)', prefix=self.__prefix, url='{0}/v{1}.tar.gz'.format(self.__baseurl_cxx, self.__version_cxx), **kwargs)) # Setup optional Fortran build configuration if self.__fortran: comments.append('NetCDF Fortran version {}'.format(self.__version_fortran)) self.__bb.append(generic_autotools( check=self.__check, comment=False, directory='netcdf-fortran-{}'.format(self.__version_fortran), # Checks fail when using parallel make. Disable it. parallel=1 if self.__check else '$(nproc)', prefix=self.__prefix, url='{0}/v{1}.tar.gz'.format(self.__baseurl_fortran, self.__version_fortran), **kwargs)) # Container instructions self += comment(', '.join(comments)) self += packages(ospackages=self.__ospackages) self += [bb for bb in self.__bb]
def build(container_format='singularity', os_release='ubuntu', os_version='20.04'): config.set_container_format(container_format) image = f'{os_release}:{os_version}' 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', 'zlib1g-dev', 'perl', 'ncbi-blast+', 'libx11-dev' ]) stage0 += shell(commands=['locale-gen en_AU.UTF-8']) stage0 += gnu(version='10') stage0 += generic_build( url= 'http://search.cpan.org/CPAN/authors/id/Y/YA/YANICK/Parallel-ForkManager-1.19.tar.gz', prefix='/usr/local/parallel-forkmanager', build=['perl Makefile.PL', 'make install'], install=['mv * /usr/local/parallel-forkmanager/']) stage0 += environment( variables=add_binary('/usr/local/parallel-forkmanager')) stage0 += generic_build( url= 'ftp://ftp.ebi.ac.uk/pub/software/clustalw2/2.1/clustalw-2.1-linux-x86_64-libcppstatic.tar.gz', prefix='/usr/local/clustalw', install=['mv clustalw2 /usr/local/clustalw/clustalw']) stage0 += environment(variables=add_binary('/usr/local/clustalw')) stage0 += generic_autotools( url='ftp://emboss.open-bio.org/pub/EMBOSS/EMBOSS-6.6.0.tar.gz', prefix='/usr/local/emboss', ) stage0 += environment(variables=from_prefix('/usr/local/emboss')) stage0 += generic_autotools( url= 'https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_4_x/ViennaRNA-2.4.17.tar.gz', prefix='/usr/local/viennarna') stage0 += environment(variables=from_prefix('/usr/local/viennarna')) stage0 += generic_build( url='https://github.com/weizhongli/cdhit/archive/V4.8.1.tar.gz', prefix='/usr/local/cdhit', directory='cdhit-4.8.1', build=['make'], install=['mv * /usr/local/cdhit/']) stage0 += environment(variables=add_binary('/usr/local/cdhit')) stage0 += generic_build( repository='https://github.com/ambarishbiswas/CRISPRDetect_2.2.git', commit='0f8249f', prefix='/usr/local/crisprdetect', install=['mv * /usr/local/crisprdetect/']) stage0 += environment(variables=add_binary('/usr/local/crisprdetect')) return stage0
def test_invalid_package(self): """invalid package url""" with self.assertRaises(RuntimeError): g = generic_autotools(url='https://foo/bar.sh')
def test_both_repository_and_url(self): """both repository and url""" with self.assertRaises(RuntimeError): g = generic_autotools(repository='foo', url='bar')
def test_no_url(self): """missing url""" with self.assertRaises(RuntimeError): g = generic_autotools()
def __init__(self, **kwargs): """Initialize building block""" super(mvapich2, self).__init__(**kwargs) self.__baseurl = kwargs.pop( 'baseurl', 'http://mvapich.cse.ohio-state.edu/download/mvapich/mv2') self.__configure_opts = kwargs.pop('configure_opts', ['--disable-mcast']) self.__cuda = kwargs.pop('cuda', True) self.__gpu_arch = kwargs.pop('gpu_arch', None) self.__ospackages = kwargs.pop('ospackages', []) self.__preconfigure = [] self.__prefix = kwargs.pop('prefix', '/usr/local/mvapich2') 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', '2.3.3') # MVAPICH2 does not accept F90 self.toolchain_control = { 'CC': True, 'CXX': True, 'F77': True, 'F90': False, 'FC': True } # Output toolchain self.toolchain = toolchain(CC='mpicc', CXX='mpicxx', F77='mpif77', F90='mpif90', FC='mpifort') # Set the configure options self.__configure() # Set the Linux distribution specific parameters self.__distro() # Setup the environment variables # Set library path self.environment_variables['PATH'] = '{}:$PATH'.format( posixpath.join(self.__prefix, 'bin')) self.runtime_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')) self.runtime_environment_variables[ 'LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format( posixpath.join(self.__prefix, 'lib')) if self.__cuda: # Workaround for using compiler wrappers in the build stage self.environment_variables[ 'PROFILE_POSTLIB'] = '"-L{} -lnvidia-ml -lcuda"'.format( '/usr/local/cuda/lib64/stubs') # Setup build configuration self.__bb = generic_autotools( comment=False, configure_opts=self.__configure_opts, devel_environment=self.environment_variables, preconfigure=self.__preconfigure, prefix=self.__prefix, runtime_environment=self.runtime_environment_variables, toolchain=self.__toolchain, url='{0}/mvapich2-{1}.tar.gz'.format(self.__baseurl, self.__version), **kwargs) # Container instructions self += comment('MVAPICH2 version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb
def __init__(self, **kwargs): """Initialize building block""" super(hdf5, self).__init__(**kwargs) self.__baseurl = kwargs.pop( 'baseurl', 'http://www.hdfgroup.org/ftp/HDF5/releases') self.__check = kwargs.pop('check', False) self.__configure_opts = kwargs.pop( 'configure_opts', ['--enable-cxx', '--enable-fortran']) self.__ospackages = kwargs.pop('ospackages', []) self.__prefix = kwargs.pop('prefix', '/usr/local/hdf5') # Create a copy of the toolchain so that it can be modified # without impacting the original self.__toolchain = _copy(kwargs.pop('toolchain', toolchain())) self.__runtime_ospackages = [] # Filled in by __distro() self.__version = kwargs.pop('version', '1.12.0') # Set the Linux distribution specific parameters self.__distro() # Set the download specific parameters self.__download() # Set the environment variables self.environment_variables['CPATH'] = '{}:$CPATH'.format( posixpath.join(self.__prefix, 'include')) self.environment_variables['HDF5_DIR'] = self.__prefix self.environment_variables['LIBRARY_PATH'] = '{}:$LIBRARY_PATH'.format( posixpath.join(self.__prefix, 'lib')) 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')) # PIC workaround when using the NVIDIA compilers if self.__toolchain.FC and re.match('.*nvfortran', self.__toolchain.FC): if not self.__toolchain.FCFLAGS: self.__toolchain.FCFLAGS = '-fpic -DPIC' # 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, prefix=self.__prefix, runtime_environment=self.environment_variables, toolchain=self.__toolchain, url=self.__url, **kwargs) # Container instructions self += comment('HDF5 version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb
def __init__(self, **kwargs): """Initialize building block""" super(ucx, self).__init__(**kwargs) # Parameters self.__baseurl = kwargs.pop( 'baseurl', 'https://github.com/openucx/ucx/releases/download') self.__configure_opts = kwargs.pop('configure_opts', [ '--enable-optimizations', '--disable-logging', '--disable-debug', '--disable-assertions', '--disable-params-check', '--disable-doxygen-doc' ]) self.__cuda = kwargs.pop('cuda', True) self.__default_repository = 'https://github.com/openucx/ucx.git' self.__gdrcopy = kwargs.pop('gdrcopy', '') self.__knem = kwargs.pop('knem', '') self.__ofed = kwargs.pop('ofed', '') self.__ospackages = kwargs.pop('ospackages', []) self.__prefix = kwargs.pop('prefix', '/usr/local/ucx') self.__runtime_ospackages = [] # Filled in by __distro() self.__toolchain = kwargs.pop('toolchain', toolchain()) self.__version = kwargs.pop('version', '1.8.0') self.__xpmem = kwargs.pop('xpmem', '') # Set the configure options self.__configure() # 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'] = '{}:$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} if not self.repository else {}, base_annotation=self.__class__.__name__, comment=False, configure_opts=self.__configure_opts, devel_environment=self.environment_variables, preconfigure=['./autogen.sh'] if self.repository else None, prefix=self.__prefix, runtime_environment=self.environment_variables, toolchain=self.__toolchain, **kwargs) # Container instructions if self.repository: if self.branch: self += comment('UCX {} {}'.format(self.repository, self.branch)) elif self.commit: self += comment('UCX {} {}'.format(self.repository, self.commit)) else: self += comment('UCX {}'.format(self.repository)) else: self += comment('UCX version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += self.__bb