def build_step(self):
        """Build OpenFOAM using make after sourcing script to set environment."""

        # Some parts of OpenFOAM uses CMake to build
        # make sure the basic environment is correct
        setup_cmake_env(self.toolchain)

        precmd = "source %s" % os.path.join(self.builddir, self.openfoamdir,
                                            "etc", "bashrc")
        if 'extend' not in self.name.lower(
        ) and self.looseversion >= LooseVersion('4.0'):
            if self.looseversion >= LooseVersion('2006'):
                cleancmd = "cd $WM_PROJECT_DIR && wclean -platform -all && cd -"
            else:
                cleancmd = "cd $WM_PROJECT_DIR && wcleanPlatform -all && cd -"
        else:
            cleancmd = "wcleanAll"

        # make directly in install directory
        cmd_tmpl = "%(precmd)s && %(cleancmd)s && %(prebuildopts)s %(makecmd)s" % {
            'precmd': precmd,
            'cleancmd': cleancmd,
            'prebuildopts': self.cfg['prebuildopts'],
            'makecmd': os.path.join(self.builddir, self.openfoamdir, '%s'),
        }
        if 'extend' in self.name.lower(
        ) and self.looseversion >= LooseVersion('3.0'):
            qa = {
                "Proceed without compiling ParaView [Y/n]": 'Y',
                "Proceed without compiling cudaSolvers? [Y/n]": 'Y',
            }
            noqa = [
                ".* -o .*",
                "checking .*",
                "warning.*",
                "configure: creating.*",
                "%s .*" % os.environ['CC'],
                "wmake .*",
                "Making dependency list for source file.*",
                r"\s*\^\s*",  # warning indicator
                "Cleaning .*",
            ]
            run_cmd_qa(cmd_tmpl % 'Allwmake.firstInstall',
                       qa,
                       no_qa=noqa,
                       log_all=True,
                       simple=True,
                       maxhits=500)
        else:
            cmd = 'Allwmake'
            if self.looseversion > LooseVersion('1606'):
                # use Allwmake -log option if possible since this can be useful during builds, but also afterwards
                cmd += ' -log'
            run_cmd(cmd_tmpl % cmd, log_all=True, simple=True, log_output=True)
示例#2
0
    def configure_step(self):
        """Custom configure procedure for ELSI."""
        if self.cfg['runtest']:
            self.cfg.update('configopts', "-DENABLE_TESTS=ON")
            self.cfg.update('configopts', "-DENABLE_C_TESTS=ON")
            self.cfg['runtest'] = 'test'

        setup_cmake_env(self.toolchain)

        external_libs = []
        inc_paths = os.environ['CMAKE_INCLUDE_PATH'].split(':')
        lib_paths = os.environ['CMAKE_LIBRARY_PATH'].split(':')

        elpa_root = get_software_root('ELPA')
        if elpa_root:
            self.log.info("Using external ELPA.")
            self.cfg.update('configopts', "-DUSE_EXTERNAL_ELPA=ON")
            elpa_lib = 'elpa_openmp' if self.toolchain.options.get('openmp', None) else 'elpa'
            inc_paths.append(os.path.join(elpa_root, 'include', '%s-%s' % (elpa_lib, get_software_version('ELPA')),
                                          'modules'))
            external_libs.extend([elpa_lib])
        else:
            self.log.info("No external ELPA specified as dependency, building internal ELPA.")

        pexsi = get_software_root('PEXSI')
        if pexsi:
            if self.cfg['build_internal_pexsi']:
                raise EasyBuildError("Both build_internal_pexsi and external PEXSI dependency found, "
                                     "only one can be set.")
            self.log.info("Using external PEXSI.")
            self.cfg.update('configopts', "-DUSE_EXTERNAL_PEXSI=ON")
            external_libs.append('pexsi')
        elif self.cfg['build_internal_pexsi'] is not False:
            self.log.info("No external PEXSI specified as dependency and internal PEXSI not explicitly disabled, "
                          "building internal PEXSI.")
            self.cfg['build_internal_pexsi'] = True
        else:
            self.log.info("No external PEXSI specified as dependency and internal PEXSI was explicitly disabled, "
                          "building ELSI without PEXSI.")

        if pexsi or self.cfg['build_internal_pexsi']:
            self.cfg.update('configopts', "-DENABLE_PEXSI=ON")

        slepc = get_software_root('SLEPc')
        if slepc:
            if self.cfg['build_internal_pexsi']:
                # ELSI's internal PEXSI also builds internal PT-SCOTCH and SuperLU_DIST
                raise EasyBuildError("Cannot use internal PEXSI with external SLEPc, due to conflicting dependencies.")
            self.enable_sips = True
            self.log.info("Enabling SLEPc-SIPs solver.")
            self.cfg.update('configopts', "-DENABLE_SIPS=ON")
            external_libs.extend(['slepc', 'petsc', 'HYPRE', 'umfpack', 'klu', 'cholmod', 'btf', 'ccolamd', 'colamd',
                                  'camd', 'amd', 'suitesparseconfig', 'metis', 'ptesmumps',
                                  'ptscotchparmetis', 'ptscotch', 'ptscotcherr', 'esmumps', 'scotch', 'scotcherr',
                                  'stdc++', 'dl'])
            if get_software_root('imkl') or get_software_root('FFTW'):
                external_libs.extend(re.findall(r'lib(.*?)\.a', os.environ['FFTW_STATIC_LIBS%s' % self.env_suff]))
            else:
                raise EasyBuildError("Could not find FFTW library or interface.")

        if get_software_root('imkl') or get_software_root('ScaLAPACK'):
            external_libs.extend(re.findall(r'lib(.*?)\.a', os.environ['SCALAPACK%s_STATIC_LIBS' % self.env_suff]))
        else:
            raise EasyBuildError("Could not find ScaLAPACK library or interface.")

        external_libs.extend(re.findall(r'-l(.*?)\b', os.environ['LIBS']))

        self.cfg.update('configopts', "-DLIBS='%s'" % ';'.join(external_libs))
        self.cfg.update('configopts', "-DLIB_PATHS='%s'" % ';'.join(lib_paths))
        self.cfg.update('configopts', "-DINC_PATHS='%s'" % ';'.join(inc_paths))

        super(EB_ELSI, self).configure_step()