How to use the easybuild.tools.modules.get_software_root function in easybuild

To help you get started, we’ve selected a few easybuild examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github easybuilders / easybuild-framework / easybuild / easyblocks / t / trilinos.py View on Github external
# UMFPACK is part of SuiteSparse
        suitesparse = get_software_root('SuiteSparse')
        if suitesparse:
            self.cfg.update('configopts', "-DTPL_ENABLE_UMFPACK:BOOL=ON")
            incdirs, libdirs, libnames = [], [], []
            for lib in ["UMFPACK", "CHOLMOD", "COLAMD", "AMD"]:
                incdirs.append(os.path.join(suitesparse, lib, "Include"))
                libdirs.append(os.path.join(suitesparse, lib, "Lib"))
                libnames.append(lib.lower())
            self.cfg.update('configopts', '-DUMFPACK_INCLUDE_DIRS:PATH="%s"' % ';'.join(incdirs))
            self.cfg.update('configopts', '-DUMFPACK_LIBRARY_DIRS:PATH="%s"' % ';'.join(libdirs))
            self.cfg.update('configopts', '-DUMFPACK_LIBRARY_NAMES:STRING="%s"' % ';'.join(libnames))

        # BLACS
        if get_software_root('BLACS'):
            self.cfg.update('configopts', "-DTPL_ENABLE_BLACS:BOOL=ON")
            self.cfg.update('configopts', '-DBLACS_INCLUDE_DIRS:PATH="%s"' % os.getenv('BLACS_INC_DIR'))
            self.cfg.update('configopts', '-DBLACS_LIBRARY_DIRS:PATH="%s"' % os.getenv('BLACS_LIB_DIR'))
            blacs_lib_names = os.getenv('BLACS_STATIC_LIBS').split(',')
            blacs_lib_names = [lib_re.search(x).group(1) for x in blacs_lib_names]
            self.cfg.update('configopts', '-DBLACS_LIBRARY_NAMES:STRING="%s"' % (';'.join(blacs_lib_names)))

        # ScaLAPACK
        if get_software_root('ScaLAPACK'):
            self.cfg.update('configopts', "-DTPL_ENABLE_SCALAPACK:BOOL=ON")
            self.cfg.update('configopts', '-DSCALAPACK_INCLUDE_DIRS:PATH="%s"' % os.getenv('SCALAPACK_INC_DIR'))
            self.cfg.update('configopts', '-DSCALAPACK_LIBRARY_DIRS:PATH="%s;%s"' % (os.getenv('SCALAPACK_LIB_DIR'),
                                                                                    os.getenv('BLACS_LIB_DIR')))

        # PETSc
        petsc = get_software_root('PETSc')
github easybuilders / easybuild-framework / easybuild / easyblocks / h / hdf5.py View on Github external
def configure_step(self):
        """Configure build: set require config and make options, and run configure script."""

        # configure options
        deps = ["Szip", "zlib"]
        for dep in deps:
            root = get_software_root(dep)
            if root:
                self.cfg.update('configopts', '--with-%s=%s' % (dep.lower(), root))
            else:
                self.log.error("Dependency module %s not loaded." % dep)

        fcomp = 'FC="%s"' % os.getenv('F77')

        self.cfg.update('configopts', "--with-pic --with-pthread --enable-shared")
        self.cfg.update('configopts', "--enable-cxx --enable-fortran %s" % fcomp)

        # MPI and C++ support enabled requires --enable-unsupported, because this is untested by HDF5
        if self.toolchain.opts['usempi']:
            self.cfg.update('configopts', "--enable-unsupported")

        # make options
        self.cfg.update('makeopts', fcomp)
