Пример #1
0
 def prepare_step(self, *args, **kwargs):
     """Do the bundle prepare step to ensure any deps are loaded at a minimum."""
     if self.cfg['generate_standalone_module']:
         if self.cfg['name'] in ['GCC', 'GCCcore']:
             EB_GCC.prepare_step(self, *args, **kwargs)
         elif self.cfg['name'] in ['icc']:
             EB_icc.prepare_step(self, *args, **kwargs)
         elif self.cfg['name'] in ['ifort']:
             EB_ifort.prepare_step(self, *args, **kwargs)
         else:
             raise EasyBuildError(
                 "I don't know how to do the prepare_step for %s",
                 self.cfg['name'])
     else:
         Bundle.prepare_step(self, *args, **kwargs)
Пример #2
0
 def extra_options(extra_vars=None):
     """Easyconfig parameters specific to bundles of Python packages."""
     if extra_vars is None:
         extra_vars = {}
     # combine custom easyconfig parameters of Bundle & PythonPackage
     extra_vars = Bundle.extra_options(extra_vars)
     return PythonPackage.extra_options(extra_vars)
 def extra_options():
     gfx_list_help_msg = "AMD GPU architectures to build for (if None, use defaults: %s)"
     extra_vars = {
         'gfx_list':
         [None, gfx_list_help_msg % ', '.join(DEFAULT_GFX_ARCHS), CUSTOM],
     }
     return Bundle.extra_options(extra_vars)
Пример #4
0
 def extra_options(extra_vars=None):
     """Easyconfig parameters specific to bundles of Python packages."""
     if extra_vars is None:
         extra_vars = {}
     # combine custom easyconfig parameters of Bundle & PythonPackage
     extra_vars = Bundle.extra_options(extra_vars)
     return PythonPackage.extra_options(extra_vars)
Пример #5
0
 def extra_options(extra_vars=None):
     """Easyconfig parameters specific to OpenSSL wrapper"""
     extra_vars = Bundle.extra_options(extra_vars=extra_vars)
     extra_vars.update({
         'wrap_system_openssl': [True, 'Detect and wrap OpenSSL installation in host system', CUSTOM],
         'minimum_openssl_version': [None, 'Minimum version of OpenSSL required in host system', CUSTOM],
     })
     return extra_vars
Пример #6
0
 def extra_options():
     extra_vars = {
         'arch': [
             None,
             "Architecture to be used (em64t-unknown-linux-gnu%s)" %
             ', '.join([a for a in ['', '_smp', '_mpi']]), CUSTOM
         ],
     }
     return Bundle.extra_options(extra_vars)
