diff --git a/easyblocks/a/allineabase.pyo b/easyblocks/a/allineabase.pyo deleted file mode 100644 index 591036e40fcf27feb914224b8c15e7a3511631dd..0000000000000000000000000000000000000000 Binary files a/easyblocks/a/allineabase.pyo and /dev/null differ diff --git "a/easyblocks/c/\\" "b/easyblocks/c/\\" deleted file mode 100644 index e372a40480272df5fc9280f10b4c4b2696f50a54..0000000000000000000000000000000000000000 --- "a/easyblocks/c/\\" +++ /dev/null @@ -1,432 +0,0 @@ -## -# Copyright 2013 Dmitri Gribenko -# Copyright 2013-2017 Ghent University -# Copyright 2017 IT4Innovations -# -# This file is triple-licensed under GPLv2 (see below), MIT, and -# BSD three-clause licenses. -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), -# Flemish Research Foundation (FWO) (http://www.fwo.be/en) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# https://github.com/easybuilders/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. -## -""" -Support for building and installing Clang, implemented as an easyblock. - -@author: Dmitri Gribenko (National Technical University of Ukraine "KPI") -@author: Ward Poelmans (Ghent University) -@author: Josef Hrabal, Lukas Krupcik (IT4innovations, Czechia) -""" - -import fileinput -import glob -import os -import re -import shutil -import sys -from distutils.version import LooseVersion - -from easybuild.easyblocks.generic.cmakemake import CMakeMake -from easybuild.framework.easyconfig import CUSTOM -from easybuild.tools import run -from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.config import build_option -from easybuild.tools.filetools import mkdir -from easybuild.tools.modules import get_software_root -from easybuild.tools.run import run_cmd -from easybuild.tools.systemtools import get_os_name, get_os_version, get_shared_lib_ext - -# List of all possible build targets for Clang -CLANG_TARGETS = ["all", "AArch64", "ARM", "CppBackend", "Hexagon", "Mips", - "MBlaze", "MSP430", "NVPTX", "PowerPC", "R600", "Sparc", - "SystemZ", "X86", "XCore"] - - -class EB_Clang(CMakeMake): - """Support for bootstrapping Clang.""" - - @staticmethod - def extra_options(): - extra_vars = { - 'assertions': [True, "Enable assertions. Helps to catch bugs in Clang.", CUSTOM], - 'build_targets': [["X86"], "Build targets for LLVM. Possible values: " + ', '.join(CLANG_TARGETS), CUSTOM], - 'bootstrap': [True, "Bootstrap Clang using GCC", CUSTOM], - 'usepolly': [False, "Build Clang with polly", CUSTOM], - 'static_analyzer': [True, "Install the static analyser of Clang", CUSTOM], - # The sanitizer tests often fail on HPC systems due to the 'weird' environment. - 'skip_sanitizer_tests': [False, "Do not run the sanitizer tests", CUSTOM], - } - - return CMakeMake.extra_options(extra_vars) - - def __init__(self, *args, **kwargs): - """Initialize custom class variables for Clang.""" - - super(EB_Clang, self).__init__(*args, **kwargs) - self.llvm_src_dir = None - self.llvm_obj_dir_stage1 = None - self.llvm_obj_dir_stage2 = None - self.llvm_obj_dir_stage3 = None - self.make_parallel_opts = "" - - unknown_targets = [target for target in self.cfg['build_targets'] if target not in CLANG_TARGETS] - - if unknown_targets: - raise EasyBuildError("Some of the chosen build targets (%s) are not in %s.", - ', '.join(unknown_targets), ', '.join(CLANG_TARGETS)) - - if LooseVersion(self.version) < LooseVersion('3.4') and "R600" in self.cfg['build_targets']: - raise EasyBuildError("Build target R600 not supported in < Clang-3.4") - - if LooseVersion(self.version) > LooseVersion('3.3') and "MBlaze" in self.cfg['build_targets']: - raise EasyBuildError("Build target MBlaze is not supported anymore in > Clang-3.3") - - def check_readiness_step(self): - """Fail early on RHEL 5.x and derivatives because of known bug in libc.""" - super(EB_Clang, self).check_readiness_step() - # RHEL 5.x have a buggy libc. Building stage 2 will fail. - if get_os_name() in ['redhat', 'RHEL', 'centos', 'SL'] and get_os_version().startswith('5.'): - raise EasyBuildError("Can not build Clang on %s v5.x: libc is buggy, building stage 2 will fail. " - "See http://stackoverflow.com/questions/7276828/", get_os_name()) - - def extract_step(self): - """ - Prepare a combined LLVM source tree. The layout is: - llvm/ Unpack llvm-*.tar.gz here - projects/ - compiler-rt/ Unpack compiler-rt-*.tar.gz here - openmp/ Unpack openmp-*.tar.xz here - libcxx/ Unpack libcxx-*.tar.xz here - libcxxabi/ Unpack libcxxapbi-*.tar.xz here - tools/ - clang/ Unpack cfe-*.tar.gz here - tools/extra Unpack clang-*.tar.gz here - polly/ Unpack polly-*.tar.gz here - """ - - # Extract everything into separate directories. - super(EB_Clang, self).extract_step() - - # Find the full path to the directory that was unpacked from llvm-*.tar.gz. - for tmp in self.src: - if tmp['name'].startswith("llvm-"): - self.llvm_src_dir = tmp['finalpath'] - break - - if self.llvm_src_dir is None: - raise EasyBuildError("Could not determine LLVM source root (LLVM source was not unpacked?)") - - src_dirs = {} - - def find_source_dir(globpatterns, targetdir): - """Search for directory with globpattern and rename it to targetdir""" - if not isinstance(globpatterns, list): - globpatterns = [globpatterns] - - glob_src_dirs = [glob_dir for globpattern in globpatterns for glob_dir in glob.glob(globpattern)] - if len(glob_src_dirs) != 1: - raise EasyBuildError("Failed to find exactly one source directory for pattern %s: %s", globpatterns, - glob_src_dirs) - src_dirs[glob_src_dirs[0]] = targetdir - - find_source_dir('compiler-rt-*', os.path.join(self.llvm_src_dir, 'projects', 'compiler-rt')) - - if self.cfg["usepolly"]: - find_source_dir('polly-*', os.path.join(self.llvm_src_dir, 'tools', 'polly')) - - find_source_dir('cfe-*', os.path.join(self.llvm_src_dir, 'tools', 'clang')) - - find_source_dir('clang-*', os.path.join(self.llvm_src_dir, 'tools', 'clang', 'tools', 'extra')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('libcxx-*', os.path.join(self.llvm_src_dir, 'projects', 'libcxx')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('libcxxabi-*', os.path.join(self.llvm_src_dir, 'projects', 'libcxxabi')) - - if LooseVersion(self.version) >= LooseVersion('3.8'): - find_source_dir('openmp-*', os.path.join(self.llvm_src_dir, 'projects', 'openmp')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('ldd-*', os.path.join(self.llvm_src_dir, 'tools', 'ldd')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('lddb-*', os.path.join(self.llvm_src_dir, 'tools', 'lddb')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('libunwind-*', os.path.join(self.llvm_src_dir, 'tools', 'libunwind')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('test-*', os.path.join(self.llvm_src_dir, 'tools', 'testsuite')) - - for src in self.src: - for (dirname, new_path) in src_dirs.items(): - if src['name'].startswith(dirname): - old_path = os.path.join(src['finalpath'], dirname) - try: - shutil.move(old_path, new_path) - except IOError, err: - raise EasyBuildError("Failed to move %s to %s: %s", old_path, new_path, err) - src['finalpath'] = new_path - break - - def configure_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).configure_step() - return - - """Run CMake for stage 1 Clang.""" - self.llvm_obj_dir_stage1 = os.path.join(self.builddir, 'llvm.obj.1') - if self.cfg['bootstrap']: - self.llvm_obj_dir_stage2 = os.path.join(self.builddir, 'llvm.obj.2') - self.llvm_obj_dir_stage3 = os.path.join(self.builddir, 'llvm.obj.3') - - if LooseVersion(self.version) >= LooseVersion('3.3'): - disable_san_tests = False - # all sanitizer tests will fail when there's a limit on the vmem - # this is ugly but I haven't found a cleaner way so far - (vmemlim, ec) = run_cmd("ulimit -v", regexp=False) - if not vmemlim.startswith("unlimited"): - disable_san_tests = True - self.log.warn("There is a virtual memory limit set of %s KB. The tests of the " - "sanitizers will be disabled as they need unlimited virtual " - "memory unless --strict=error is used." % vmemlim.strip()) - - # the same goes for unlimited stacksize - (stacklim, ec) = run_cmd("ulimit -s", regexp=False) - if stacklim.startswith("unlimited"): - disable_san_tests = True - self.log.warn("The stacksize limit is set to unlimited. This causes the ThreadSanitizer " - "to fail. The sanitizers tests will be disabled unless --strict=error is used.") - - if (disable_san_tests or self.cfg['skip_sanitizer_tests']) and build_option('strict') != run.ERROR: - self.log.debug("Disabling the sanitizer tests") - self.disable_sanitizer_tests() - - # Create and enter build directory. - mkdir(self.llvm_obj_dir_stage1) - os.chdir(self.llvm_obj_dir_stage1) - - # GCC and Clang are installed in different prefixes and Clang will not - # find the GCC installation on its own. - # First try with GCCcore, as GCC built on top of GCCcore is just a wrapper for GCCcore and binutils, - # instead of a full-fledge compiler - gcc_prefix = get_software_root('GCCcore') - - # If that doesn't work, try with GCC - if gcc_prefix is None: - gcc_prefix = get_software_root('GCC') - - # If that doesn't work either, print error and exit - if gcc_prefix is None: - raise EasyBuildError("Can't find GCC or GCCcore to use") - - self.cfg.update('configopts', "-DGCC_INSTALL_PREFIX='%s' " % gcc_prefix) - self.log.debug("Using %s as GCC_INSTALL_PREFIX", gcc_prefix) - - self.cfg['configopts'] += "-DCMAKE_BUILD_TYPE=Release " - if self.cfg['assertions']: - self.cfg['configopts'] += "-DLLVM_ENABLE_ASSERTIONS=ON " - else: - self.cfg['configopts'] += "-DLLVM_ENABLE_ASSERTIONS=OFF " - - self.cfg['configopts'] += '-DLLVM_TARGETS_TO_BUILD="%s" ' % ';'.join(self.cfg['build_targets']) - - if self.cfg['parallel']: - self.make_parallel_opts = "-j %s" % self.cfg['parallel'] - - self.log.info("Configuring") - super(EB_Clang, self).configure_step(srcdir=self.llvm_src_dir) - - def disable_sanitizer_tests(self): - """Disable the tests of all the sanitizers by removing the test directories from the build system""" - if LooseVersion(self.version) < LooseVersion('3.6'): - # for Clang 3.5 and lower, the tests are scattered over several CMakeLists. - # We loop over them, and patch out the rule that adds the sanitizers tests to the testsuite - patchfiles = [ - "lib/asan", - "lib/dfsan", - "lib/lsan", - "lib/msan", - "lib/tsan", - "lib/ubsan", - ] - - for patchfile in patchfiles: - patchfile_fp = os.path.join(self.llvm_src_dir, "projects/compiler-rt", patchfile, "CMakeLists.txt") - if os.path.exists(patchfile_fp): - self.log.debug("Patching %s in %s" % (patchfile, self.llvm_src_dir)) - try: - for line in fileinput.input(patchfile_fp, inplace=1, backup='.orig'): - if "add_subdirectory(lit_tests)" not in line: - sys.stdout.write(line) - except (IOError, OSError), err: - raise EasyBuildError("Failed to patch %s: %s", patchfile_fp, err) - else: - self.log.debug("Not patching non-existent %s in %s" % (patchfile, self.llvm_src_dir)) - - # There is a common part seperate for the specific saniters, we disable all - # the common tests - patchfile = "projects/compiler-rt/lib/sanitizer_common/CMakeLists.txt" - try: - for line in fileinput.input("%s/%s" % (self.llvm_src_dir, patchfile), inplace=1, backup='.orig'): - if "add_subdirectory(tests)" not in line: - sys.stdout.write(line) - except IOError, err: - raise EasyBuildError("Failed to patch %s/%s: %s", self.llvm_src_dir, patchfile, err) - else: - # In Clang 3.6, the sanitizer tests are grouped together in one CMakeLists - # We patch out adding the subdirectories with the sanitizer tests - patchfile = "projects/compiler-rt/test/CMakeLists.txt" - patchfile_fp = os.path.join(self.llvm_src_dir, patchfile) - self.log.debug("Patching %s in %s" % (patchfile, self.llvm_src_dir)) - patch_regex = re.compile(r'add_subdirectory\((.*san|sanitizer_common)\)') - try: - for line in fileinput.input(patchfile_fp, inplace=1, backup='.orig'): - if not patch_regex.search(line): - sys.stdout.write(line) - except IOError, err: - raise EasyBuildError("Failed to patch %s: %s", patchfile_fp, err) - - def build_with_prev_stage(self, prev_obj, next_obj): - """Build Clang stage N using Clang stage N-1""" - - # Create and enter build directory. - mkdir(next_obj) - os.chdir(next_obj) - - # Configure. - CC = os.path.join(prev_obj, 'bin', 'clang') - CXX = os.path.join(prev_obj, 'bin', 'clang++') - - options = "-DCMAKE_INSTALL_PREFIX=%s " % self.installdir - options += "-DCMAKE_C_COMPILER='%s' " % CC - options += "-DCMAKE_CXX_COMPILER='%s' " % CXX - options += self.cfg['configopts'] - - self.log.info("Configuring") - run_cmd("cmake %s %s" % (options, self.llvm_src_dir), log_all=True) - - self.log.info("Building") - run_cmd("make %s" % self.make_parallel_opts, log_all=True) - - def run_clang_tests(self, obj_dir): - os.chdir(obj_dir) - - self.log.info("Running tests") - run_cmd("make %s check-all" % self.make_parallel_opts, log_all=True) - - def build_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).build_step() - return - - """Build Clang stage 1, 2, 3""" - - # Stage 1: build using system compiler. - self.log.info("Building stage 1") - os.chdir(self.llvm_obj_dir_stage1) - super(EB_Clang, self).build_step() - - if self.cfg['bootstrap']: - # Stage 1: run tests. - self.run_clang_tests(self.llvm_obj_dir_stage1) - - self.log.info("Building stage 2") - self.build_with_prev_stage(self.llvm_obj_dir_stage1, self.llvm_obj_dir_stage2) - self.run_clang_tests(self.llvm_obj_dir_stage2) - - self.log.info("Building stage 3") - self.build_with_prev_stage(self.llvm_obj_dir_stage2, self.llvm_obj_dir_stage3) - # Don't run stage 3 tests here, do it in the test step. - - def test_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).test_step() - return - - if self.cfg['bootstrap']: - self.run_clang_tests(self.llvm_obj_dir_stage3) - else: - self.run_clang_tests(self.llvm_obj_dir_stage1) - - def install_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).install_step() - return - - """Install stage 3 binaries.""" - - if self.cfg['bootstrap']: - os.chdir(self.llvm_obj_dir_stage3) - else: - os.chdir(self.llvm_obj_dir_stage1) - super(EB_Clang, self).install_step() - - # the static analyzer is not installed by default - # we do it by hand - if self.cfg['static_analyzer'] and LooseVersion(self.version) < LooseVersion('3.8'): - try: - tools_src_dir = os.path.join(self.llvm_src_dir, 'tools', 'clang', 'tools') - analyzer_target_dir = os.path.join(self.installdir, 'libexec', 'clang-analyzer') - bindir = os.path.join(self.installdir, 'bin') - for scan_dir in ['scan-build', 'scan-view']: - shutil.copytree(os.path.join(tools_src_dir, scan_dir), os.path.join(analyzer_target_dir, scan_dir)) - os.symlink(os.path.relpath(bindir, os.path.join(analyzer_target_dir, scan_dir)), - os.path.join(analyzer_target_dir, scan_dir, 'bin')) - os.symlink(os.path.relpath(os.path.join(analyzer_target_dir, scan_dir, scan_dir), bindir), - os.path.join(bindir, scan_dir)) - - mandir = os.path.join(self.installdir, 'share', 'man', 'man1') - os.makedirs(mandir) - shutil.copy2(os.path.join(tools_src_dir, 'scan-build', 'scan-build.1'), mandir) - except OSError, err: - raise EasyBuildError("Failed to copy static analyzer dirs to install dir: %s", err) - - def sanity_check_step(self): - """Custom sanity check for Clang.""" - shlib_ext = get_shared_lib_ext() - custom_paths = { - 'files': [ - "bin/clang", "bin/clang++", "bin/llvm-ar", "bin/llvm-nm", "bin/llvm-as", "bin/opt", "bin/llvm-link", - "bin/llvm-config", "bin/llvm-symbolizer", "include/llvm-c/Core.h", "include/clang-c/Index.h", - "lib/libclang.%s" % shlib_ext, "lib/clang/%s/include/stddef.h" % self.version, - ], - 'dirs': ["include/clang", "include/llvm", "lib/clang/%s/lib" % self.version], - } - if self.cfg['static_analyzer']: - custom_paths['files'].extend(["bin/scan-build", "bin/scan-view"]) - - if self.cfg["usepolly"]: - custom_paths['files'].extend(["lib/LLVMPolly.%s" % shlib_ext]) - custom_paths['dirs'].extend(["include/polly"]) - - if LooseVersion(self.version) >= LooseVersion('3.8'): - custom_paths['files'].extend(["lib/libomp.%s" % shlib_ext, "lib/clang/%s/include/omp.h" % self.version]) - - super(EB_Clang, self).sanity_check_step(custom_paths=custom_paths) - - def make_module_extra(self): - """Custom variables for Clang module.""" - txt = super(EB_Clang, self).make_module_extra() - # we set the symbolizer path so that asan/tsan give meanfull output by default - asan_symbolizer_path = os.path.join(self.installdir, 'bin', 'llvm-symbolizer') - txt += self.module_generator.set_environment('ASAN_SYMBOLIZER_PATH', asan_symbolizer_path) - return txt diff --git a/easyblocks/c/clang.py b/easyblocks/c/clang.py deleted file mode 100644 index 18edaee51acf8411cde3da4a46708c90cfd8f0a8..0000000000000000000000000000000000000000 --- a/easyblocks/c/clang.py +++ /dev/null @@ -1,420 +0,0 @@ -## -# Copyright 2013 Dmitri Gribenko -# Copyright 2013-2017 Ghent University -# Copyright 2017 IT4Innovations -# -# This file is triple-licensed under GPLv2 (see below), MIT, and -# BSD three-clause licenses. -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), -# Flemish Research Foundation (FWO) (http://www.fwo.be/en) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# https://github.com/easybuilders/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. -## -""" -Support for building and installing Clang, implemented as an easyblock. - -@author: Dmitri Gribenko (National Technical University of Ukraine "KPI") -@author: Ward Poelmans (Ghent University) -@author: Josef Hrabal, Lukas Krupcik (IT4innovations, Czechia) -""" - -import fileinput -import glob -import os -import re -import shutil -import sys -from distutils.version import LooseVersion - -from easybuild.easyblocks.generic.cmakemake import CMakeMake -from easybuild.framework.easyconfig import CUSTOM -from easybuild.tools import run -from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.config import build_option -from easybuild.tools.filetools import mkdir -from easybuild.tools.modules import get_software_root -from easybuild.tools.run import run_cmd -from easybuild.tools.systemtools import get_os_name, get_os_version, get_shared_lib_ext - -# List of all possible build targets for Clang -CLANG_TARGETS = ["all", "AArch64", "ARM", "CppBackend", "Hexagon", "Mips", - "MBlaze", "MSP430", "NVPTX", "PowerPC", "R600", "Sparc", - "SystemZ", "X86", "XCore"] - - -class EB_Clang(CMakeMake): - """Support for bootstrapping Clang.""" - - @staticmethod - def extra_options(): - extra_vars = { - 'assertions': [True, "Enable assertions. Helps to catch bugs in Clang.", CUSTOM], - 'build_targets': [["X86"], "Build targets for LLVM. Possible values: " + ', '.join(CLANG_TARGETS), CUSTOM], - 'bootstrap': [True, "Bootstrap Clang using GCC", CUSTOM], - 'usepolly': [False, "Build Clang with polly", CUSTOM], - 'static_analyzer': [True, "Install the static analyser of Clang", CUSTOM], - # The sanitizer tests often fail on HPC systems due to the 'weird' environment. - 'skip_sanitizer_tests': [False, "Do not run the sanitizer tests", CUSTOM], - } - - return CMakeMake.extra_options(extra_vars) - - def __init__(self, *args, **kwargs): - """Initialize custom class variables for Clang.""" - - super(EB_Clang, self).__init__(*args, **kwargs) - self.llvm_src_dir = None - self.llvm_obj_dir_stage1 = None - self.llvm_obj_dir_stage2 = None - self.llvm_obj_dir_stage3 = None - self.make_parallel_opts = "" - - unknown_targets = [target for target in self.cfg['build_targets'] if target not in CLANG_TARGETS] - - if unknown_targets: - raise EasyBuildError("Some of the chosen build targets (%s) are not in %s.", - ', '.join(unknown_targets), ', '.join(CLANG_TARGETS)) - - if LooseVersion(self.version) < LooseVersion('3.4') and "R600" in self.cfg['build_targets']: - raise EasyBuildError("Build target R600 not supported in < Clang-3.4") - - if LooseVersion(self.version) > LooseVersion('3.3') and "MBlaze" in self.cfg['build_targets']: - raise EasyBuildError("Build target MBlaze is not supported anymore in > Clang-3.3") - - def check_readiness_step(self): - """Fail early on RHEL 5.x and derivatives because of known bug in libc.""" - super(EB_Clang, self).check_readiness_step() - # RHEL 5.x have a buggy libc. Building stage 2 will fail. - if get_os_name() in ['redhat', 'RHEL', 'centos', 'SL'] and get_os_version().startswith('5.'): - raise EasyBuildError("Can not build Clang on %s v5.x: libc is buggy, building stage 2 will fail. " - "See http://stackoverflow.com/questions/7276828/", get_os_name()) - - def extract_step(self): - """ - Prepare a combined LLVM source tree. The layout is: - llvm/ Unpack llvm-*.tar.gz here - projects/ - compiler-rt/ Unpack compiler-rt-*.tar.gz here - openmp/ Unpack openmp-*.tar.xz here - libcxx/ Unpack libcxx-*.tar.xz here - libcxxabi/ Unpack libcxxapbi-*.tar.xz here - tools/ - clang/ Unpack cfe-*.tar.gz here - tools/extra Unpack clang-*.tar.gz here - polly/ Unpack polly-*.tar.gz here - """ - - # Extract everything into separate directories. - super(EB_Clang, self).extract_step() - - # Find the full path to the directory that was unpacked from llvm-*.tar.gz. - for tmp in self.src: - if tmp['name'].startswith("llvm-"): - self.llvm_src_dir = tmp['finalpath'] - break - - if self.llvm_src_dir is None: - raise EasyBuildError("Could not determine LLVM source root (LLVM source was not unpacked?)") - - src_dirs = {} - - def find_source_dir(globpatterns, targetdir): - """Search for directory with globpattern and rename it to targetdir""" - if not isinstance(globpatterns, list): - globpatterns = [globpatterns] - - glob_src_dirs = [glob_dir for globpattern in globpatterns for glob_dir in glob.glob(globpattern)] - if len(glob_src_dirs) != 1: - raise EasyBuildError("Failed to find exactly one source directory for pattern %s: %s", globpatterns, - glob_src_dirs) - src_dirs[glob_src_dirs[0]] = targetdir - - find_source_dir('compiler-rt-*', os.path.join(self.llvm_src_dir, 'projects', 'compiler-rt')) - - if self.cfg["usepolly"]: - find_source_dir('polly-*', os.path.join(self.llvm_src_dir, 'tools', 'polly')) - - find_source_dir('cfe-*', os.path.join(self.llvm_src_dir, 'tools', 'clang')) - - find_source_dir('clang-*', os.path.join(self.llvm_src_dir, 'tools', 'clang', 'tools', 'extra')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('libcxx-*', os.path.join(self.llvm_src_dir, 'projects', 'libcxx')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('libcxxabi-*', os.path.join(self.llvm_src_dir, 'projects', 'libcxxabi')) - - if LooseVersion(self.version) >= LooseVersion('3.8'): - find_source_dir('openmp-*', os.path.join(self.llvm_src_dir, 'projects', 'openmp')) - - for src in self.src: - for (dirname, new_path) in src_dirs.items(): - if src['name'].startswith(dirname): - old_path = os.path.join(src['finalpath'], dirname) - try: - shutil.move(old_path, new_path) - except IOError, err: - raise EasyBuildError("Failed to move %s to %s: %s", old_path, new_path, err) - src['finalpath'] = new_path - break - - def configure_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).configure_step() - return - - """Run CMake for stage 1 Clang.""" - self.llvm_obj_dir_stage1 = os.path.join(self.builddir, 'llvm.obj.1') - if self.cfg['bootstrap']: - self.llvm_obj_dir_stage2 = os.path.join(self.builddir, 'llvm.obj.2') - self.llvm_obj_dir_stage3 = os.path.join(self.builddir, 'llvm.obj.3') - - if LooseVersion(self.version) >= LooseVersion('3.3'): - disable_san_tests = False - # all sanitizer tests will fail when there's a limit on the vmem - # this is ugly but I haven't found a cleaner way so far - (vmemlim, ec) = run_cmd("ulimit -v", regexp=False) - if not vmemlim.startswith("unlimited"): - disable_san_tests = True - self.log.warn("There is a virtual memory limit set of %s KB. The tests of the " - "sanitizers will be disabled as they need unlimited virtual " - "memory unless --strict=error is used." % vmemlim.strip()) - - # the same goes for unlimited stacksize - (stacklim, ec) = run_cmd("ulimit -s", regexp=False) - if stacklim.startswith("unlimited"): - disable_san_tests = True - self.log.warn("The stacksize limit is set to unlimited. This causes the ThreadSanitizer " - "to fail. The sanitizers tests will be disabled unless --strict=error is used.") - - if (disable_san_tests or self.cfg['skip_sanitizer_tests']) and build_option('strict') != run.ERROR: - self.log.debug("Disabling the sanitizer tests") - self.disable_sanitizer_tests() - - # Create and enter build directory. - mkdir(self.llvm_obj_dir_stage1) - os.chdir(self.llvm_obj_dir_stage1) - - # GCC and Clang are installed in different prefixes and Clang will not - # find the GCC installation on its own. - # First try with GCCcore, as GCC built on top of GCCcore is just a wrapper for GCCcore and binutils, - # instead of a full-fledge compiler - gcc_prefix = get_software_root('GCCcore') - - # If that doesn't work, try with GCC - if gcc_prefix is None: - gcc_prefix = get_software_root('GCC') - - # If that doesn't work either, print error and exit - if gcc_prefix is None: - raise EasyBuildError("Can't find GCC or GCCcore to use") - - self.cfg.update('configopts', "-DGCC_INSTALL_PREFIX='%s' " % gcc_prefix) - self.log.debug("Using %s as GCC_INSTALL_PREFIX", gcc_prefix) - - self.cfg['configopts'] += "-DCMAKE_BUILD_TYPE=Release " - if self.cfg['assertions']: - self.cfg['configopts'] += "-DLLVM_ENABLE_ASSERTIONS=ON " - else: - self.cfg['configopts'] += "-DLLVM_ENABLE_ASSERTIONS=OFF " - - self.cfg['configopts'] += '-DLLVM_TARGETS_TO_BUILD="%s" ' % ';'.join(self.cfg['build_targets']) - - if self.cfg['parallel']: - self.make_parallel_opts = "-j %s" % self.cfg['parallel'] - - self.log.info("Configuring") - super(EB_Clang, self).configure_step(srcdir=self.llvm_src_dir) - - def disable_sanitizer_tests(self): - """Disable the tests of all the sanitizers by removing the test directories from the build system""" - if LooseVersion(self.version) < LooseVersion('3.6'): - # for Clang 3.5 and lower, the tests are scattered over several CMakeLists. - # We loop over them, and patch out the rule that adds the sanitizers tests to the testsuite - patchfiles = [ - "lib/asan", - "lib/dfsan", - "lib/lsan", - "lib/msan", - "lib/tsan", - "lib/ubsan", - ] - - for patchfile in patchfiles: - patchfile_fp = os.path.join(self.llvm_src_dir, "projects/compiler-rt", patchfile, "CMakeLists.txt") - if os.path.exists(patchfile_fp): - self.log.debug("Patching %s in %s" % (patchfile, self.llvm_src_dir)) - try: - for line in fileinput.input(patchfile_fp, inplace=1, backup='.orig'): - if "add_subdirectory(lit_tests)" not in line: - sys.stdout.write(line) - except (IOError, OSError), err: - raise EasyBuildError("Failed to patch %s: %s", patchfile_fp, err) - else: - self.log.debug("Not patching non-existent %s in %s" % (patchfile, self.llvm_src_dir)) - - # There is a common part seperate for the specific saniters, we disable all - # the common tests - patchfile = "projects/compiler-rt/lib/sanitizer_common/CMakeLists.txt" - try: - for line in fileinput.input("%s/%s" % (self.llvm_src_dir, patchfile), inplace=1, backup='.orig'): - if "add_subdirectory(tests)" not in line: - sys.stdout.write(line) - except IOError, err: - raise EasyBuildError("Failed to patch %s/%s: %s", self.llvm_src_dir, patchfile, err) - else: - # In Clang 3.6, the sanitizer tests are grouped together in one CMakeLists - # We patch out adding the subdirectories with the sanitizer tests - patchfile = "projects/compiler-rt/test/CMakeLists.txt" - patchfile_fp = os.path.join(self.llvm_src_dir, patchfile) - self.log.debug("Patching %s in %s" % (patchfile, self.llvm_src_dir)) - patch_regex = re.compile(r'add_subdirectory\((.*san|sanitizer_common)\)') - try: - for line in fileinput.input(patchfile_fp, inplace=1, backup='.orig'): - if not patch_regex.search(line): - sys.stdout.write(line) - except IOError, err: - raise EasyBuildError("Failed to patch %s: %s", patchfile_fp, err) - - def build_with_prev_stage(self, prev_obj, next_obj): - """Build Clang stage N using Clang stage N-1""" - - # Create and enter build directory. - mkdir(next_obj) - os.chdir(next_obj) - - # Configure. - CC = os.path.join(prev_obj, 'bin', 'clang') - CXX = os.path.join(prev_obj, 'bin', 'clang++') - - options = "-DCMAKE_INSTALL_PREFIX=%s " % self.installdir - options += "-DCMAKE_C_COMPILER='%s' " % CC - options += "-DCMAKE_CXX_COMPILER='%s' " % CXX - options += self.cfg['configopts'] - - self.log.info("Configuring") - run_cmd("cmake %s %s" % (options, self.llvm_src_dir), log_all=True) - - self.log.info("Building") - run_cmd("make %s" % self.make_parallel_opts, log_all=True) - - def run_clang_tests(self, obj_dir): - os.chdir(obj_dir) - - self.log.info("Running tests") - run_cmd("make %s check-all" % self.make_parallel_opts, log_all=True) - - def build_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).build_step() - return - - """Build Clang stage 1, 2, 3""" - - # Stage 1: build using system compiler. - self.log.info("Building stage 1") - os.chdir(self.llvm_obj_dir_stage1) - super(EB_Clang, self).build_step() - - if self.cfg['bootstrap']: - # Stage 1: run tests. - self.run_clang_tests(self.llvm_obj_dir_stage1) - - self.log.info("Building stage 2") - self.build_with_prev_stage(self.llvm_obj_dir_stage1, self.llvm_obj_dir_stage2) - self.run_clang_tests(self.llvm_obj_dir_stage2) - - self.log.info("Building stage 3") - self.build_with_prev_stage(self.llvm_obj_dir_stage2, self.llvm_obj_dir_stage3) - # Don't run stage 3 tests here, do it in the test step. - - def test_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).test_step() - return - - if self.cfg['bootstrap']: - self.run_clang_tests(self.llvm_obj_dir_stage3) - else: - self.run_clang_tests(self.llvm_obj_dir_stage1) - - def install_step(self): - if LooseVersion(self.version) >= LooseVersion('5.0'): - super(EB_Clang, self).install_step() - return - - """Install stage 3 binaries.""" - - if self.cfg['bootstrap']: - os.chdir(self.llvm_obj_dir_stage3) - else: - os.chdir(self.llvm_obj_dir_stage1) - super(EB_Clang, self).install_step() - - # the static analyzer is not installed by default - # we do it by hand - if self.cfg['static_analyzer'] and LooseVersion(self.version) < LooseVersion('3.8'): - try: - tools_src_dir = os.path.join(self.llvm_src_dir, 'tools', 'clang', 'tools') - analyzer_target_dir = os.path.join(self.installdir, 'libexec', 'clang-analyzer') - bindir = os.path.join(self.installdir, 'bin') - for scan_dir in ['scan-build', 'scan-view']: - shutil.copytree(os.path.join(tools_src_dir, scan_dir), os.path.join(analyzer_target_dir, scan_dir)) - os.symlink(os.path.relpath(bindir, os.path.join(analyzer_target_dir, scan_dir)), - os.path.join(analyzer_target_dir, scan_dir, 'bin')) - os.symlink(os.path.relpath(os.path.join(analyzer_target_dir, scan_dir, scan_dir), bindir), - os.path.join(bindir, scan_dir)) - - mandir = os.path.join(self.installdir, 'share', 'man', 'man1') - os.makedirs(mandir) - shutil.copy2(os.path.join(tools_src_dir, 'scan-build', 'scan-build.1'), mandir) - except OSError, err: - raise EasyBuildError("Failed to copy static analyzer dirs to install dir: %s", err) - - def sanity_check_step(self): - """Custom sanity check for Clang.""" - shlib_ext = get_shared_lib_ext() - custom_paths = { - 'files': [ - "bin/clang", "bin/clang++", "bin/llvm-ar", "bin/llvm-nm", "bin/llvm-as", "bin/opt", "bin/llvm-link", - "bin/llvm-config", "bin/llvm-symbolizer", "include/llvm-c/Core.h", "include/clang-c/Index.h", - "lib/libclang.%s" % shlib_ext, "lib/clang/%s/include/stddef.h" % self.version, - ], - 'dirs': ["include/clang", "include/llvm", "lib/clang/%s/lib" % self.version], - } - if self.cfg['static_analyzer']: - custom_paths['files'].extend(["bin/scan-build", "bin/scan-view"]) - - if self.cfg["usepolly"]: - custom_paths['files'].extend(["lib/LLVMPolly.%s" % shlib_ext]) - custom_paths['dirs'].extend(["include/polly"]) - - if LooseVersion(self.version) >= LooseVersion('3.8'): - custom_paths['files'].extend(["lib/libomp.%s" % shlib_ext, "lib/clang/%s/include/omp.h" % self.version]) - - super(EB_Clang, self).sanity_check_step(custom_paths=custom_paths) - - def make_module_extra(self): - """Custom variables for Clang module.""" - txt = super(EB_Clang, self).make_module_extra() - # we set the symbolizer path so that asan/tsan give meanfull output by default - asan_symbolizer_path = os.path.join(self.installdir, 'bin', 'llvm-symbolizer') - txt += self.module_generator.set_environment('ASAN_SYMBOLIZER_PATH', asan_symbolizer_path) - return txt diff --git a/easyblocks/c/clang.py.old b/easyblocks/c/clang.py.old deleted file mode 100644 index e0b60edd5711bfaf160e7fbb3ec52902fd149a04..0000000000000000000000000000000000000000 --- a/easyblocks/c/clang.py.old +++ /dev/null @@ -1,403 +0,0 @@ -## -# Copyright 2013 Dmitri Gribenko -# Copyright 2013-2017 Ghent University -# -# This file is triple-licensed under GPLv2 (see below), MIT, and -# BSD three-clause licenses. -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), -# Flemish Research Foundation (FWO) (http://www.fwo.be/en) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# https://github.com/easybuilders/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. -## -""" -Support for building and installing Clang, implemented as an easyblock. - -@author: Dmitri Gribenko (National Technical University of Ukraine "KPI") -@author: Ward Poelmans (Ghent University) -""" - -import fileinput -import glob -import os -import re -import shutil -import sys -from distutils.version import LooseVersion - -from easybuild.easyblocks.generic.cmakemake import CMakeMake -from easybuild.framework.easyconfig import CUSTOM -from easybuild.tools import run -from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.config import build_option -from easybuild.tools.filetools import mkdir -from easybuild.tools.modules import get_software_root -from easybuild.tools.run import run_cmd -from easybuild.tools.systemtools import get_os_name, get_os_version, get_shared_lib_ext - -# List of all possible build targets for Clang -CLANG_TARGETS = ["all", "AArch64", "ARM", "CppBackend", "Hexagon", "Mips", - "MBlaze", "MSP430", "NVPTX", "PowerPC", "R600", "Sparc", - "SystemZ", "X86", "XCore"] - - -class EB_Clang(CMakeMake): - """Support for bootstrapping Clang.""" - - @staticmethod - def extra_options(): - extra_vars = { - 'assertions': [True, "Enable assertions. Helps to catch bugs in Clang.", CUSTOM], - 'build_targets': [["X86"], "Build targets for LLVM. Possible values: " + ', '.join(CLANG_TARGETS), CUSTOM], - 'bootstrap': [True, "Bootstrap Clang using GCC", CUSTOM], - 'usepolly': [False, "Build Clang with polly", CUSTOM], - 'static_analyzer': [True, "Install the static analyser of Clang", CUSTOM], - # The sanitizer tests often fail on HPC systems due to the 'weird' environment. - 'skip_sanitizer_tests': [False, "Do not run the sanitizer tests", CUSTOM], - } - - return CMakeMake.extra_options(extra_vars) - - def __init__(self, *args, **kwargs): - """Initialize custom class variables for Clang.""" - - super(EB_Clang, self).__init__(*args, **kwargs) - self.llvm_src_dir = None - self.llvm_obj_dir_stage1 = None - self.llvm_obj_dir_stage2 = None - self.llvm_obj_dir_stage3 = None - self.make_parallel_opts = "" - - unknown_targets = [target for target in self.cfg['build_targets'] if target not in CLANG_TARGETS] - - if unknown_targets: - raise EasyBuildError("Some of the chosen build targets (%s) are not in %s.", - ', '.join(unknown_targets), ', '.join(CLANG_TARGETS)) - - if LooseVersion(self.version) < LooseVersion('3.4') and "R600" in self.cfg['build_targets']: - raise EasyBuildError("Build target R600 not supported in < Clang-3.4") - - if LooseVersion(self.version) > LooseVersion('3.3') and "MBlaze" in self.cfg['build_targets']: - raise EasyBuildError("Build target MBlaze is not supported anymore in > Clang-3.3") - - def check_readiness_step(self): - """Fail early on RHEL 5.x and derivatives because of known bug in libc.""" - super(EB_Clang, self).check_readiness_step() - # RHEL 5.x have a buggy libc. Building stage 2 will fail. - if get_os_name() in ['redhat', 'RHEL', 'centos', 'SL'] and get_os_version().startswith('5.'): - raise EasyBuildError("Can not build Clang on %s v5.x: libc is buggy, building stage 2 will fail. " - "See http://stackoverflow.com/questions/7276828/", get_os_name()) - - def extract_step(self): - """ - Prepare a combined LLVM source tree. The layout is: - llvm/ Unpack llvm-*.tar.gz here - projects/ - compiler-rt/ Unpack compiler-rt-*.tar.gz here - openmp/ Unpack openmp-*.tar.xz here - libcxx/ - libcxxabi/ - tools/ - clang/ Unpack clang-*.tar.gz here - clang/tools/extra - polly/ Unpack polly-*.tar.gz here - """ - - # Extract everything into separate directories. - super(EB_Clang, self).extract_step() - - # Find the full path to the directory that was unpacked from llvm-*.tar.gz. - for tmp in self.src: - if tmp['name'].startswith("llvm-"): - self.llvm_src_dir = tmp['finalpath'] - break - - if self.llvm_src_dir is None: - raise EasyBuildError("Could not determine LLVM source root (LLVM source was not unpacked?)") - - src_dirs = {} - - def find_source_dir(globpatterns, targetdir): - """Search for directory with globpattern and rename it to targetdir""" - if not isinstance(globpatterns, list): - globpatterns = [globpatterns] - - glob_src_dirs = [glob_dir for globpattern in globpatterns for glob_dir in glob.glob(globpattern)] - if len(glob_src_dirs) != 1: - raise EasyBuildError("Failed to find exactly one source directory for pattern %s: %s", globpatterns, - glob_src_dirs) - src_dirs[glob_src_dirs[0]] = targetdir - - find_source_dir('compiler-rt-*', os.path.join(self.llvm_src_dir, 'projects', 'compiler-rt')) - - if self.cfg["usepolly"]: - find_source_dir('polly-*', os.path.join(self.llvm_src_dir, 'tools', 'polly')) - - find_source_dir('cfe-*', os.path.join(self.llvm_src_dir, 'tools', 'clang')) - - find_source_dir('clang-*', os.path.join(self.llvm_src_dir, 'tools', 'clang', 'tools', 'extra')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('libcxx-*', os.path.join(self.llvm_src_dir, 'projects', 'libcxx')) - - if LooseVersion(self.version) >= LooseVersion('5.0'): - find_source_dir('libcxxabi-*', os.path.join(self.llvm_src_dir, 'projects', 'libcxxabi')) - - if LooseVersion(self.version) >= LooseVersion('3.8'): - find_source_dir('openmp-*', os.path.join(self.llvm_src_dir, 'projects', 'openmp')) - - for src in self.src: - for (dirname, new_path) in src_dirs.items(): - if src['name'].startswith(dirname): - old_path = os.path.join(src['finalpath'], dirname) - try: - shutil.move(old_path, new_path) - except IOError, err: - raise EasyBuildError("Failed to move %s to %s: %s", old_path, new_path, err) - src['finalpath'] = new_path - break - - def configure_step(self): - """Run CMake for stage 1 Clang.""" - - self.llvm_obj_dir_stage1 = os.path.join(self.builddir, 'llvm.obj.1') - if self.cfg['bootstrap']: - self.llvm_obj_dir_stage2 = os.path.join(self.builddir, 'llvm.obj.2') - self.llvm_obj_dir_stage3 = os.path.join(self.builddir, 'llvm.obj.3') - - if LooseVersion(self.version) >= LooseVersion('3.3'): - disable_san_tests = False - # all sanitizer tests will fail when there's a limit on the vmem - # this is ugly but I haven't found a cleaner way so far - (vmemlim, ec) = run_cmd("ulimit -v", regexp=False) - if not vmemlim.startswith("unlimited"): - disable_san_tests = True - self.log.warn("There is a virtual memory limit set of %s KB. The tests of the " - "sanitizers will be disabled as they need unlimited virtual " - "memory unless --strict=error is used." % vmemlim.strip()) - - # the same goes for unlimited stacksize - (stacklim, ec) = run_cmd("ulimit -s", regexp=False) - if stacklim.startswith("unlimited"): - disable_san_tests = True - self.log.warn("The stacksize limit is set to unlimited. This causes the ThreadSanitizer " - "to fail. The sanitizers tests will be disabled unless --strict=error is used.") - - if (disable_san_tests or self.cfg['skip_sanitizer_tests']) and build_option('strict') != run.ERROR: - self.log.debug("Disabling the sanitizer tests") - self.disable_sanitizer_tests() - - # Create and enter build directory. - mkdir(self.llvm_obj_dir_stage1) - os.chdir(self.llvm_obj_dir_stage1) - - # GCC and Clang are installed in different prefixes and Clang will not - # find the GCC installation on its own. - # First try with GCCcore, as GCC built on top of GCCcore is just a wrapper for GCCcore and binutils, - # instead of a full-fledge compiler - gcc_prefix = get_software_root('GCCcore') - - # If that doesn't work, try with GCC - if gcc_prefix is None: - gcc_prefix = get_software_root('GCC') - - # If that doesn't work either, print error and exit - if gcc_prefix is None: - raise EasyBuildError("Can't find GCC or GCCcore to use") - - self.cfg.update('configopts', "-DGCC_INSTALL_PREFIX='%s' " % gcc_prefix) - self.log.debug("Using %s as GCC_INSTALL_PREFIX", gcc_prefix) - - self.cfg['configopts'] += "-DCMAKE_BUILD_TYPE=Release " - if self.cfg['assertions']: - self.cfg['configopts'] += "-DLLVM_ENABLE_ASSERTIONS=ON " - else: - self.cfg['configopts'] += "-DLLVM_ENABLE_ASSERTIONS=OFF " - - self.cfg['configopts'] += '-DLLVM_TARGETS_TO_BUILD="%s" ' % ';'.join(self.cfg['build_targets']) - - if self.cfg['parallel']: - self.make_parallel_opts = "-j %s" % self.cfg['parallel'] - - self.log.info("Configuring") - super(EB_Clang, self).configure_step(srcdir=self.llvm_src_dir) - - def disable_sanitizer_tests(self): - """Disable the tests of all the sanitizers by removing the test directories from the build system""" - if LooseVersion(self.version) < LooseVersion('3.6'): - # for Clang 3.5 and lower, the tests are scattered over several CMakeLists. - # We loop over them, and patch out the rule that adds the sanitizers tests to the testsuite - patchfiles = [ - "lib/asan", - "lib/dfsan", - "lib/lsan", - "lib/msan", - "lib/tsan", - "lib/ubsan", - ] - - for patchfile in patchfiles: - patchfile_fp = os.path.join(self.llvm_src_dir, "projects/compiler-rt", patchfile, "CMakeLists.txt") - if os.path.exists(patchfile_fp): - self.log.debug("Patching %s in %s" % (patchfile, self.llvm_src_dir)) - try: - for line in fileinput.input(patchfile_fp, inplace=1, backup='.orig'): - if "add_subdirectory(lit_tests)" not in line: - sys.stdout.write(line) - except (IOError, OSError), err: - raise EasyBuildError("Failed to patch %s: %s", patchfile_fp, err) - else: - self.log.debug("Not patching non-existent %s in %s" % (patchfile, self.llvm_src_dir)) - - # There is a common part seperate for the specific saniters, we disable all - # the common tests - patchfile = "projects/compiler-rt/lib/sanitizer_common/CMakeLists.txt" - try: - for line in fileinput.input("%s/%s" % (self.llvm_src_dir, patchfile), inplace=1, backup='.orig'): - if "add_subdirectory(tests)" not in line: - sys.stdout.write(line) - except IOError, err: - raise EasyBuildError("Failed to patch %s/%s: %s", self.llvm_src_dir, patchfile, err) - else: - # In Clang 3.6, the sanitizer tests are grouped together in one CMakeLists - # We patch out adding the subdirectories with the sanitizer tests - patchfile = "projects/compiler-rt/test/CMakeLists.txt" - patchfile_fp = os.path.join(self.llvm_src_dir, patchfile) - self.log.debug("Patching %s in %s" % (patchfile, self.llvm_src_dir)) - patch_regex = re.compile(r'add_subdirectory\((.*san|sanitizer_common)\)') - try: - for line in fileinput.input(patchfile_fp, inplace=1, backup='.orig'): - if not patch_regex.search(line): - sys.stdout.write(line) - except IOError, err: - raise EasyBuildError("Failed to patch %s: %s", patchfile_fp, err) - - def build_with_prev_stage(self, prev_obj, next_obj): - """Build Clang stage N using Clang stage N-1""" - - # Create and enter build directory. - mkdir(next_obj) - os.chdir(next_obj) - - # Configure. - CC = os.path.join(prev_obj, 'bin', 'clang') - CXX = os.path.join(prev_obj, 'bin', 'clang++') - - options = "-DCMAKE_INSTALL_PREFIX=%s " % self.installdir - options += "-DCMAKE_C_COMPILER='%s' " % CC - options += "-DCMAKE_CXX_COMPILER='%s' " % CXX - options += self.cfg['configopts'] - - self.log.info("Configuring") - run_cmd("cmake %s %s" % (options, self.llvm_src_dir), log_all=True) - - self.log.info("Building") - run_cmd("make %s" % self.make_parallel_opts, log_all=True) - - def run_clang_tests(self, obj_dir): - os.chdir(obj_dir) - - self.log.info("Running tests") - run_cmd("make %s check-all" % self.make_parallel_opts, log_all=True) - - def build_step(self): - """Build Clang stage 1, 2, 3""" - - # Stage 1: build using system compiler. - self.log.info("Building stage 1") - os.chdir(self.llvm_obj_dir_stage1) - super(EB_Clang, self).build_step() - - if self.cfg['bootstrap']: - # Stage 1: run tests. - self.run_clang_tests(self.llvm_obj_dir_stage1) - - self.log.info("Building stage 2") - self.build_with_prev_stage(self.llvm_obj_dir_stage1, self.llvm_obj_dir_stage2) - self.run_clang_tests(self.llvm_obj_dir_stage2) - - self.log.info("Building stage 3") - self.build_with_prev_stage(self.llvm_obj_dir_stage2, self.llvm_obj_dir_stage3) - # Don't run stage 3 tests here, do it in the test step. - - def test_step(self): - if self.cfg['bootstrap']: - self.run_clang_tests(self.llvm_obj_dir_stage3) - else: - self.run_clang_tests(self.llvm_obj_dir_stage1) - - def install_step(self): - """Install stage 3 binaries.""" - - if self.cfg['bootstrap']: - os.chdir(self.llvm_obj_dir_stage3) - else: - os.chdir(self.llvm_obj_dir_stage1) - super(EB_Clang, self).install_step() - - # the static analyzer is not installed by default - # we do it by hand - if self.cfg['static_analyzer'] and LooseVersion(self.version) < LooseVersion('3.8'): - try: - tools_src_dir = os.path.join(self.llvm_src_dir, 'tools', 'clang', 'tools') - analyzer_target_dir = os.path.join(self.installdir, 'libexec', 'clang-analyzer') - bindir = os.path.join(self.installdir, 'bin') - for scan_dir in ['scan-build', 'scan-view']: - shutil.copytree(os.path.join(tools_src_dir, scan_dir), os.path.join(analyzer_target_dir, scan_dir)) - os.symlink(os.path.relpath(bindir, os.path.join(analyzer_target_dir, scan_dir)), - os.path.join(analyzer_target_dir, scan_dir, 'bin')) - os.symlink(os.path.relpath(os.path.join(analyzer_target_dir, scan_dir, scan_dir), bindir), - os.path.join(bindir, scan_dir)) - - mandir = os.path.join(self.installdir, 'share', 'man', 'man1') - os.makedirs(mandir) - shutil.copy2(os.path.join(tools_src_dir, 'scan-build', 'scan-build.1'), mandir) - except OSError, err: - raise EasyBuildError("Failed to copy static analyzer dirs to install dir: %s", err) - - def sanity_check_step(self): - """Custom sanity check for Clang.""" - shlib_ext = get_shared_lib_ext() - custom_paths = { - 'files': [ - "bin/clang", "bin/clang++", "bin/llvm-ar", "bin/llvm-nm", "bin/llvm-as", "bin/opt", "bin/llvm-link", - "bin/llvm-config", "bin/llvm-symbolizer", "include/llvm-c/Core.h", "include/clang-c/Index.h", - "lib/libclang.%s" % shlib_ext, "lib/clang/%s/include/stddef.h" % self.version, - ], - 'dirs': ["include/clang", "include/llvm", "lib/clang/%s/lib" % self.version], - } - if self.cfg['static_analyzer']: - custom_paths['files'].extend(["bin/scan-build", "bin/scan-view"]) - - if self.cfg["usepolly"]: - custom_paths['files'].extend(["lib/LLVMPolly.%s" % shlib_ext]) - custom_paths['dirs'].extend(["include/polly"]) - - if LooseVersion(self.version) >= LooseVersion('3.8'): - custom_paths['files'].extend(["lib/libomp.%s" % shlib_ext, "lib/clang/%s/include/omp.h" % self.version]) - - super(EB_Clang, self).sanity_check_step(custom_paths=custom_paths) - - def make_module_extra(self): - """Custom variables for Clang module.""" - txt = super(EB_Clang, self).make_module_extra() - # we set the symbolizer path so that asan/tsan give meanfull output by default - asan_symbolizer_path = os.path.join(self.installdir, 'bin', 'llvm-symbolizer') - txt += self.module_generator.set_environment('ASAN_SYMBOLIZER_PATH', asan_symbolizer_path) - return txt diff --git a/easyblocks/g/gcc.py b/easyblocks/g/gcc.py deleted file mode 100644 index 5d4017768f804f5519a939d9277136401c1b58a8..0000000000000000000000000000000000000000 --- a/easyblocks/g/gcc.py +++ /dev/null @@ -1,574 +0,0 @@ -## -# Copyright 2009-2015 Ghent University -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), -# the Hercules foundation (http://www.herculesstichting.be/in_English) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# http://github.com/hpcugent/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. -## -""" -EasyBuild support for building and installing GCC, implemented as an easyblock - -@author: Stijn De Weirdt (Ghent University) -@author: Dries Verdegem (Ghent University) -@author: Kenneth Hoste (Ghent University) -@author: Pieter De Baets (Ghent University) -@author: Jens Timmerman (Ghent University) -@author: Toon Willems (Ghent University) -@author: Ward Poelmans (Ghent University) -""" - -import os -import re -import shutil -from copy import copy -from distutils.version import LooseVersion -from vsc.utils.missing import any - -import easybuild.tools.environment as env -from easybuild.easyblocks.generic.configuremake import ConfigureMake -from easybuild.framework.easyconfig import CUSTOM -from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.modules import get_software_root -from easybuild.tools.run import run_cmd -from easybuild.tools.systemtools import check_os_dependency, get_os_name, get_os_type, get_shared_lib_ext, get_platform_name - - -class EB_GCC(ConfigureMake): - """ - Self-contained build of GCC. - Uses system compiler for initial build, then bootstraps. - """ - - @staticmethod - def extra_options(): - extra_vars = { - 'languages': [[], "List of languages to build GCC for (--enable-languages)", CUSTOM], - 'withlto': [True, "Enable LTO support", CUSTOM], - 'withcloog': [False, "Build GCC with CLooG support", CUSTOM], - 'withppl': [False, "Build GCC with PPL support", CUSTOM], - 'withisl': [False, "Build GCC with ISL support", CUSTOM], - 'pplwatchdog': [False, "Enable PPL watchdog", CUSTOM], - 'clooguseisl': [False, "Use ISL with CLooG or not", CUSTOM], - 'multilib': [False, "Build multilib gcc (both i386 and x86_64)", CUSTOM], - } - return ConfigureMake.extra_options(extra_vars) - - def __init__(self, *args, **kwargs): - super(EB_GCC, self).__init__(*args, **kwargs) - - self.stagedbuild = False - - if LooseVersion(self.version) >= LooseVersion("4.8.0") and self.cfg['clooguseisl'] and not self.cfg['withisl']: - raise EasyBuildError("Using ISL bundled with CLooG is unsupported in >=GCC-4.8.0. " - "Use a seperate ISL: set withisl=True") - - # I think ISL without CLooG has no purpose in GCC < 5.0.0 ... - if LooseVersion(self.version) < LooseVersion("5.0.0") and self.cfg['withisl'] and not self.cfg['withcloog']: - raise EasyBuildError("Activating ISL without CLooG is pointless") - - # unset some environment variables that are known to may cause nasty build errors when bootstrapping - self.cfg.update('unwanted_env_vars', ['CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH', 'OBJC_INCLUDE_PATH']) - # ubuntu needs the LIBRARY_PATH env var to work apparently (#363) - if get_os_name() not in ['ubuntu', 'debian']: - self.cfg.update('unwanted_env_vars', ['LIBRARY_PATH']) - - self.platform_lib = get_platform_name(withversion=True) - - def create_dir(self, dirname): - """ - Create a dir to build in. - """ - dirpath = os.path.join(self.cfg['start_dir'], dirname) - try: - os.mkdir(dirpath) - os.chdir(dirpath) - self.log.debug("Created dir at %s" % dirpath) - return dirpath - except OSError, err: - raise EasyBuildError("Can't use dir %s to build in: %s", dirpath, err) - - def prep_extra_src_dirs(self, stage, target_prefix=None): - """ - Prepare extra (optional) source directories, so GCC will build these as well. - """ - if LooseVersion(self.version) >= LooseVersion('4.5'): - known_stages = ["stage1", "stage2", "stage3"] - if stage not in known_stages: - raise EasyBuildError("Incorrect argument for prep_extra_src_dirs, should be one of: %s", known_stages) - - configopts = '' - if stage == "stage2": - # no MPFR/MPC needed in stage 2 - extra_src_dirs = ["gmp"] - else: - extra_src_dirs = ["gmp", "mpfr", "mpc"] - - # list of the extra dirs that are needed depending on the 'with%s' option - # the order is important: keep CLooG last! - self.with_dirs = ["isl", "ppl", "cloog"] - - # add optional ones that were selected (e.g. CLooG, PPL, ...) - for x in self.with_dirs: - if self.cfg['with%s' % x]: - extra_src_dirs.append(x) - - # see if modules are loaded - # if module is available, just use the --with-X GCC configure option - for extra in copy(extra_src_dirs): - envvar = get_software_root(extra) - if envvar: - configopts += " --with-%s=%s" % (extra, envvar) - extra_src_dirs.remove(extra) - elif extra in self.with_dirs and stage in ["stage1", "stage3"]: - # building CLooG or PPL or ISL requires a recent compiler - # our best bet is to do a 3-staged build of GCC, and - # build CLooG/PPL/ISL with the GCC we're building in stage 2 - # then (bootstrap) build GCC in stage 3 - # also, no need to stage cloog/ppl/isl in stage3 (may even cause troubles) - self.stagedbuild = True - extra_src_dirs.remove(extra) - - # try and find source directories with given prefixes - # these sources should be included in list of sources in .eb spec file, - # so EasyBuild can unpack them in the build dir - found_src_dirs = [] - versions = {} - names = {} - all_dirs = os.listdir(self.builddir) - for d in all_dirs: - for sd in extra_src_dirs: - if d.startswith(sd): - found_src_dirs.append({ - 'source_dir': d, - 'target_dir': sd - }) - # expected format: get_name[-subname]-get_version - ds = os.path.basename(d).split('-') - name = '-'.join(ds[0:-1]) - names.update({sd: name}) - ver = ds[-1] - versions.update({sd: ver}) - - # we need to find all dirs specified, or else... - if not len(found_src_dirs) == len(extra_src_dirs): - raise EasyBuildError("Couldn't find all source dirs %s: found %s from %s", - extra_src_dirs, found_src_dirs, all_dirs) - - # copy to a dir with name as expected by GCC build framework - for d in found_src_dirs: - src = os.path.join(self.builddir, d['source_dir']) - if target_prefix: - dst = os.path.join(target_prefix, d['target_dir']) - else: - dst = os.path.join(self.cfg['start_dir'], d['target_dir']) - if not os.path.exists(dst): - try: - shutil.copytree(src, dst) - except OSError, err: - raise EasyBuildError("Failed to copy src %s to dst %s: %s", src, dst, err) - self.log.debug("Copied %s to %s, so GCC can build %s" % (src, dst, d['target_dir'])) - else: - self.log.debug("No need to copy %s to %s, it's already there." % (src, dst)) - else: - # in versions prior to GCC v4.5, there's no support for extra source dirs, so return only empty info - configopts = '' - names = {} - versions = {} - - return { - 'configopts': configopts, - 'names': names, - 'versions': versions - } - - def run_configure_cmd(self, cmd): - """ - Run a configure command, with some extra checking (e.g. for unrecognized options). - """ - (out, ec) = run_cmd("%s %s" % (self.cfg['preconfigopts'], cmd), log_all=True, simple=False) - - if ec != 0: - raise EasyBuildError("Command '%s' exited with exit code != 0 (%s)", cmd, ec) - - # configure scripts tend to simply ignore unrecognized options - # we should be more strict here, because GCC is very much a moving target - unknown_re = re.compile("WARNING: unrecognized options") - - unknown_options = unknown_re.findall(out) - if unknown_options: - raise EasyBuildError("Unrecognized options found during configure: %s", unknown_options) - - def configure_step(self): - """ - Configure for GCC build: - - prepare extra source dirs (GMP, MPFR, MPC, ...) - - create obj dir to build in (GCC doesn't like to be built in source dir) - - add configure and make options, according to .eb spec file - - decide whether or not to do a staged build (which is required to enable PPL/CLooG support) - - set platform_lib based on config.guess output - """ - - # self.configopts will be reused in a 3-staged build, - # configopts is only used in first configure - self.configopts = self.cfg['configopts'] - - # I) prepare extra source dirs, e.g. for GMP, MPFR, MPC (if required), so GCC can build them - stage1_info = self.prep_extra_src_dirs("stage1") - configopts = stage1_info['configopts'] - - # II) update config options - - # enable specified language support - if self.cfg['languages']: - self.configopts += " --enable-languages=%s" % ','.join(self.cfg['languages']) - - # enable link-time-optimization (LTO) support, if desired - if self.cfg['withlto']: - self.configopts += " --enable-lto" - - # configure for a release build - self.configopts += " --enable-checking=release " - # enable multilib: allow both 32 and 64 bit - if self.cfg['multilib']: - glibc_32bit = [ - "glibc.i686", # Fedora, RedHat-based - "glibc.ppc", # "" on Power - "libc6-dev-i386", # Debian-based - "gcc-c++-32bit", # OpenSuSE, SLES - ] - if not any([check_os_dependency(dep) for dep in glibc_32bit]): - raise EasyBuildError("Using multilib requires 32-bit glibc (install one of %s, depending on your OS)", - ', '.join(glibc_32bit)) - self.configopts += " --enable-multilib --with-multilib-list=m32,m64" - else: - self.configopts += " --disable-multilib" - # build both static and dynamic libraries (???) - self.configopts += " --enable-shared=yes --enable-static=yes " - # use POSIX threads - self.configopts += " --enable-threads=posix " - # use GOLD as default linker, enable plugin support - self.configopts += " --enable-gold=default --enable-plugins " - self.configopts += " --enable-ld --with-plugin-ld=ld.gold" - - # enable bootstrap build for self-containment (unless for staged build) - if not self.stagedbuild: - configopts += " --enable-bootstrap" - else: - configopts += " --disable-bootstrap" - - if self.stagedbuild: - # - # STAGE 1: configure GCC build that will be used to build PPL/CLooG - # - self.log.info("Starting with stage 1 of 3-staged build to enable CLooG and/or PPL, ISL support...") - self.stage1installdir = os.path.join(self.builddir, 'GCC_stage1_eb') - configopts += " --prefix=%(p)s --with-local-prefix=%(p)s" % {'p': self.stage1installdir} - - else: - # unstaged build, so just run standard configure/make/make install - # set prefixes - self.log.info("Performing regular GCC build...") - configopts += " --prefix=%(p)s --with-local-prefix=%(p)s" % {'p': self.installdir} - - # III) create obj dir to build in, and change to it - # GCC doesn't like to be built in the source dir - if self.stagedbuild: - self.stage1prefix = self.create_dir("stage1_obj") - else: - self.create_dir("obj") - - # IV) actual configure, but not on default path - cmd = "../configure %s %s" % (self.configopts, configopts) - - # instead of relying on uname, we run the same command GCC uses to - # determine the platform - out, ec = run_cmd("../config.guess", simple=False) - if ec == 0: - self.platform_lib = out.rstrip() - - self.run_configure_cmd(cmd) - - def build_step(self): - - if self.stagedbuild: - - # make and install stage 1 build of GCC - paracmd = '' - if self.cfg['parallel']: - paracmd = "-j %s" % self.cfg['parallel'] - - cmd = "%s make %s %s" % (self.cfg['prebuildopts'], paracmd, self.cfg['buildopts']) - run_cmd(cmd, log_all=True, simple=True) - - cmd = "make install %s" % (self.cfg['installopts']) - run_cmd(cmd, log_all=True, simple=True) - - # register built GCC as compiler to use for stage 2/3 - path = "%s/bin:%s" % (self.stage1installdir, os.getenv('PATH')) - env.setvar('PATH', path) - - ld_lib_path = "%(dir)s/lib64:%(dir)s/lib:%(val)s" % { - 'dir': self.stage1installdir, - 'val': os.getenv('LD_LIBRARY_PATH') - } - env.setvar('LD_LIBRARY_PATH', ld_lib_path) - - # - # STAGE 2: build GMP/PPL/CLooG for stage 3 - # - - # create dir to build GMP/PPL/CLooG in - stage2dir = "stage2_stuff" - stage2prefix = self.create_dir(stage2dir) - - # prepare directories to build GMP/PPL/CLooG - stage2_info = self.prep_extra_src_dirs("stage2", target_prefix=stage2prefix) - configopts = stage2_info['configopts'] - - # build PPL and CLooG (GMP as dependency) - - for lib in ["gmp"] + self.with_dirs: - self.log.debug("Building %s in stage 2" % lib) - if lib == "gmp" or self.cfg['with%s' % lib]: - libdir = os.path.join(stage2prefix, lib) - try: - os.chdir(libdir) - except OSError, err: - raise EasyBuildError("Failed to change to %s: %s", libdir, err) - if lib == "gmp": - cmd = "./configure --prefix=%s " % stage2prefix - cmd += "--with-pic --disable-shared --enable-cxx" - elif lib == "ppl": - self.pplver = LooseVersion(stage2_info['versions']['ppl']) - - cmd = "./configure --prefix=%s --with-pic -disable-shared " % stage2prefix - # only enable C/C++ interfaces (Java interface is sometimes troublesome) - cmd += "--enable-interfaces='c c++' " - - # enable watchdog (or not) - if self.pplver <= LooseVersion("0.11"): - if self.cfg['pplwatchdog']: - cmd += "--enable-watchdog " - else: - cmd += "--disable-watchdog " - elif self.cfg['pplwatchdog']: - raise EasyBuildError("Enabling PPL watchdog only supported in PPL <= v0.11 .") - - # make sure GMP we just built is found - cmd += "--with-gmp=%s " % stage2prefix - elif lib == "isl": - cmd = "./configure --prefix=%s --with-pic --disable-shared " % stage2prefix - cmd += "--with-gmp=system --with-gmp-prefix=%s " % stage2prefix - elif lib == "cloog": - self.cloogname = stage2_info['names']['cloog'] - self.cloogver = LooseVersion(stage2_info['versions']['cloog']) - v0_15 = LooseVersion("0.15") - v0_16 = LooseVersion("0.16") - - cmd = "./configure --prefix=%s --with-pic --disable-shared " % stage2prefix - - # use ISL or PPL - if self.cfg['clooguseisl']: - if self.cfg['withisl']: - self.log.debug("Using external ISL for CLooG") - cmd += "--with-isl=system --with-isl-prefix=%s " % stage2prefix - elif self.cloogver >= v0_16: - self.log.debug("Using bundled ISL for CLooG") - cmd += "--with-isl=bundled " - else: - raise EasyBuildError("Using ISL is only supported in CLooG >= v0.16 (detected v%s).", - self.cloogver) - else: - if self.cloogname == "cloog-ppl" and self.cloogver >= v0_15 and self.cloogver < v0_16: - cmd += "--with-ppl=%s " % stage2prefix - else: - errormsg = "PPL only supported with CLooG-PPL v0.15.x (detected v%s)" % self.cloogver - errormsg += "\nNeither using PPL or ISL-based ClooG, I'm out of options..." - raise EasyBuildError(errormsg) - - # make sure GMP is found - if self.cloogver >= v0_15 and self.cloogver < v0_16: - cmd += "--with-gmp=%s " % stage2prefix - elif self.cloogver >= v0_16: - cmd += "--with-gmp=system --with-gmp-prefix=%s " % stage2prefix - else: - raise EasyBuildError("Don't know how to specify location of GMP to configure of CLooG v%s.", - self.cloogver) - else: - raise EasyBuildError("Don't know how to configure for %s", lib) - - # configure - self.run_configure_cmd(cmd) - - # build and 'install' - cmd = "make %s" % paracmd - run_cmd(cmd, log_all=True, simple=True) - - cmd = "make install" - run_cmd(cmd, log_all=True, simple=True) - - if lib == "gmp": - # make sure correct GMP is found - libpath = os.path.join(stage2prefix, 'lib') - incpath = os.path.join(stage2prefix, 'include') - - cppflags = os.getenv('CPPFLAGS', '') - env.setvar('CPPFLAGS', "%s -L%s -I%s " % (cppflags, libpath, incpath)) - - # - # STAGE 3: bootstrap build of final GCC (with PPL/CLooG support) - # - - # create new obj dir and change into it - self.create_dir("stage3_obj") - - # reconfigure for stage 3 build - self.log.info("Stage 2 of 3-staged build completed, continuing with stage 2 " - "(with CLooG and/or PPL, ISL support enabled)...") - - stage3_info = self.prep_extra_src_dirs("stage3") - configopts = stage3_info['configopts'] - configopts += " --prefix=%(p)s --with-local-prefix=%(p)s" % {'p': self.installdir} - - # enable bootstrapping for self-containment - configopts += " --enable-bootstrap " - - # PPL config options - if self.cfg['withppl']: - # for PPL build and CLooG-PPL linking - for lib in ["lib64", "lib"]: - path = os.path.join(self.stage1installdir, lib, "libstdc++.a") - if os.path.exists(path): - libstdcxxpath = path - break - configopts += "--with-host-libstdcxx='-static-libgcc %s -lm' " % libstdcxxpath - - configopts += "--with-ppl=%s " % stage2prefix - - if self.pplver <= LooseVersion("0.11"): - if self.cfg['pplwatchdog']: - configopts += "--enable-watchdog " - else: - configopts += "--disable-watchdog " - - # CLooG config options - if self.cfg['withcloog']: - configopts += "--with-cloog=%s " % stage2prefix - - if self.cfg['clooguseisl'] and self.cloogver >= LooseVersion("0.16") and LooseVersion(self.version) < LooseVersion("4.8.0"): - configopts += "--enable-cloog-backend=isl " - - if self.cfg['withisl']: - configopts += "--with-isl=%s " % stage2prefix - - # configure - cmd = "../configure %s %s" % (self.configopts, configopts) - self.run_configure_cmd(cmd) - - # build with bootstrapping for self-containment - self.cfg.update('buildopts', 'bootstrap') - - # call standard build_step - super(EB_GCC, self).build_step() - - # make install is just standard install_step, nothing special there - - def sanity_check_step(self): - """ - Custom sanity check for GCC - """ - - os_type = get_os_type() - sharedlib_ext = get_shared_lib_ext() - common_infix = os.path.join('gcc', self.platform_lib, self.version) - - bin_files = ["gcov"] - lib_files = [] - if LooseVersion(self.version) >= LooseVersion('4.2'): - # libgomp was added in GCC 4.2.0 - ["libgomp.%s" % sharedlib_ext, "libgomp.a"] - if os_type == 'Linux': - lib_files.extend(["libgcc_s.%s" % sharedlib_ext]) - # libmudflap is replaced by asan (see release notes gcc 4.9.0) - if LooseVersion(self.version) < LooseVersion("4.9.0"): - lib_files.extend(["libmudflap.%s" % sharedlib_ext, "libmudflap.a"]) - else: - lib_files.extend(["libasan.%s" % sharedlib_ext, "libasan.a"]) - libexec_files = [] - dirs = ['lib/%s' % common_infix] - - if not self.cfg['languages']: - # default languages are c, c++, fortran - bin_files = ["c++", "cpp", "g++", "gcc", "gcov", "gfortran"] - lib_files.extend(["libstdc++.%s" % sharedlib_ext, "libstdc++.a"]) - libexec_files = ['cc1', 'cc1plus', 'collect2', 'f951'] - - if 'c' in self.cfg['languages']: - bin_files.extend(['cpp', 'gcc']) - - if 'c++' in self.cfg['languages']: - bin_files.extend(['c++', 'g++']) - dirs.append('include/c++/%s' % self.version) - lib_files.extend(["libstdc++.%s" % sharedlib_ext, "libstdc++.a"]) - - if 'fortran' in self.cfg['languages']: - bin_files.append('gfortran') - lib_files.extend(['libgfortran.%s' % sharedlib_ext, 'libgfortran.a']) - - if self.cfg['withlto']: - libexec_files.extend(['lto1', 'lto-wrapper']) - if os_type in ['Linux']: - libexec_files.append('liblto_plugin.%s' % sharedlib_ext) - - bin_files = ["bin/%s" % x for x in bin_files] - libdirs64 = ['lib64'] - libdirs32 = ['lib', 'lib32'] - libdirs = libdirs64 + libdirs32 - if self.cfg['multilib']: - # with multilib enabled, both lib and lib64 should be there - lib_files64 = [os.path.join(libdir, x) for libdir in libdirs64 for x in lib_files] - lib_files32 = [tuple([os.path.join(libdir, x) for libdir in libdirs32]) for x in lib_files] - lib_files = lib_files64 + lib_files32 - else: - # lib64 on SuSE and Darwin, lib otherwise - lib_files = [tuple([os.path.join(libdir, x) for libdir in libdirs]) for x in lib_files] - # lib on SuSE, libexec otherwise - libdirs = ['libexec', 'lib'] - libexec_files = [tuple([os.path.join(libdir, common_infix, x) for libdir in libdirs]) for x in libexec_files] - - custom_paths = { - 'files': bin_files + lib_files + libexec_files, - 'dirs': dirs, - } - - super(EB_GCC, self).sanity_check_step(custom_paths=custom_paths) - - def make_module_req_guess(self): - """ - Make sure all GCC libs are in LD_LIBRARY_PATH - """ - guesses = super(EB_GCC, self).make_module_req_guess() - guesses.update({ - 'PATH': ['bin'], - 'LD_LIBRARY_PATH': ['lib', 'lib64', - 'lib/gcc/%s/%s' % (self.platform_lib, self.cfg['version'])], - 'MANPATH': ['man', 'share/man'] - }) - return guesses diff --git a/easyblocks/g/gpi_2.pyo b/easyblocks/g/gpi_2.pyo deleted file mode 100644 index 8fcb1802e0f4cd8decd1ad9928924f85fc688faf..0000000000000000000000000000000000000000 Binary files a/easyblocks/g/gpi_2.pyo and /dev/null differ diff --git a/easyblocks/i/impi.py b/easyblocks/i/impi.py deleted file mode 100644 index 349b6d3085d9feb2468a41e85ded3062a716e12f..0000000000000000000000000000000000000000 --- a/easyblocks/i/impi.py +++ /dev/null @@ -1,233 +0,0 @@ -# # -# Copyright 2009-2017 Ghent University -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), -# Flemish Research Foundation (FWO) (http://www.fwo.be/en) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# https://github.com/easybuilders/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. -# # -""" -EasyBuild support for installing the Intel MPI library, implemented as an easyblock - -@author: Stijn De Weirdt (Ghent University) -@author: Dries Verdegem (Ghent University) -@author: Kenneth Hoste (Ghent University) -@author: Pieter De Baets (Ghent University) -@author: Jens Timmerman (Ghent University) -@author: Damian Alvarez (Forschungszentrum Juelich GmbH) -""" -import fileinput -import os -import sys -from distutils.version import LooseVersion - -from easybuild.easyblocks.generic.intelbase import IntelBase, ACTIVATION_NAME_2012, LICENSE_FILE_NAME_2012 -from easybuild.framework.easyconfig import CUSTOM -from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.filetools import apply_regex_substitutions -from easybuild.tools.run import run_cmd -from easybuild.tools.systemtools import get_shared_lib_ext - - -class EB_impi(IntelBase): - """ - Support for installing Intel MPI library - """ - @staticmethod - def extra_options(): - extra_vars = { - 'set_mpi_wrappers_compiler': [False, 'Override default compiler used by MPI wrapper commands', CUSTOM], - 'set_mpi_wrapper_aliases_gcc': [False, 'Set compiler for mpigcc/mpigxx via aliases', CUSTOM], - 'set_mpi_wrapper_aliases_intel': [False, 'Set compiler for mpiicc/mpiicpc/mpiifort via aliases', CUSTOM], - 'set_mpi_wrappers_all': [False, 'Set (default) compiler for all MPI wrapper commands', CUSTOM], - } - return IntelBase.extra_options(extra_vars) - - def prepare_step(self, *args, **kwargs): - if LooseVersion(self.version) >= LooseVersion('2017.2.174'): - kwargs['requires_runtime_license'] = False - super(EB_impi, self).prepare_step(*args, **kwargs) - else: - super(EB_impi, self).prepare_step(*args, **kwargs) - - def install_step(self): - """ - Actual installation - - create silent cfg file - - execute command - """ - impiver = LooseVersion(self.version) - if impiver >= LooseVersion('4.0.1'): - # impi starting from version 4.0.1.x uses standard installation procedure. - - silent_cfg_names_map = {} - - if impiver < LooseVersion('4.1.1'): - # since impi v4.1.1, silent.cfg has been slightly changed to be 'more standard' - silent_cfg_names_map.update({ - 'activation_name': ACTIVATION_NAME_2012, - 'license_file_name': LICENSE_FILE_NAME_2012, - }) - - super(EB_impi, self).install_step(silent_cfg_names_map=silent_cfg_names_map) - - # impi v4.1.1 and v5.0.1 installers create impi/<version> subdir, so stuff needs to be moved afterwards - if impiver == LooseVersion('4.1.1.036') or impiver >= LooseVersion('5.0.1.035'): - super(EB_impi, self).move_after_install() - else: - # impi up until version 4.0.0.x uses custom installation procedure. - silent = \ -""" -[mpi] -INSTALLDIR=%(ins)s -LICENSEPATH=%(lic)s -INSTALLMODE=NONRPM -INSTALLUSER=NONROOT -UPDATE_LD_SO_CONF=NO -PROCEED_WITHOUT_PYTHON=yes -AUTOMOUNTED_CLUSTER=yes -EULA=accept -[mpi-rt] -INSTALLDIR=%(ins)s -LICENSEPATH=%(lic)s -INSTALLMODE=NONRPM -INSTALLUSER=NONROOT -UPDATE_LD_SO_CONF=NO -PROCEED_WITHOUT_PYTHON=yes -AUTOMOUNTED_CLUSTER=yes -EULA=accept - -""" % {'lic': self.license_file, 'ins': self.installdir} - - # already in correct directory - silentcfg = os.path.join(os.getcwd(), "silent.cfg") - try: - f = open(silentcfg, 'w') - f.write(silent) - f.close() - except: - raise EasyBuildError("Writing silent cfg file %s failed.", silent) - self.log.debug("Contents of %s: %s" % (silentcfg, silent)) - - tmpdir = os.path.join(os.getcwd(), self.version, 'mytmpdir') - try: - os.makedirs(tmpdir) - except: - raise EasyBuildError("Directory %s can't be created", tmpdir) - - cmd = "./install.sh --tmp-dir=%s --silent=%s" % (tmpdir, silentcfg) - run_cmd(cmd, log_all=True, simple=True) - - def post_install_step(self): - """Custom post install step for IMPI, fix broken env scripts after moving installed files.""" - super(EB_impi, self).post_install_step() - - impiver = LooseVersion(self.version) - if impiver == LooseVersion('4.1.1.036') or impiver >= LooseVersion('5.0.1.035'): - if impiver >= LooseVersion('2018.0.128'): - script_paths = [os.path.join('intel64', 'bin')] - else: - script_paths = [os.path.join('intel64', 'bin'), os.path.join('mic', 'bin')] - # fix broken env scripts after the move - regex_subs = [(r"^setenv I_MPI_ROOT.*", r"setenv I_MPI_ROOT %s" % self.installdir)] - for script in [os.path.join(script_path,'mpivars.csh') for script_path in script_paths]: - apply_regex_substitutions(os.path.join(self.installdir, script), regex_subs) - regex_subs = [(r"^I_MPI_ROOT=.*", r"I_MPI_ROOT=%s; export I_MPI_ROOT" % self.installdir)] - for script in [os.path.join(script_path,'mpivars.sh') for script_path in script_paths]: - apply_regex_substitutions(os.path.join(self.installdir, script), regex_subs) - - def sanity_check_step(self): - """Custom sanity check paths for IMPI.""" - - suff = "64" - if self.cfg['m32']: - suff = "" - - mpi_mods = ['mpi.mod'] - if LooseVersion(self.version) > LooseVersion('4.0'): - mpi_mods.extend(["mpi_base.mod", "mpi_constants.mod", "mpi_sizeofs.mod"]) - - custom_paths = { - 'files': ["bin%s/mpi%s" % (suff, x) for x in ["icc", "icpc", "ifort"]] + - ["include%s/mpi%s.h" % (suff, x) for x in ["cxx", "f", "", "o", "of"]] + - ["include%s/%s" % (suff, x) for x in ["i_malloc.h"] + mpi_mods] + - ["lib%s/libmpi.%s" % (suff, get_shared_lib_ext()), "lib%s/libmpi.a" % suff], - 'dirs': [], - } - - super(EB_impi, self).sanity_check_step(custom_paths=custom_paths) - - def make_module_req_guess(self): - """ - A dictionary of possible directories to look for - """ - if self.cfg['m32']: - lib_dirs = ['lib', 'lib/ia32', 'ia32/lib'] - include_dirs = ['include'] - return { - 'PATH': ['bin', 'bin/ia32', 'ia32/bin'], - 'LD_LIBRARY_PATH': lib_dirs, - 'LIBRARY_PATH': lib_dirs, - 'CPATH': include_dirs, - 'MIC_LD_LIBRARY_PATH' : ['mic/lib'], - } - else: - lib_dirs = ['lib/em64t', 'lib64'] - include_dirs = ['include64'] - return { - 'PATH': ['bin/intel64', 'bin64'], - 'LD_LIBRARY_PATH': lib_dirs, - 'LIBRARY_PATH': lib_dirs, - 'CPATH': include_dirs, - 'MIC_LD_LIBRARY_PATH' : ['mic/lib'], - } - - def make_module_extra(self): - """Overwritten from Application to add extra txt""" - txt = super(EB_impi, self).make_module_extra() - txt += self.module_generator.set_environment('I_MPI_ROOT', self.installdir) - if self.cfg['set_mpi_wrappers_compiler'] or self.cfg['set_mpi_wrappers_all']: - for var in ['CC', 'CXX', 'F77', 'F90', 'FC']: - if var == 'FC': - # $FC isn't defined by EasyBuild framework, so use $F90 instead - src_var = 'F90' - else: - src_var = var - - target_var = 'I_MPI_%s' % var - - val = os.getenv(src_var) - if val: - txt += self.module_generator.set_environment(target_var, val) - else: - raise EasyBuildError("Environment variable $%s not set, can't define $%s", src_var, target_var) - - if self.cfg['set_mpi_wrapper_aliases_gcc'] or self.cfg['set_mpi_wrappers_all']: - # force mpigcc/mpigxx to use GCC compilers, as would be expected based on their name - txt += self.module_generator.set_alias('mpigcc', 'mpigcc -cc=gcc') - txt += self.module_generator.set_alias('mpigxx', 'mpigxx -cxx=g++') - - if self.cfg['set_mpi_wrapper_aliases_intel'] or self.cfg['set_mpi_wrappers_all']: - # do the same for mpiicc/mpiipc/mpiifort to be consistent, even if they may not exist - txt += self.module_generator.set_alias('mpiicc', 'mpiicc -cc=icc') - txt += self.module_generator.set_alias('mpiicpc', 'mpiicpc -cxx=icpc') - # -fc also works, but -f90 takes precedence - txt += self.module_generator.set_alias('mpiifort', 'mpiifort -f90=ifort') - - return txt diff --git a/easyblocks/l/lammps.pyo b/easyblocks/l/lammps.pyo deleted file mode 100644 index 0740ac48f70f2762e4e5ac279dbb66919c3d5c6b..0000000000000000000000000000000000000000 Binary files a/easyblocks/l/lammps.pyo and /dev/null differ diff --git a/easyblocks/m/mkl.py b/easyblocks/m/mkl.py new file mode 100644 index 0000000000000000000000000000000000000000..cc8d7689dd447ad80834597c1bdb76e0b3b62e16 --- /dev/null +++ b/easyblocks/m/mkl.py @@ -0,0 +1,425 @@ +# # +# Copyright 2009-2017 Ghent University +# +# This file is part of EasyBuild, +# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), +# with support of Ghent University (http://ugent.be/hpc), +# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), +# Flemish Research Foundation (FWO) (http://www.fwo.be/en) +# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). +# +# https://github.com/easybuilders/easybuild +# +# EasyBuild is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation v2. +# +# EasyBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. +# # +""" +EasyBuild support for installing the Intel Math Kernel Library (MKL), implemented as an easyblock + +@author: Stijn De Weirdt (Ghent University) +@author: Dries Verdegem (Ghent University) +@author: Kenneth Hoste (Ghent University) +@author: Pieter De Baets (Ghent University) +@author: Jens Timmerman (Ghent University) +@author: Ward Poelmans (Ghent University) +@author: Lumir Jasiok (IT4Innovations) +""" + +import itertools +import os +import shutil +import tempfile +from distutils.version import LooseVersion + +import easybuild.tools.environment as env +import easybuild.tools.toolchain as toolchain +from easybuild.easyblocks.generic.intelbase import IntelBase, ACTIVATION_NAME_2012, LICENSE_FILE_NAME_2012 +from easybuild.framework.easyconfig import CUSTOM +from easybuild.tools.build_log import EasyBuildError +from easybuild.tools.filetools import apply_regex_substitutions, rmtree2 +from easybuild.tools.modules import get_software_root +from easybuild.tools.run import run_cmd +from easybuild.tools.systemtools import get_shared_lib_ext + + +class EB_mkl(IntelBase): + """ + Class that can be used to install mkl + - tested with 10.2.1.017 + -- will fail for all older versions (due to newer silent installer) + """ + + @staticmethod + def extra_options(): + """Add easyconfig parameters custom to mkl (e.g. interfaces).""" + extra_vars = { + 'interfaces': [True, "Indicates whether interfaces should be built", CUSTOM], + } + return IntelBase.extra_options(extra_vars) + + def __init__(self, *args, **kwargs): + super(EB_mkl, self).__init__(*args, **kwargs) + # make sure $MKLROOT isn't set, it's known to cause problems with the installation + self.cfg.update('unwanted_env_vars', ['MKLROOT']) + + def prepare_step(self, *args, **kwargs): + if LooseVersion(self.version) >= LooseVersion('2017.2.174'): + kwargs['requires_runtime_license'] = False + super(EB_mkl, self).prepare_step(*args, **kwargs) + else: + super(EB_mkl, self).prepare_step(*args, **kwargs) + + def install_step(self): + """ + Actual installation + - create silent cfg file + - execute command + """ + silent_cfg_names_map = None + silent_cfg_extras = None + + if LooseVersion(self.version) < LooseVersion('11.1'): + # since mkl v11.1, silent.cfg has been slightly changed to be 'more standard' + + silent_cfg_names_map = { + 'activation_name': ACTIVATION_NAME_2012, + 'license_file_name': LICENSE_FILE_NAME_2012, + } + + if LooseVersion(self.version) >= LooseVersion('11.1') and self.install_components is None: + silent_cfg_extras = { + 'COMPONENTS': 'ALL', + } + + super(EB_mkl, self).install_step(silent_cfg_names_map=silent_cfg_names_map, silent_cfg_extras=silent_cfg_extras) + + def make_module_req_guess(self): + """ + A dictionary of possible directories to look for + """ + if LooseVersion(self.version) >= LooseVersion('10.3'): + if self.cfg['m32']: + raise EasyBuildError("32-bit not supported yet for IMKL v%s (>= 10.3)", self.version) + else: + retdict = { + 'PATH': ['bin', 'mkl/bin', 'mkl/bin/intel64', 'composerxe-2011/bin'], + 'LD_LIBRARY_PATH': ['lib/intel64', 'mkl/lib/intel64'], + 'LIBRARY_PATH': ['lib/intel64', 'mkl/lib/intel64'], + 'MANPATH': ['man', 'man/en_US'], + 'CPATH': ['mkl/include', 'mkl/include/fftw'], + } + if LooseVersion(self.version) >= LooseVersion('11.0'): + if LooseVersion(self.version) >= LooseVersion('11.3'): + retdict['MIC_LD_LIBRARY_PATH'] = ['lib/intel64_lin_mic', 'mkl/lib/mic']; + elif LooseVersion(self.version) >= LooseVersion('11.1'): + retdict['MIC_LD_LIBRARY_PATH'] = ['lib/mic', 'mkl/lib/mic']; + else: + retdict['MIC_LD_LIBRARY_PATH'] = ['compiler/lib/mic', 'mkl/lib/mic']; + return retdict; + else: + if self.cfg['m32']: + return { + 'PATH': ['bin', 'bin/ia32', 'tbb/bin/ia32'], + 'LD_LIBRARY_PATH': ['lib', 'lib/32'], + 'LIBRARY_PATH': ['lib', 'lib/32'], + 'MANPATH': ['man', 'share/man', 'man/en_US'], + 'CPATH': ['include'], + } + + else: + return { + 'PATH': ['bin', 'bin/intel64', 'tbb/bin/em64t'], + 'LD_LIBRARY_PATH': ['lib', 'lib/em64t'], + 'LIBRARY_PATH': ['lib', 'lib/em64t'], + 'MANPATH': ['man', 'share/man', 'man/en_US'], + 'CPATH': ['include'], + } + + def make_module_extra(self): + """Overwritten from Application to add extra txt""" + txt = super(EB_mkl, self).make_module_extra() + txt += self.module_generator.set_environment('MKLROOT', os.path.join(self.installdir, 'mkl')) + return txt + + def post_install_step(self): + """ + Install group libraries and interfaces (if desired). + """ + super(EB_mkl, self).post_install_step() + + shlib_ext = get_shared_lib_ext() + + # reload the dependencies + self.load_dependency_modules() + + if self.cfg['m32']: + extra = { + 'libmkl.%s' % shlib_ext : 'GROUP (-lmkl_intel -lmkl_intel_thread -lmkl_core)', + 'libmkl_em64t.a': 'GROUP (libmkl_intel.a libmkl_intel_thread.a libmkl_core.a)', + 'libmkl_solver.a': 'GROUP (libmkl_solver.a)', + 'libmkl_scalapack.a': 'GROUP (libmkl_scalapack_core.a)', + 'libmkl_lapack.a': 'GROUP (libmkl_intel.a libmkl_intel_thread.a libmkl_core.a)', + 'libmkl_cdft.a': 'GROUP (libmkl_cdft_core.a)' + } + else: + extra = { + 'libmkl.%s' % shlib_ext: 'GROUP (-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core)', + 'libmkl_em64t.a': 'GROUP (libmkl_intel_lp64.a libmkl_intel_thread.a libmkl_core.a)', + 'libmkl_solver.a': 'GROUP (libmkl_solver_lp64.a)', + 'libmkl_scalapack.a': 'GROUP (libmkl_scalapack_lp64.a)', + 'libmkl_lapack.a': 'GROUP (libmkl_intel_lp64.a libmkl_intel_thread.a libmkl_core.a)', + 'libmkl_cdft.a': 'GROUP (libmkl_cdft_core.a)' + } + + if LooseVersion(self.version) >= LooseVersion('10.3'): + libsubdir = os.path.join('mkl', 'lib', 'intel64') + else: + if self.cfg['m32']: + libsubdir = os.path.join('lib', '32') + else: + libsubdir = os.path.join('lib', 'em64t') + + for fil, txt in extra.items(): + dest = os.path.join(self.installdir, libsubdir, fil) + if not os.path.exists(dest): + try: + f = open(dest, 'w') + f.write(txt) + f.close() + self.log.info("File %s written" % dest) + except IOError, err: + raise EasyBuildError("Can't write file %s: %s", dest, err) + + # build the mkl interfaces, if desired + if self.cfg['interfaces']: + + if LooseVersion(self.version) >= LooseVersion('10.3'): + intsubdir = os.path.join('mkl', 'interfaces') + inttarget = 'libintel64' + else: + intsubdir = 'interfaces' + if self.cfg['m32']: + inttarget = 'lib32' + else: + inttarget = 'libem64t' + + cmd = "make -f makefile %s" % inttarget + + # blas95 and lapack95 need more work, ignore for now + # blas95 and lapack also need include/.mod to be processed + fftw2libs = ['fftw2xc', 'fftw2xf'] + fftw3libs = ['fftw3xc', 'fftw3xf'] + cdftlibs = ['fftw2x_cdft'] + if LooseVersion(self.version) >= LooseVersion('10.3'): + cdftlibs.append('fftw3x_cdft') + + interfacedir = os.path.join(self.installdir, intsubdir) + try: + os.chdir(interfacedir) + self.log.info("Changed to interfaces directory %s" % interfacedir) + except OSError, err: + raise EasyBuildError("Can't change to interfaces directory %s", interfacedir) + + compopt = None + # determine whether we're using a non-Intel GCC-based or PGI-based toolchain + # can't use toolchain.comp_family, because of dummy toolchain used when installing mkl + if get_software_root('icc') is None: + # check for PGI first, since there's a GCC underneath PGI too... + if get_software_root('PGI'): + compopt = 'compiler=pgi' + elif get_software_root('GCC'): + compopt = 'compiler=gnu' + else: + raise EasyBuildError("Not using Intel/GCC/PGI compilers, don't know how to build wrapper libs") + else: + compopt = 'compiler=intel' + + # patch makefiles for cdft wrappers when PGI is used as compiler + if get_software_root('PGI'): + regex_subs = [ + # pgi should be considered as a valid compiler + ("intel gnu", "intel gnu pgi"), + # transform 'gnu' case to 'pgi' case + (r"ifeq \(\$\(compiler\),gnu\)", "ifeq ($(compiler),pgi)"), + ('=gcc', '=pgcc'), + # correct flag to use C99 standard + ('-std=c99', '-c99'), + # -Wall and -Werror are not valid options for pgcc, no close equivalent + ('-Wall', ''), + ('-Werror', ''), + ] + for lib in cdftlibs: + apply_regex_substitutions(os.path.join(interfacedir, lib, 'makefile'), regex_subs) + + for lib in fftw2libs + fftw3libs + cdftlibs: + buildopts = [compopt] + if lib in fftw3libs: + buildopts.append('install_to=$INSTALL_DIR') + elif lib in cdftlibs: + mpi_spec = None + # check whether MPI_FAMILY constant is defined, so mpi_family() can be used + if hasattr(self.toolchain, 'MPI_FAMILY') and self.toolchain.MPI_FAMILY is not None: + mpi_spec_by_fam = { + toolchain.MPICH: 'mpich2', # MPICH is MPICH v3.x, which is MPICH2 compatible + toolchain.MPICH2: 'mpich2', + toolchain.MVAPICH2: 'mpich2', + toolchain.OPENMPI: 'openmpi', + } + mpi_fam = self.toolchain.mpi_family() + mpi_spec = mpi_spec_by_fam.get(mpi_fam) + self.log.debug("Determined MPI specification based on MPI toolchain component: %s" % mpi_spec) + else: + # can't use toolchain.mpi_family, because of dummy toolchain + if get_software_root('MPICH2') or get_software_root('MVAPICH2'): + mpi_spec = 'mpich2' + elif get_software_root('OpenMPI'): + mpi_spec = 'openmpi' + self.log.debug("Determined MPI specification based on loaded MPI module: %s" % mpi_spec) + + if mpi_spec is not None: + buildopts.append('mpi=%s' % mpi_spec) + + precflags = [''] + if lib.startswith('fftw2x') and not self.cfg['m32']: + # build both single and double precision variants + precflags = ['PRECISION=MKL_DOUBLE', 'PRECISION=MKL_SINGLE'] + + intflags = [''] + if lib in cdftlibs and not self.cfg['m32']: + # build both 32-bit and 64-bit interfaces + intflags = ['interface=lp64', 'interface=ilp64'] + + allopts = [list(opts) for opts in itertools.product(intflags, precflags)] + + for flags, extraopts in itertools.product(['', '-fPIC'], allopts): + tup = (lib, flags, buildopts, extraopts) + self.log.debug("Building lib %s with: flags %s, buildopts %s, extraopts %s" % tup) + + tmpbuild = tempfile.mkdtemp(dir=self.builddir) + self.log.debug("Created temporary directory %s" % tmpbuild) + + # always set INSTALL_DIR, SPEC_OPT, COPTS and CFLAGS + # fftw2x(c|f): use $INSTALL_DIR, $CFLAGS and $COPTS + # fftw3x(c|f): use $CFLAGS + # fftw*cdft: use $INSTALL_DIR and $SPEC_OPT + env.setvar('INSTALL_DIR', tmpbuild) + env.setvar('SPEC_OPT', flags) + env.setvar('COPTS', flags) + env.setvar('CFLAGS', flags) + + try: + intdir = os.path.join(interfacedir, lib) + os.chdir(intdir) + self.log.info("Changed to interface %s directory %s" % (lib, intdir)) + except OSError, err: + raise EasyBuildError("Can't change to interface %s directory %s: %s", lib, intdir, err) + + fullcmd = "%s %s" % (cmd, ' '.join(buildopts + extraopts)) + res = run_cmd(fullcmd, log_all=True, simple=True) + if not res: + raise EasyBuildError("Building %s (flags: %s, fullcmd: %s) failed", lib, flags, fullcmd) + + for fn in os.listdir(tmpbuild): + src = os.path.join(tmpbuild, fn) + if flags == '-fPIC': + # add _pic to filename + ff = fn.split('.') + fn = '.'.join(ff[:-1]) + '_pic.' + ff[-1] + dest = os.path.join(self.installdir, libsubdir, fn) + try: + if os.path.isfile(src): + shutil.move(src, dest) + self.log.info("Moved %s to %s" % (src, dest)) + except OSError, err: + raise EasyBuildError("Failed to move %s to %s: %s", src, dest, err) + + rmtree2(tmpbuild) + + def sanity_check_step(self): + """Custom sanity check paths for Intel MKL.""" + shlib_ext = get_shared_lib_ext() + + mklfiles = None + mkldirs = None + ver = LooseVersion(self.version) + libs = ['libmkl_core.%s' % shlib_ext, 'libmkl_gnu_thread.%s' % shlib_ext, + 'libmkl_intel_thread.%s' % shlib_ext, 'libmkl_sequential.%s' % shlib_ext] + extralibs = ['libmkl_blacs_intelmpi_%(suff)s.' + shlib_ext, 'libmkl_scalapack_%(suff)s.' + shlib_ext] + + if self.cfg['interfaces']: + compsuff = '_intel' + if get_software_root('icc') is None: + # check for PGI first, since there's a GCC underneath PGI too... + if get_software_root('PGI'): + compsuff = '_pgi' + elif get_software_root('GCC'): + compsuff = '_gnu' + else: + raise EasyBuildError("Not using Intel/GCC/PGI, don't know compiler suffix for FFTW libraries.") + + precs = ['_double', '_single'] + if ver < LooseVersion('11'): + # no precision suffix in libfftw2 libs before mkl v11 + precs = [''] + fftw_vers = ['2x%s%s' % (x, prec) for x in ['c', 'f'] for prec in precs] + ['3xc', '3xf'] + pics = ['', '_pic'] + libs = ['libfftw%s%s%s.a' % (fftwver, compsuff, pic) for fftwver in fftw_vers for pic in pics] + + fftw_cdft_vers = ['2x_cdft_DOUBLE'] + if not self.cfg['m32']: + fftw_cdft_vers.append('2x_cdft_SINGLE') + if ver >= LooseVersion('10.3'): + fftw_cdft_vers.append('3x_cdft') + if ver >= LooseVersion('11.0.2'): + bits = ['_lp64'] + if not self.cfg['m32']: + bits.append('_ilp64') + else: + # no bits suffix in cdft libs before mkl v11.0.2 + bits = [''] + libs += ['libfftw%s%s%s.a' % x for x in itertools.product(fftw_cdft_vers, bits, pics)] + + if ver >= LooseVersion('10.3'): + if self.cfg['m32']: + raise EasyBuildError("Sanity check for 32-bit not implemented yet for IMKL v%s (>= 10.3)", self.version) + else: + mkldirs = ['bin', 'mkl/bin', 'mkl/lib/intel64', 'mkl/include'] + if ver < LooseVersion('11.3'): + mkldirs.append('mkl/bin/intel64') + libs += [lib % {'suff': suff} for lib in extralibs for suff in ['lp64', 'ilp64']] + mklfiles = ['mkl/lib/intel64/libmkl.%s' % shlib_ext, 'mkl/include/mkl.h'] + \ + ['mkl/lib/intel64/%s' % lib for lib in libs] + if ver >= LooseVersion('10.3.4') and ver < LooseVersion('11.1'): + mkldirs += ['compiler/lib/intel64'] + else: + if ver >= LooseVersion('2017.0.0'): + mkldirs += ['lib/intel64_lin'] + else: + mkldirs += ['lib/intel64'] + + else: + if self.cfg['m32']: + mklfiles = ['lib/32/libmkl.%s' % shlib_ext, 'include/mkl.h'] + \ + ['lib/32/%s' % lib for lib in libs] + mkldirs = ['lib/32', 'include/32', 'interfaces'] + else: + libs += [lib % {'suff': suff} for lib in extralibs for suff in ['lp64', 'ilp64']] + mklfiles = ['lib/em64t/libmkl.%s' % shlib_ext, 'include/mkl.h'] + \ + ['lib/em64t/%s' % lib for lib in libs] + mkldirs = ['lib/em64t', 'include/em64t', 'interfaces'] + + custom_paths = { + 'files': mklfiles, + 'dirs': mkldirs, + } + + super(EB_mkl, self).sanity_check_step(custom_paths=custom_paths) diff --git a/easyblocks/o/opencl.pyo b/easyblocks/o/opencl.pyo deleted file mode 100644 index 23e18b8ed59358b0ce8afd695adf79e6c25f5a7c..0000000000000000000000000000000000000000 Binary files a/easyblocks/o/opencl.pyo and /dev/null differ diff --git a/easyblocks/p/__init__.py b/easyblocks/p/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/easyblocks/p/p4vasp.py b/easyblocks/p/p4vasp.py deleted file mode 100644 index 524b958eb106c238bd83b26f7896fa4f107c7133..0000000000000000000000000000000000000000 --- a/easyblocks/p/p4vasp.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2015 IT4Innovations -# Lumir Jasiok -# lumir.jasiok@vsb.cz -# http://www.it4i.cz -# -# -# - -""" -EasyBuild support for building and installing p4vasp, -implemented as an easyblock - -@author: Lumir Jasiok (IT4 Innovations) -""" - -import os - -from easybuild.framework.easyblock import EasyBlock -from easybuild.tools.run import run_cmd - - -class EB_p4vasp(EasyBlock): - """Support for building and installing p4vasp.""" - - def configure_step(self): - """ - Create %(builddir)s/install/Configuration.mk file to skip - run "python configure.py local" - """ - builddir = os.path.join(self.builddir, '%s-%s' - % (self.name, self.version)) - installdir = self.installdir - p4vasp_path = installdir.split('/')[1:-1] - p4vasp_root = os.path.join('/', *p4vasp_path) - self.log.info("p4vasp builddir id %s" % builddir) - self.log.info("p4vasp installdir id %s" % installdir) - self.log.info("p4vasp root dir is %s" % p4vasp_root) - - conf_file = os.path.join(builddir, 'install', 'Configuration.mk') - fd = open(conf_file, 'w') - conf_content = """ - ROOT = %s - P4VASP_HOME = %s - SITE_PACKAGES = %s/python-packages - INCLUDEDIR = %s/include - LIBDIR = %s/lib - BINDIR = %s/bin - """ % (p4vasp_root, installdir, installdir, - installdir, installdir, installdir) - - fd.write(conf_content) - fd.close() - - def build_step(self): - """Run simply make install""" - cmd = "make install" - run_cmd(cmd, log_all=True) diff --git a/easyblocks/p/p4vasp.pyo b/easyblocks/p/p4vasp.pyo deleted file mode 100644 index 696ae2ddcaf438f40b298b70cd6f227d5de96f0b..0000000000000000000000000000000000000000 Binary files a/easyblocks/p/p4vasp.pyo and /dev/null differ diff --git a/easyblocks/q/qscintilla.pyo b/easyblocks/q/qscintilla.pyo deleted file mode 100644 index cb9ae9bd04128dc779984c0e68ea3e127f2463a5..0000000000000000000000000000000000000000 Binary files a/easyblocks/q/qscintilla.pyo and /dev/null differ diff --git a/easyblocks/q/qwt.pyo b/easyblocks/q/qwt.pyo deleted file mode 100644 index 148e4370a1c57fdb5e653c50220456d7e172804a..0000000000000000000000000000000000000000 Binary files a/easyblocks/q/qwt.pyo and /dev/null differ diff --git a/easyblocks/s/snucl.pyo b/easyblocks/s/snucl.pyo deleted file mode 100644 index 3e57ecc7b742a86797471b7adab7f1e9e7aed276..0000000000000000000000000000000000000000 Binary files a/easyblocks/s/snucl.pyo and /dev/null differ diff --git a/easyblocks/v/vtune.py b/easyblocks/v/vtune.py deleted file mode 100644 index f379f5de50f0b46579d73fc1891a692a3246d335..0000000000000000000000000000000000000000 --- a/easyblocks/v/vtune.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2015 IT4Innovations -# Lumir Jasiok -# lumir.jasiok@vsb.cz -# http://www.it4i.cz -# -# -# - -""" -EasyBuild support for building and installing Intel VTune Amplifier, -implemented as an easyblock. - -@author: Lumir Jasiok (IT4Innovations) -""" - -import os - -from easybuild.easyblocks.generic.intelbase import IntelBase -from easybuild.tools.run import run_cmd - - -class EB_VTune(IntelBase): - """ - Support for installing Intel VTune Amplifier XE - """ - - def install_step(self): - """Actual installation - - - create silent.cfg - - run install.sh - """ - - kernel_version = os.uname()[2] - - silent_cfg = """ -ACCEPT_EULA=accept -CONTINUE_WITH_OPTIONAL_ERROR=yes -PSET_INSTALL_DIR=%s -CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes -PSET_MODE=install -ACTIVATION_TYPE=license_file -ACTIVATION_LICENSE_FILE=%s -CLUSTER_INSTALL_AUTOMOUNT=yes -PHONEHOME_SEND_USAGE_DATA=no -AMPLIFIER_SAMPLING_DRIVER_INSTALL_TYPE=kit -AMPLIFIER_DRIVER_ACCESS_GROUP=wheel -AMPLIFIER_DRIVER_PERMISSIONS=666 -AMPLIFIER_LOAD_DRIVER=no -AMPLIFIER_C_COMPILER=/usr/bin/gcc -AMPLIFIER_KERNEL_SRC_DIR=/lib/modules/%s/build -AMPLIFIER_MAKE_COMMAND=/usr/bin/make -AMPLIFIER_INSTALL_BOOT_SCRIPT=no -AMPLIFIER_DRIVER_PER_USER_MODE=no -MPSS_RESTART_STACK=no -MPSS_INSTALL_STACK=no -COMPONENTS=ALL - """ % (self.installdir, self.license_file, kernel_version) - build_dir = self.cfg['start_dir'] - silent_file = os.path.join(build_dir, 'silent.cfg') - fd = open(silent_file, 'w') - fd.write(silent_cfg) - fd.close() - - os.chdir(build_dir) - self.log.info("Build dir is %s" % (build_dir)) - cmd = "./install.sh -s silent.cfg --SHARED_INSTALL" - run_cmd(cmd, log_all=True, simple=True) - return True - - def make_module_req_guess(self): - """ - A dictionary of possible directories to look for - """ - guesses = super(EB_VTune, self).make_module_req_guess() - - if self.cfg['m32']: - guesses.update({ - 'PATH': ['vtune_amplifier_xe/bin32'], - 'LD_LIBRARY_PATH': ['vtune_amplifier_xe/lib32'], - 'LIBRARY_PATH': ['vtune_amplifier_xe/lib32'], - }) - else: - guesses.update({ - 'PATH': ['vtune_amplifier_xe/bin64'], - 'LD_LIBRARY_PATH': ['vtune_amplifier_xe/lib64'], - 'LIBRARY_PATH': ['vtune_amplifier_xe/lib64'], - }) - - guesses.update({ - 'CPATH': ['vtune_amplifier_xe/include'], - 'FPATH': ['vtune_amplifier_xe/include'], - 'MANPATH': ['vtune_amplifier_xe/man'], - }) - - return guesses diff --git a/toolchains/__init__.py b/toolchains/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/toolchains/__init__.pyo b/toolchains/__init__.pyo deleted file mode 100644 index a3fcd9cd4a42733a58478db11b03c3d04b9272c4..0000000000000000000000000000000000000000 Binary files a/toolchains/__init__.pyo and /dev/null differ diff --git a/toolchains/gcccore.py b/toolchains/gcccore.py deleted file mode 100644 index 4cdbd3d55eea8df447c71bbc6ac0b9a39355c1b2..0000000000000000000000000000000000000000 --- a/toolchains/gcccore.py +++ /dev/null @@ -1,39 +0,0 @@ -## -# Copyright 2012-2015 Ghent University -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), -# the Hercules foundation (http://www.herculesstichting.be/in_English) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# http://github.com/hpcugent/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. -## -""" -EasyBuild support for GCC compiler toolchain. - -@author: Kenneth Hoste (Ghent University) -""" - -from easybuild.toolchains.compiler.gcc import Gcc -from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME - -class GCCcore(Gcc): - """Compiler-only toolchain, including only GCC and binutils.""" - NAME = 'GCCcore' - # Replace the default compiler module name with our own - COMPILER_MODULE_NAME = [NAME] - SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME diff --git a/toolchains/gnu.py b/toolchains/gnu.py deleted file mode 100644 index 8b7f97ad70daf1c040734c5855afc72f700fb55f..0000000000000000000000000000000000000000 --- a/toolchains/gnu.py +++ /dev/null @@ -1,36 +0,0 @@ -## -# Copyright 2012-2015 Ghent University -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), -# the Hercules foundation (http://www.herculesstichting.be/in_English) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# http://github.com/hpcugent/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. -## -""" -EasyBuild support for GCC compiler toolchain. - -@author: Kenneth Hoste (Ghent University) -""" - -from easybuild.toolchains.compiler.gcc import Gcc - - -class GNU(Gcc): - """Compiler-only toolchain, including only GCC and binutils.""" - NAME = 'GNU' diff --git a/tools/__init__.py b/tools/__init__.py deleted file mode 100644 index 12cd9a6b2e4bb25c1a2b3b8c2d538536225fc806..0000000000000000000000000000000000000000 --- a/tools/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from pkgutil import extend_path -# we're not the only ones in this namespace -__path__ = extend_path(__path__, __name__) diff --git a/tools/__init__.pyc b/tools/__init__.pyc deleted file mode 100644 index 4b6454c03a2b41a2962280a4c5a5895a82c97705..0000000000000000000000000000000000000000 Binary files a/tools/__init__.pyc and /dev/null differ diff --git a/tools/__init__.pyo b/tools/__init__.pyo deleted file mode 100644 index 4b6454c03a2b41a2962280a4c5a5895a82c97705..0000000000000000000000000000000000000000 Binary files a/tools/__init__.pyo and /dev/null differ diff --git a/tools/module_naming_scheme/__init__.py b/tools/module_naming_scheme/__init__.py deleted file mode 100644 index 12cd9a6b2e4bb25c1a2b3b8c2d538536225fc806..0000000000000000000000000000000000000000 --- a/tools/module_naming_scheme/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from pkgutil import extend_path -# we're not the only ones in this namespace -__path__ = extend_path(__path__, __name__) diff --git a/tools/module_naming_scheme/__init__.pyo b/tools/module_naming_scheme/__init__.pyo deleted file mode 100644 index 66ae3d0384ab1aa34a00f05257b99e6bdbdff3f2..0000000000000000000000000000000000000000 Binary files a/tools/module_naming_scheme/__init__.pyo and /dev/null differ diff --git a/tools/module_naming_scheme/it4i-uv_module_naming_scheme.py b/tools/module_naming_scheme/it4i-uv_module_naming_scheme.py deleted file mode 100644 index 7671ecee3d429f603570b148ab43694b7175f3e1..0000000000000000000000000000000000000000 --- a/tools/module_naming_scheme/it4i-uv_module_naming_scheme.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2015 IT4Innovations -# Lumir Jasiok -# lumir.jasiok@vsb.cz -# http://www.it4i.cz -# -# - -import os - -from easybuild.tools.config import install_path -from easybuild.tools.module_naming_scheme import ModuleNamingScheme - -class IT4I_UV_ModuleNamingScheme(ModuleNamingScheme): - """Class implementing an example module naming scheme.""" - - #REQUIRED_KEYS = ['name', 'version', 'toolchain', 'moduleclass', 'sources', 'description', 'versionsuffix'] - REQUIRED_KEYS = [] - - def det_install_subdir(self, ec): - """ - Determine name of software installation subdirectory of install path. - @param ec: dict-like object with easyconfig parameter values; for now only the 'name', - 'version', 'versionsuffix' and 'toolchain' parameters are guaranteed to be available - @return: string with name of subdirectory, e.g.: '<compiler>/<mpi_lib>/<name>/<version>' - """ - # by default: use full module name as name for install subdir - - # fetch required values - name = ec['name'] - version = ec['version'] - tc_name = ec['toolchain']['name'] - tc_version = ec['toolchain']['version'] - moduleclass = ec['moduleclass'] - version_suffix = ec['versionsuffix'] - - if version_suffix != '': - self.log.info("IT4I UV version_suffix %s" % version_suffix) - else: - self.log.info("IT4I UV version_suffix not found") - - - # Get the install path from configuration - installpath = os.path.join(install_path(), 'uv') - self.log.info("IT4I UV Install path for software is %s" % installpath) - self.log.info("IT4I UV This application moduleclass is %s" % moduleclass) - moduleclass_dir = os.path.join(installpath, moduleclass) - - if (tc_name == "dummy" and (tc_version == "dummy" or not tc_version)): - self.software_full_version = version - self.log.info("IT4I UV Software full name (dummy toolchain) is %s" % self.software_full_version) - else: - self.software_full_version = version + "-" + tc_name + "-" + tc_version - self.log.info("IT4I UV Software full name is %s" % self.software_full_version) - - if (version_suffix != ''): - self.software_full_version += version_suffix - self.log.info("IT4I UV Software full name (with version_suffix) is %s" % self.software_full_version) - - if not os.path.isdir(moduleclass_dir): - self.log.info("IT4I UV software moduleclass directory %s missing, creating" % moduleclass_dir) - os.mkdir(moduleclass_dir) - - software_dir = os.path.join(moduleclass_dir, name) - if not os.path.isdir(software_dir): - self.log.info("IT4I UV software application directory %s missing, creating" % software_dir) - os.mkdir(software_dir) - - symlink_path = os.path.join(software_dir, self.software_full_version) - if not os.path.islink(symlink_path): - self.log.info("IT4I UV Missing application symlink %s, creating" % symlink_path) - os.symlink(os.path.join(installpath, 'all', name, self.software_full_version), symlink_path) - - - return os.path.join('all', name, self.software_full_version) - - def det_module_subdir(self, ec): - """ - Determine subdirectory for module file in $MODULEPATH. - This determines the separation between module names exposed to users, and what's part of the $MODULEPATH. - @param ec: dict-like object with easyconfig parameter values; for now only the 'name', - 'version', 'versionsuffix' and 'toolchain' parameters are guaranteed to be available - @return: string with subdir path (relative to $MODULEPATH), e.g. '<compiler>/<mpi_lib>' - """ - # by default: no subdirectory, but we have to use 'uv' subdirectory - return 'uv' - - def det_full_module_name(self, ec): - """ - Determine full module name from given easyconfig, according to an example module naming scheme. - - @param ec: dict-like object with easyconfig parameter values (e.g. 'name', 'version', etc.) - - @return: string representing full module name, e.g.: 'goolf/1.4.10/gzip/1.5' - """ - - # fetch required values - name = ec['name'] - version = ec['version'] - tc_name = ec['toolchain']['name'] - tc_version = ec['toolchain']['version'] - version_suffix = ec['versionsuffix'] - - - if (tc_name == "dummy" and (tc_version == "dummy" or not tc_version)): - self.module_full_version = version - else: - self.module_full_version = version + "-" + tc_name + "-" + tc_version - - if (version_suffix != ''): - self.module_full_version += version_suffix - - self.log.debug("IT4I UV Full module name is %s" % self.module_full_version) - - return os.path.join(name, self.module_full_version) diff --git a/tools/module_naming_scheme/it4i-uv_module_naming_scheme.pyc b/tools/module_naming_scheme/it4i-uv_module_naming_scheme.pyc deleted file mode 100644 index dd3856cbe612cf8d227ba5ed7a25083473da9653..0000000000000000000000000000000000000000 Binary files a/tools/module_naming_scheme/it4i-uv_module_naming_scheme.pyc and /dev/null differ diff --git a/tools/module_naming_scheme/it4i-uv_module_naming_scheme.pyo b/tools/module_naming_scheme/it4i-uv_module_naming_scheme.pyo deleted file mode 100644 index ff8e686a7e37363f54df366ab9ccbb6032e893cd..0000000000000000000000000000000000000000 Binary files a/tools/module_naming_scheme/it4i-uv_module_naming_scheme.pyo and /dev/null differ diff --git a/tools/module_naming_scheme/it4i_module_naming_scheme.py b/tools/module_naming_scheme/it4i_module_naming_scheme.py deleted file mode 100644 index c6223a566df79ed6547750a0ab91a1af6b424b51..0000000000000000000000000000000000000000 --- a/tools/module_naming_scheme/it4i_module_naming_scheme.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2015 IT4Innovations -# Lumir Jasiok -# lumir.jasiok@vsb.cz -# http://www.it4i.cz -# -# - -import os - -from easybuild.tools.config import install_path -from easybuild.tools.module_naming_scheme import ModuleNamingScheme - - -class IT4IModuleNamingScheme(ModuleNamingScheme): - """Class implementing an example module naming scheme.""" - - REQUIRED_KEYS = [] - - def det_install_subdir(self, ec): - """ - Determine name of software installation subdirectory of install path. - @param ec: dict-like object with easyconfig parameter values; for now - only the 'name', 'version', 'versionsuffix' and - 'toolchain' parameters are guaranteed to be available - @return: string with name of subdirectory, e.g.: - '<compiler>/<mpi_lib>/<name>/<version>' - """ - # by default: use full module name as name for install subdir - - # fetch required values - name = ec['name'] - version = ec['version'] - tc_name = ec['toolchain']['name'] - tc_version = ec['toolchain']['version'] - moduleclass = ec['moduleclass'] - version_suffix = ec['versionsuffix'] - - if version_suffix != '': - self.log.info("IT4I found version_suffix %s" % version_suffix) - else: - self.log.info("IT4I version_suffix not found") - - # Get the install path from configuration - installpath = install_path() - self.log.info("IT4I Install path for software is %s" % installpath) - self.log.info("IT4I This application moduleclass is %s" % moduleclass) - moduleclass_dir = os.path.join(installpath, moduleclass) - - if (tc_name == "dummy" and (tc_version == "dummy" or not tc_version)): - self.software_full_version = version - self.log.info("IT4I Software full name (dummy toolchain) is %s" - % self.software_full_version) - else: - self.software_full_version = version + "-" + tc_name + "-" \ - + tc_version - self.log.info("IT4I Software full name is %s" - % self.software_full_version) - - if (version_suffix != ''): - self.software_full_version += version_suffix - self.log.info("IT4I Software full name (with version_suffix) is %s" - % self.software_full_version) - - if not os.path.isdir(moduleclass_dir): - self.log.info("IT4I software moduleclass directory %s \ - missing, creating" % moduleclass_dir) - os.mkdir(moduleclass_dir) - - software_dir = os.path.join(moduleclass_dir, name) - if not os.path.isdir(software_dir): - self.log.info("IT4I software application directory %s \ - missing, creating" % software_dir) - os.mkdir(software_dir) - - symlink_path = os.path.join(software_dir, self.software_full_version) - if not os.path.islink(symlink_path): - self.log.info("IT4I Missing application symlink %s, creating" - % symlink_path) - os.symlink(os.path.join(installpath, 'all', name, self.software_full_version), symlink_path) - return os.path.join('all', name, self.software_full_version) - - def det_full_module_name(self, ec): - """ - Determine full module name from given easyconfig, according to and - example module naming scheme. - - @param ec: dict-like object with easyconfig parameter values - (e.g. 'name', 'version', etc.) - - @return: string representing full module name, e.g.: - 'goolf/1.4.10/gzip/1.5' - """ - - # fetch required values - name = ec['name'] - version = ec['version'] - tc_name = ec['toolchain']['name'] - tc_version = ec['toolchain']['version'] - version_suffix = ec['versionsuffix'] - - if (tc_name == "dummy" and (tc_version == "dummy" or not tc_version)): - self.module_full_version = version - else: - self.module_full_version = version + "-" + tc_name + "-" + tc_version - - if (version_suffix != ''): - self.module_full_version += version_suffix - - self.log.debug("IT4I Full module name is %s" - % self.module_full_version) - - return os.path.join(name, self.module_full_version) diff --git a/tools/module_naming_scheme/it4i_module_naming_scheme.pyc b/tools/module_naming_scheme/it4i_module_naming_scheme.pyc deleted file mode 100644 index 1d6b93770b37b197ca64b711caa5fe022f78be93..0000000000000000000000000000000000000000 Binary files a/tools/module_naming_scheme/it4i_module_naming_scheme.pyc and /dev/null differ diff --git a/tools/module_naming_scheme/it4i_module_naming_scheme.pyo b/tools/module_naming_scheme/it4i_module_naming_scheme.pyo deleted file mode 100644 index 1472617cca540355c53f80853cc58dc7943515f2..0000000000000000000000000000000000000000 Binary files a/tools/module_naming_scheme/it4i_module_naming_scheme.pyo and /dev/null differ