github easybuilders / JSC / Custom_EasyBlocks / 2017b / dolfin.py View on Github external
deps.append('Armadillo')
        else:
            deps.append('Eigen')

        # UFC has been integrated into FFC in v1.4, cfr. https://bitbucket.org/fenics-project/ufc-deprecated
        if LooseVersion(self.version) < LooseVersion('1.4'):
            deps.append('UFC')

        # PLY, petsc4py, slepc4py are required since v1.5
        #if LooseVersion(self.version) >= LooseVersion('1.5'):
        #    #deps.extend(['petsc4py', 'PLY', 'slepc4py'])
        #    # PLY is included in our Python package. slepc4py doesn't seem to be required
        #    deps.extend(['petsc4py'])

        for dep in deps:
            deproot = get_software_root(dep)
            if not deproot:
                raise EasyBuildError("Dependency %s not available.", dep)
            else:
                self.depsdict.update({dep:deproot})
github eth-cscs / production / easybuild / easyblocks / gromacs.py View on Github external
def configure_step(self):
        """Custom configuration procedure for GROMACS: set configure options for configure or cmake."""

        # check whether PLUMED is loaded as a dependency
        plumed_root = get_software_root('PLUMED')
        if plumed_root:
            # Need to check if PLUMED has an engine for this version
            engine = 'gromacs-%s' % self.version

            (out, _) = run_cmd("plumed-patch -l", log_all=True, simple=False)
            if not re.search(engine, out):
                raise EasyBuildError("There is no support in PLUMED version %s for GROMACS %s: %s",
                                     get_software_version('PLUMED'), self.version, out)

            # PLUMED patching must be done at different stages depending on
            # version of GROMACS. Just prepare first part of cmd here
            self.log.info("Patch gromacs using engine version %s", engine)
            plumed_cmd = "plumed-patch -p -e %s" % engine

        if LooseVersion(self.version) < LooseVersion('4.6'):
            self.log.info("Using configure script for configuring GROMACS build.")
github easybuilders / JSC / Custom_EasyBlocks / 2018b / psmpi.py View on Github external
# Enable threading, if necessary
        if self.cfg['threaded']:
            self.cfg.update('configopts', ' --with-threading')

        # Add extra mpich options, if any
        if self.cfg['mpich_opts'] is not None:
            self.cfg.update('configopts', ' --with-mpichconf="%s"' % self.cfg['mpich_opts'])

        # Add PGO related options, if enabled
        if self.cfg['pgo']:
            self.cfg.update('configopts', ' --with-profile=gen --with-profdir=%s' % self.profdir)

        # Lastly, set pscom related variables
        if self.cfg['pscom_allin_path'] is None:
            pscom_path = get_software_root('pscom')
        else:
            pscom_path = self.cfg['pscom_allin_path'].strip()
            self.cfg.update('configopts', ' --with-pscom-allin="%s"' % pscom_path)

        pscom_flags = 'PSCOM_LDFLAGS=-L{0}/lib PSCOM_CPPFLAGS=-I{0}/include'.format(pscom_path)
        self.cfg.update('preconfigopts', pscom_flags)

        super(EB_psmpi, self).configure_step(add_mpich_configopts=False)
github easybuilders / easybuild-framework / easybuild / easyblocks / p / python.py View on Github external
self.numpysitecfgincsubdirs = []

        self.sitecfg = """[DEFAULT]
library_dirs = %(libs)s
include_dirs = %(includes)s
search_static_first=True

"""

        if get_software_root("IMKL"):
            #use mkl
            extrasiteconfig = """[mkl]
lapack_libs = %(lapack)s
mkl_libs = %(blas)s
        """
        elif get_software_root("ATLAS") and get_software_root("LAPACK"):
            extrasiteconfig = """
[blas_opt]
libraries = %(blas)s
[lapack_opt]
libraries = %(lapack)s
        """
        else:
            self.log.error("Could not detect math kernel (mkl, atlas)")

        if get_software_root("IMKL") or get_software_root("FFTW"):
            extrasiteconfig += """
[fftw]
libraries = %s
        """ % os.getenv("LIBFFT").replace(' ', ',')

        self.sitecfg = self.sitecfg + extrasiteconfig