Пример #7
0
 def extra_options(extra_vars=None):
     """Easyconfig parameters specific to bundles of Python packages."""
     #50         extra_vars = {
     #51             'arch_name': [None, "Change julia's Project.toml pathname", CUSTOM],
     #52         }
     if extra_vars is None:
         extra_vars = {}
     # combine custom easyconfig parameters of Bundle & PythonPackage
     extra_vars = Bundle.extra_options(extra_vars)
     return JuliaPackage.extra_options(extra_vars)
 def extra_options(extra_vars=None):
     """Easyconfig parameters specific to toolchains."""
     if extra_vars is None:
         extra_vars = {}
     extra_vars.update({
         'set_env_external_modules': [
             False,
             "Include setenv statements for toolchain components that use "
             "an external module, based on available metadata", CUSTOM
         ],
     })
     return Bundle.extra_options(extra_vars=extra_vars)
 def extra_options():
     """Add custom easyconfig parameters for SystemMPI easyblock."""
     # Gather extra_vars from inherited classes, order matters to make sure bundle initialises correctly
     extra_vars = ConfigureMake.extra_options()
     extra_vars.update(EB_impi.extra_options())
     extra_vars.update(Bundle.extra_options())
     # Add an option to add all module path extensions to the resultant easyconfig
     # This is useful if you are importing the MPI installation from a non-default path
     extra_vars.update({
         'generate_standalone_module': [False, "Add known path extensions and environment variables for the MPI "
                                               "installation to the final module", CUSTOM],
     })
     return extra_vars
 def extra_options():
     """Add custom easyconfig parameters for SystemMPI easyblock."""
     # Gather extra_vars from inherited classes, order matters to make sure bundle initialises correctly
     extra_vars = ConfigureMake.extra_options()
     extra_vars.update(EB_impi.extra_options())
     extra_vars.update(Bundle.extra_options())
     # Add an option to add all module path extensions to the resultant easyconfig
     # This is useful if you are importing the MPI installation from a non-default path
     extra_vars.update({
         'generate_standalone_module': [False, "Add known path extensions and environment variables for the MPI "
                                               "installation to the final module", CUSTOM],
     })
     return extra_vars
 def extra_options():
     """Add custom easyconfig parameters for SystemCompiler easyblock."""
     # Gather extra_vars from inherited classes, order matters here to make this work without problems in __init__
     extra_vars = EB_GCC.extra_options()
     extra_vars.update(EB_icc.extra_options())
     extra_vars.update(EB_ifort.extra_options())
     extra_vars.update(Bundle.extra_options())
     # Add an option to add all module path extensions to the resultant easyconfig
     # This is useful if you are importing a compiler from a non-default path
     extra_vars.update({
         'generate_standalone_module': [
             False,
             "Add known path/library extensions and environment variables for the compiler to the final module",
             CUSTOM
         ],
     })
     return extra_vars
 def extra_options():
     """Add custom easyconfig parameters for SystemCompiler easyblock."""
     # Gather extra_vars from inherited classes, order matters here to make this work without problems in __init__
     extra_vars = EB_GCC.extra_options()
     extra_vars.update(EB_icc.extra_options())
     extra_vars.update(EB_ifort.extra_options())
     extra_vars.update(Bundle.extra_options())
     # Add an option to add all module path extensions to the resultant easyconfig
     # This is useful if you are importing a compiler from a non-default path
     extra_vars.update({
         'generate_standalone_module': [
             False,
             "Add known path/library extensions and environment variables for the compiler to the final module",
             CUSTOM
         ],
     })
     return extra_vars
Пример #13
0
 def extra_options():
     """Custom easyconfig parameters for CrayPEToolchain"""
     extra_vars = {
         'PrgEnv': [
             None,
             'PrgEnv module to load, e.g., cray to load PrgEnv-cray, or None for automatic determination',
             CUSTOM
         ],
         'PrgEnv_load': [
             True,
             'Load the PrgEnv module (if True) or just set the corresponding environment variable (if False)',
             CUSTOM
         ],
         'PrgEnv_family': [
             None,
             'Declare to be a member of the PrgEnv family (if \'PrgEnv\), of the cpeToolchain family (if \'cpeToolchain\') or manually unload all known PrgEnv and cpe* modules (if None, needed when LMOD is not used)',
             CUSTOM
         ],
         'CPE_compiler': [
             None,
             'Versionless compiler module to load, or None for automatic determination',
             CUSTOM
         ],
         'CPE_version': [
             None,
             'Version of the CPE, if different from the version of the module',
             CUSTOM
         ],
         'CPE_load': [
             'first',
             'First load the cpe module (if \'first\'), after the PrgEnv module (if \'after\'), load it at the end (if \'last\'), or do not load the cpe module (if None)',
             CUSTOM
         ],
         'cray_targets': [[], 'Targetting modules to load', CUSTOM],
         #'optional_example_param': [None, "Example optional custom parameter", CUSTOM],
     }
     return Bundle.extra_options(extra_vars)
Пример #14
0
    def prepare_step(self, *args, **kwargs):
        """Load all dependencies, determine system MPI version, prefix and any associated envvars."""

        # Do the bundle prepare step to ensure any deps are loaded (no need to worry about licences for Intel MPI)
        Bundle.prepare_step(self, *args, **kwargs)

        # Prepare additional parameters: determine system MPI version, prefix and any associated envvars.
        mpi_name = self.cfg['name'].lower()

        # Determine MPI wrapper path (real path, with resolved symlinks) to ensure it exists
        if mpi_name == 'impi':
            # For impi the version information is only found in *some* of the wrappers it ships, in particular it is
            # not in mpicc
            mpi_c_wrapper = 'mpiicc'
            path_to_mpi_c_wrapper = which(mpi_c_wrapper)
            if not path_to_mpi_c_wrapper:
                mpi_c_wrapper = 'mpigcc'
                path_to_mpi_c_wrapper = which(mpi_c_wrapper)
                if not path_to_mpi_c_wrapper:
                    raise EasyBuildError(
                        "Could not find suitable MPI wrapper to extract version for impi"
                    )
        else:
            mpi_c_wrapper = 'mpicc'
            path_to_mpi_c_wrapper = which(mpi_c_wrapper)

        if path_to_mpi_c_wrapper:
            path_to_mpi_c_wrapper = resolve_path(path_to_mpi_c_wrapper)
            self.log.info(
                "Found path to MPI implementation '%s' %s compiler (with symlinks resolved): %s",
                mpi_name, mpi_c_wrapper, path_to_mpi_c_wrapper)
        else:
            raise EasyBuildError("%s not found in $PATH", mpi_c_wrapper)

        # Determine MPI version, installation prefix and underlying compiler
        if mpi_name in ('openmpi', 'spectrummpi'):
            # Spectrum MPI is based on Open MPI so is also covered by this logic
            output_of_ompi_info, _ = run_cmd("ompi_info", simple=False)

            # Extract the version of the MPI implementation
            if mpi_name == 'spectrummpi':
                mpi_version_string = 'Spectrum MPI'
            else:
                mpi_version_string = 'Open MPI'
            self.mpi_version = self.extract_ompi_setting(
                mpi_version_string, output_of_ompi_info)

            # Extract the installation prefix
            self.mpi_prefix = self.extract_ompi_setting(
                "Prefix", output_of_ompi_info)

            # Extract any OpenMPI environment variables in the current environment and ensure they are added to the
            # final module
            self.mpi_env_vars = dict((key, value)
                                     for key, value in os.environ.items()
                                     if key.startswith('OMPI_'))

            # Extract the C compiler used underneath the MPI implementation, check for the definition of OMPI_MPICC
            self.mpi_c_compiler = self.extract_ompi_setting(
                "C compiler", output_of_ompi_info)
        elif mpi_name == 'impi':
            # Extract the version of IntelMPI
            # The prefix in the the mpiicc (or mpigcc) script can be used to extract the explicit version
            contents_of_mpixcc = read_file(path_to_mpi_c_wrapper)
            prefix_regex = re.compile(
                r'(?<=compilers_and_libraries_)(.*)(?=/linux/mpi)', re.M)

            self.mpi_version = None
            res = prefix_regex.search(contents_of_mpixcc)
            if res:
                self.mpi_version = res.group(1)
            else:
                # old iimpi version
                prefix_regex = re.compile(r'^prefix=(.*)$', re.M)
                res = prefix_regex.search(contents_of_mpixcc)
                if res:
                    self.mpi_version = res.group(1).split('/')[-1]

            if self.mpi_version is None:
                raise EasyBuildError("No version found for system Intel MPI")
            else:
                self.log.info("Found Intel MPI version %s for system MPI" %
                              self.mpi_version)

            # Extract the installation prefix, if I_MPI_ROOT is defined, let's use that
            i_mpi_root = os.environ.get('I_MPI_ROOT')
            if i_mpi_root:
                self.mpi_prefix = i_mpi_root
            else:
                # Else just go up three directories from where mpiicc is found
                # (it's 3 because bin64 is a symlink to intel64/bin and we are assuming 64 bit)
                self.mpi_prefix = os.path.dirname(
                    os.path.dirname(os.path.dirname(path_to_mpi_c_wrapper)))

            # Extract any IntelMPI environment variables in the current environment and ensure they are added to the
            # final module
            self.mpi_env_vars = {}
            for key, value in os.environ.items():
                i_mpi_key = key.startswith('I_MPI_') or key.startswith(
                    'MPICH_')
                mpi_profile_key = key.startswith('MPI') and key.endswith(
                    'PROFILE')
                if i_mpi_key or mpi_profile_key:
                    self.mpi_env_vars[key] = value

            # Extract the C compiler used underneath Intel MPI
            compile_info, exit_code = run_cmd("%s -compile-info" %
                                              mpi_c_wrapper,
                                              simple=False)
            if exit_code == 0:
                self.mpi_c_compiler = compile_info.split(' ', 1)[0]
            else:
                raise EasyBuildError(
                    "Could not determine C compiler underneath Intel MPI, '%s -compiler-info' "
                    "returned %s", mpi_c_wrapper, compile_info)

        else:
            raise EasyBuildError("Unrecognised system MPI implementation %s",
                                 mpi_name)

        # Ensure install path of system MPI actually exists
        if not os.path.exists(self.mpi_prefix):
            raise EasyBuildError(
                "Path derived for system MPI (%s) does not exist: %s!",
                mpi_name, self.mpi_prefix)

        self.log.debug(
            "Derived version/install prefix for system MPI %s: %s, %s",
            mpi_name, self.mpi_version, self.mpi_prefix)

        # For the version of the underlying C compiler need to explicitly extract (to be certain)
        self.c_compiler_version = extract_compiler_version(self.mpi_c_compiler)
        self.log.debug(
            "Derived compiler/version for C compiler underneath system MPI %s: %s, %s",
            mpi_name, self.mpi_c_compiler, self.c_compiler_version)

        # If EasyConfig specified "real" version (not 'system' which means 'derive automatically'), check it
        if self.cfg['version'] == 'system':
            self.log.info(
                "Found specified version '%s', going with derived MPI version '%s'",
                self.cfg['version'], self.mpi_version)
        elif self.cfg['version'] == self.mpi_version:
            self.log.info("Specified MPI version %s matches found version" %
                          self.mpi_version)
        else:
            raise EasyBuildError(
                "Specified version (%s) does not match version reported by MPI (%s)",
                self.cfg['version'], self.mpi_version)
    def prepare_step(self, *args, **kwargs):
        """Do compiler appropriate prepare step, determine system compiler version and prefix."""
        if self.cfg['generate_standalone_module']:
            if self.cfg['name'] in ['GCC', 'GCCcore']:
                EB_GCC.prepare_step(self, *args, **kwargs)
            elif self.cfg['name'] in ['icc']:
                EB_icc.prepare_step(self, *args, **kwargs)
            elif self.cfg['name'] in ['ifort']:
                EB_ifort.prepare_step(self, *args, **kwargs)
            else:
                raise EasyBuildError(
                    "I don't know how to do the prepare_step for %s",
                    self.cfg['name'])
        else:
            Bundle.prepare_step(self, *args, **kwargs)

        # Determine compiler path (real path, with resolved symlinks)
        compiler_name = self.cfg['name'].lower()
        if compiler_name == 'gcccore':
            compiler_name = 'gcc'
        path_to_compiler = which(compiler_name)
        if path_to_compiler:
            path_to_compiler = resolve_path(path_to_compiler)
            self.log.info(
                "Found path to compiler '%s' (with symlinks resolved): %s",
                compiler_name, path_to_compiler)
        else:
            raise EasyBuildError("%s not found in $PATH", compiler_name)

        # Determine compiler version
        self.compiler_version = extract_compiler_version(compiler_name)

        # Determine installation prefix
        if compiler_name == 'gcc':
            # strip off 'bin/gcc'
            self.compiler_prefix = os.path.dirname(
                os.path.dirname(path_to_compiler))

        elif compiler_name in ['icc', 'ifort']:
            intelvars_fn = path_to_compiler + 'vars.sh'
            if os.path.isfile(intelvars_fn):
                self.log.debug(
                    "Trying to determine compiler install prefix from %s",
                    intelvars_fn)
                intelvars_txt = read_file(intelvars_fn)
                prod_dir_regex = re.compile(r'^PROD_DIR=(.*)$', re.M)
                res = prod_dir_regex.search(intelvars_txt)
                if res:
                    self.compiler_prefix = res.group(1)
                else:
                    raise EasyBuildError(
                        "Failed to determine %s installation prefix from %s",
                        compiler_name, intelvars_fn)
            else:
                # strip off 'bin/intel*/icc'
                self.compiler_prefix = os.path.dirname(
                    os.path.dirname(os.path.dirname(path_to_compiler)))

            # For versions 2016+ of Intel compilers they changed the installation path so must shave off 2 more
            # directories from result of the above
            if LooseVersion(self.compiler_version) >= LooseVersion('2016'):
                self.compiler_prefix = os.path.dirname(
                    os.path.dirname(self.compiler_prefix))

        else:
            raise EasyBuildError("Unknown system compiler %s" %
                                 self.cfg['name'])

        if not os.path.exists(self.compiler_prefix):
            raise EasyBuildError(
                "Path derived for system compiler (%s) does not exist: %s!",
                compiler_name, self.compiler_prefix)
        self.log.debug(
            "Derived version/install prefix for system compiler %s: %s, %s",
            compiler_name, self.compiler_version, self.compiler_prefix)

        # If EasyConfig specified "real" version (not 'system' which means 'derive automatically'), check it
        if self.cfg['version'] == 'system':
            self.log.info(
                "Found specified version '%s', going with derived compiler version '%s'",
                self.cfg['version'], self.compiler_version)
        elif self.cfg['version'] != self.compiler_version:
            raise EasyBuildError(
                "Specified version (%s) does not match version reported by compiler (%s)"
                % (self.cfg['version'], self.compiler_version))