github easybuilders / easybuild-framework / easybuild / easyblocks / l / lapack.py View on Github external
def test_step(self):
        """
        Run BLAS and LAPACK tests that come with netlib's LAPACK.
        """
        if self.cfg['test_only']:

            if not get_software_root('LAPACK'):
                self.log.error("You need to make sure that the LAPACK module is loaded to perform testing.")

            blaslib = get_blas_lib(self.log)

            self.log.info('Running BLAS and LAPACK tests included.')

            # run BLAS and LAPACK tests
            for lib in ["blas", "lapack"]:
                self.log.info("Running %s tests..." % lib.upper())
                cmd = "make BLASLIB='%s' %s_testing" % (blaslib, lib)
                run_cmd(cmd, log_all=True, simple=True)
        else:
            super(EB_LAPACK, self).test_step()
github easybuilders / JSC / Custom_EasyBlocks / 2018b / tensorflow.py View on Github external
def build_step(self):
        """Custom build procedure for TensorFlow."""

        # pre-create target installation directory
        mkdir(os.path.join(self.installdir, self.pylibdir), parents=True)

        binutils_root = get_software_root('binutils')
        if binutils_root:
            binutils_bin = os.path.join(binutils_root, 'bin')
        else:
            raise EasyBuildError("Failed to determine installation prefix for binutils")

        gcc_root = get_software_root('GCCcore') or get_software_root('GCC')
        if gcc_root:
            gcc_lib64 = os.path.join(gcc_root, 'lib64')
            gcc_ver = get_software_version('GCCcore') or get_software_version('GCC')

            # figure out location of GCC include files
            res = glob.glob(os.path.join(gcc_root, 'lib', 'gcc', '*', gcc_ver, 'include'))
            if res and len(res) == 1:
                gcc_lib_inc = res[0]
            else:
                raise EasyBuildError("Failed to pinpoint location of GCC include files: %s", res)
github easybuilders / easybuild-framework / easybuild / easyblocks / c / cp2k.py View on Github external
if self.cfg['type'] == 'psmp':
            self.openmp = self.toolchain.get_openmp_flag()

        # determine which opt flags to use
        if self.cfg['typeopt']:
            optflags = 'OPT'
            regflags = 'OPT2'
        else:
            optflags = 'NOOPT'
            regflags = 'NOOPT'

        # make sure a MPI-2 able MPI lib is used
        mpi2libs = ['impi', 'MVAPICH2', 'OpenMPI']
        mpi2 = False
        for mpi2lib in mpi2libs:
            if get_software_root(mpi2lib):
                mpi2 = True
            else:
                self.log.debug("MPI-2 supporting MPI library %s not loaded.")

        if not mpi2:
            self.log.error("CP2K needs MPI-2, no known MPI-2 supporting library loaded?")

        options = {
                   'CC': os.getenv('MPICC'),
                   'CPP': '',
                   'FC': '%s %s' % (os.getenv('MPIF77'), self.openmp),
                   'LD': '%s %s' % (os.getenv('MPIF77'), self.openmp),
                   'AR': 'ar -r',
                   'CPPFLAGS': '',

                   'FPIC': self.fpic,
github easybuilders / easybuild-framework / easybuild / easyblocks / c / cp2k.py View on Github external
comp_fam = self.toolchain.comp_family()
        if comp_fam == toolchain.INTEL:
            options = self.configureIntelBased()
        elif comp_fam == toolchain.GCC:
            options = self.configureGCCBased()
        else:
            self.log.error("Don't know how to tweak configuration for compiler used.")

        if get_software_root('IMKL'):
            options = self.configureMKL(options)
        elif get_software_root('ACML'):
            options = self.configureACML(options)
        elif get_software_root('ATLAS'):
            options = self.configureATLAS(options)

        if get_software_root('FFTW'):
            options = self.configureFFTW(options)

        if get_software_root('LAPACK'):
            options = self.configureLAPACK(options)

        if get_software_root('ScaLAPACK'):
            options = self.configureScaLAPACK(options)

        # avoid group nesting
        options['LIBS'] = options['LIBS'].replace('-Wl,--start-group','').replace('-Wl,--end-group','')

        options['LIBS'] = "-Wl,--start-group %s -Wl,--end-group" % options['LIBS']

        # create arch file using options set
        archfile = os.path.join(self.cfg['start_dir'], 'arch',
                                '%s.%s' % (self.typearch, self.cfg['type']))