Пример #16
0
 def prepare_step(self, *args, **kwargs):
     """Do the bundle prepare step to ensure any deps are loaded. No need to worry about licences for Intel MPI"""
     Bundle.prepare_step(self, *args, **kwargs)
    def prepare_step(self, *args, **kwargs):
        """Load all dependencies, determine system MPI version, prefix and any associated envvars."""

        # Do the bundle prepare step to ensure any deps are loaded (no need to worry about licences for Intel MPI)
        Bundle.prepare_step(self, *args, **kwargs)

        # Prepare additional parameters: determine system MPI version, prefix and any associated envvars.
        mpi_name = self.cfg['name'].lower()

        # Determine MPI wrapper path (real path, with resolved symlinks) to ensure it exists
        if mpi_name == 'impi':
            # For impi the version information is only found in *some* of the wrappers it ships, in particular it is
            # not in mpicc
            mpi_c_wrapper = 'mpiicc'
            path_to_mpi_c_wrapper = which(mpi_c_wrapper)
            if not path_to_mpi_c_wrapper:
                mpi_c_wrapper = 'mpigcc'
                path_to_mpi_c_wrapper = which(mpi_c_wrapper)
                if not path_to_mpi_c_wrapper:
                    raise EasyBuildError("Could not find suitable MPI wrapper to extract version for impi")
        else:
            mpi_c_wrapper = 'mpicc'
            path_to_mpi_c_wrapper = which(mpi_c_wrapper)

        if path_to_mpi_c_wrapper:
            path_to_mpi_c_wrapper = resolve_path(path_to_mpi_c_wrapper)
            self.log.info("Found path to MPI implementation '%s' %s compiler (with symlinks resolved): %s",
                          mpi_name, mpi_c_wrapper, path_to_mpi_c_wrapper)
        else:
            raise EasyBuildError("%s not found in $PATH", mpi_c_wrapper)

        # Determine MPI version, installation prefix and underlying compiler
        if mpi_name in ('openmpi', 'spectrummpi'):
            # Spectrum MPI is based on Open MPI so is also covered by this logic
            output_of_ompi_info, _ = run_cmd("ompi_info", simple=False)

            # Extract the version of the MPI implementation
            if mpi_name == 'spectrummpi':
                mpi_version_string = 'Spectrum MPI'
            else:
                mpi_version_string = 'Open MPI'
            self.mpi_version = self.extract_ompi_setting(mpi_version_string, output_of_ompi_info)

            # Extract the installation prefix
            self.mpi_prefix = self.extract_ompi_setting("Prefix", output_of_ompi_info)

            # Extract any OpenMPI environment variables in the current environment and ensure they are added to the
            # final module
            self.mpi_env_vars = dict((key, value) for key, value in os.environ.iteritems() if key.startswith("OMPI_"))

            # Extract the C compiler used underneath the MPI implementation, check for the definition of OMPI_MPICC
            self.mpi_c_compiler = self.extract_ompi_setting("C compiler", output_of_ompi_info)
        elif mpi_name == 'impi':
            # Extract the version of IntelMPI
            # The prefix in the the mpiicc (or mpigcc) script can be used to extract the explicit version
            contents_of_mpixcc = read_file(path_to_mpi_c_wrapper)
            prefix_regex = re.compile(r'(?<=compilers_and_libraries_)(.*)(?=/linux/mpi)', re.M)

            self.mpi_version = None
            res = prefix_regex.search(contents_of_mpixcc)
            if res:
                self.mpi_version = res.group(1)
            else:
                # old iimpi version
                prefix_regex = re.compile(r'^prefix=(.*)$', re.M)
                res = prefix_regex.search(contents_of_mpixcc)
                if res:
                    self.mpi_version = res.group(1).split('/')[-1]

            if self.mpi_version is None:
                raise EasyBuildError("No version found for system Intel MPI")
            else:
                self.log.info("Found Intel MPI version %s for system MPI" % self.mpi_version)

            # Extract the installation prefix, if I_MPI_ROOT is defined, let's use that
            i_mpi_root = os.environ.get('I_MPI_ROOT')
            if i_mpi_root:
                self.mpi_prefix = i_mpi_root
            else:
                # Else just go up three directories from where mpiicc is found
                # (it's 3 because bin64 is a symlink to intel64/bin and we are assuming 64 bit)
                self.mpi_prefix = os.path.dirname(os.path.dirname(os.path.dirname(path_to_mpi_c_wrapper)))

            # Extract any IntelMPI environment variables in the current environment and ensure they are added to the
            # final module
            self.mpi_env_vars = {}
            for key, value in os.environ.iteritems():
                i_mpi_key = key.startswith('I_MPI_') or key.startswith('MPICH_')
                mpi_profile_key = key.startswith('MPI') and key.endswith('PROFILE')
                if i_mpi_key or mpi_profile_key:
                    self.mpi_env_vars[key] = value

            # Extract the C compiler used underneath Intel MPI
            compile_info, exit_code = run_cmd("%s -compile-info" % mpi_c_wrapper, simple=False)
            if exit_code == 0:
                self.mpi_c_compiler = compile_info.split(' ', 1)[0]
            else:
                raise EasyBuildError("Could not determine C compiler underneath Intel MPI, '%s -compiler-info' "
                                     "returned %s", mpi_c_wrapper, compile_info)

        else:
            raise EasyBuildError("Unrecognised system MPI implementation %s", mpi_name)

        # Ensure install path of system MPI actually exists
        if not os.path.exists(self.mpi_prefix):
            raise EasyBuildError("Path derived for system MPI (%s) does not exist: %s!", mpi_name, self.mpi_prefix)

        self.log.debug("Derived version/install prefix for system MPI %s: %s, %s",
                       mpi_name, self.mpi_version, self.mpi_prefix)

        # For the version of the underlying C compiler need to explicitly extract (to be certain)
        self.c_compiler_version = extract_compiler_version(self.mpi_c_compiler)
        self.log.debug("Derived compiler/version for C compiler underneath system MPI %s: %s, %s",
                       mpi_name, self.mpi_c_compiler, self.c_compiler_version)

        # If EasyConfig specified "real" version (not 'system' which means 'derive automatically'), check it
        if self.cfg['version'] == 'system':
            self.log.info("Found specified version '%s', going with derived MPI version '%s'",
                          self.cfg['version'], self.mpi_version)
        elif self.cfg['version'] == self.mpi_version:
            self.log.info("Specified MPI version %s matches found version" % self.mpi_version)
        else:
            raise EasyBuildError("Specified version (%s) does not match version reported by MPI (%s)",
                                 self.cfg['version'], self.mpi_version)
    def prepare_step(self, *args, **kwargs):
        """Do compiler appropriate prepare step, determine system compiler version and prefix."""
        if self.cfg['generate_standalone_module']:
            if self.cfg['name'] in ['GCC', 'GCCcore']:
                EB_GCC.prepare_step(self, *args, **kwargs)
            elif self.cfg['name'] in ['icc']:
                EB_icc.prepare_step(self, *args, **kwargs)
            elif self.cfg['name'] in ['ifort']:
                EB_ifort.prepare_step(self, *args, **kwargs)
            else:
                raise EasyBuildError("I don't know how to do the prepare_step for %s", self.cfg['name'])
        else:
            Bundle.prepare_step(self, *args, **kwargs)
            
        # Determine compiler path (real path, with resolved symlinks)
        compiler_name = self.cfg['name'].lower()
        if compiler_name == 'gcccore':
            compiler_name = 'gcc'
        path_to_compiler = which(compiler_name)
        if path_to_compiler:
            path_to_compiler = resolve_path(path_to_compiler)
            self.log.info("Found path to compiler '%s' (with symlinks resolved): %s", compiler_name, path_to_compiler)
        else:
            raise EasyBuildError("%s not found in $PATH", compiler_name)

        # Determine compiler version
        self.compiler_version = extract_compiler_version(compiler_name)

        # Determine installation prefix
        if compiler_name == 'gcc':
            # strip off 'bin/gcc'
            self.compiler_prefix = os.path.dirname(os.path.dirname(path_to_compiler))

        elif compiler_name in ['icc', 'ifort']:
            intelvars_fn = path_to_compiler + 'vars.sh'
            if os.path.isfile(intelvars_fn):
                self.log.debug("Trying to determine compiler install prefix from %s", intelvars_fn)
                intelvars_txt = read_file(intelvars_fn)
                prod_dir_regex = re.compile(r'^PROD_DIR=(.*)$', re.M)
                res = prod_dir_regex.search(intelvars_txt)
                if res:
                    self.compiler_prefix = res.group(1)
                else:
                    raise EasyBuildError("Failed to determine %s installation prefix from %s",
                                          compiler_name, intelvars_fn)
            else:
                # strip off 'bin/intel*/icc'
                self.compiler_prefix = os.path.dirname(os.path.dirname(os.path.dirname(path_to_compiler)))

            # For versions 2016+ of Intel compilers they changed the installation path so must shave off 2 more
            # directories from result of the above
            if LooseVersion(self.compiler_version) >= LooseVersion('2016'):
                self.compiler_prefix = os.path.dirname(os.path.dirname(self.compiler_prefix))

        else:
            raise EasyBuildError("Unknown system compiler %s" % self.cfg['name'])

        if not os.path.exists(self.compiler_prefix):
            raise EasyBuildError("Path derived for system compiler (%s) does not exist: %s!",
                                 compiler_name, self.compiler_prefix)
        self.log.debug("Derived version/install prefix for system compiler %s: %s, %s",
                       compiler_name, self.compiler_version, self.compiler_prefix)

        # If EasyConfig specified "real" version (not 'system' which means 'derive automatically'), check it
        if self.cfg['version'] == 'system':
            self.log.info("Found specified version '%s', going with derived compiler version '%s'",
                          self.cfg['version'], self.compiler_version)
        elif self.cfg['version'] != self.compiler_version:
            raise EasyBuildError("Specified version (%s) does not match version reported by compiler (%s)" %
                                 (self.cfg['version'], self.compiler_version))