def det_module_subdir(self, ec): """ Determine module subdirectory, relative to the top of the module path. This determines the separation between module names exposed to users, and what's part of the $MODULEPATH. Examples: Core, Compiler/GCC/4.8.3, MPI/GCC/4.8.3/OpenMPI/1.6.5 """ tc_comps = det_toolchain_compilers(ec) # determine prefix based on type of toolchain used if tc_comps is None: # no compiler in toolchain, dummy toolchain => Core module subdir = CORE else: tc_comp_name, tc_comp_ver = self.det_toolchain_compilers_name_version( tc_comps) tc_mpi = det_toolchain_mpi(ec) if tc_mpi is None: # compiler-only toolchain => Compiler/<compiler_name>/<compiler_version> namespace subdir = os.path.join(COMPILER, tc_comp_name, tc_comp_ver) else: # compiler-MPI toolchain => MPI/<comp_name>/<comp_version>/<MPI_name>/<MPI_version> namespace tc_mpi_fullver = self.det_full_version(tc_mpi) subdir = os.path.join(MPI, tc_comp_name, tc_comp_ver, tc_mpi['name'], tc_mpi_fullver) return subdir
def det_module_subdir(self, ec): """ Determine module subdirectory, relative to the top of the module path. This determines the separation between module names exposed to users, and what's part of the $MODULEPATH. Examples: Core, avx2/Compiler/gcc4.8, avx/MPI/gcc4.8/openmpi1.6 """ tc_comp_info = None tc_comp_name = "" if ec.toolchain.name != CUDACORE: tc_comps = det_toolchain_compilers(ec) tc_comp_info = self.det_toolchain_compilers_name_version(tc_comps) # determine prefix based on type of toolchain used if tc_comp_info is None: # no compiler in toolchain, dummy toolchain => Core module if ec.toolchain.name == CUDACORE: tc_cuda = det_toolchain_cuda(ec) tc_cuda_name = CUDA.lower() tc_cuda_fullver = self.det_twodigit_version(tc_cuda) subdir = os.path.join(CUDA, tc_cuda_name+tc_cuda_fullver) else: subdir = CORE else: tc_comp_name, tc_comp_ver = tc_comp_info tc_comp_name = tc_comp_name.lower().split('-')[0] tc_comp_ver = self.det_twodigit_version({'name': tc_comp_name, 'version': tc_comp_ver}) tc_mpi = det_toolchain_mpi(ec) tc_cuda = det_toolchain_cuda(ec) if tc_cuda is not None: # compiler-CUDA toolchain => CUDA/<comp_name>/<comp_version>/<CUDA_name>/<CUDA_version> namespace tc_cuda_name = CUDA.lower() tc_cuda_fullver = self.det_twodigit_version(tc_cuda) subdir = tc_cuda_name+tc_cuda_fullver if tc_comp_name != GCCCORE.lower(): subdir = os.path.join(tc_comp_name+tc_comp_ver, subdir) if tc_mpi is None: subdir = os.path.join(CUDA, subdir) else: tc_mpi_name = tc_mpi['name'].lower() tc_mpi_fullver = self.det_twodigit_version(tc_mpi) subdir = os.path.join(MPI, subdir, tc_mpi_name+tc_mpi_fullver) elif tc_mpi is None: # compiler-only toolchain => Compiler/<compiler_name><compiler_version> namespace if tc_comp_ver == 'system' or tc_comp_name == GCCCORE.lower(): subdir = CORE else: subdir = os.path.join(COMPILER, tc_comp_name+tc_comp_ver) else: # compiler-MPI toolchain => MPI/<comp_name><comp_version>/<MPI_name><MPI_version> namespace tc_mpi_name = tc_mpi['name'].lower() tc_mpi_fullver = self.det_twodigit_version(tc_mpi) subdir = os.path.join(MPI, tc_comp_name+tc_comp_ver, tc_mpi_name+tc_mpi_fullver) if os.getenv('RSNT_ARCH') is None: raise EasyBuildError("Need to set architecture to determine module path in $RSNT_ARCH") if subdir != CORE and not subdir.startswith(os.path.join(CUDA, CUDA.lower())): subdir = os.path.join(os.getenv('RSNT_ARCH'), subdir) elif tc_comp_name == GCCCORE.lower() and 'EBROOTGENTOO' in os.environ: subdir = os.path.join(os.getenv('RSNT_ARCH'), subdir) return subdir
def test_toolchain_inspection(self): """Test whether available toolchain inspection functionality is working.""" build_options = { 'robot_path': os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs'), 'valid_module_classes': module_classes(), } init_config(build_options=build_options) ec = EasyConfig(os.path.join(os.path.dirname(__file__), 'easyconfigs', 'gzip-1.5-goolf-1.4.10.eb')) self.assertEqual(['/'.join([x['name'], x['version']]) for x in det_toolchain_compilers(ec)], ['GCC/4.7.2']) self.assertEqual(det_toolchain_mpi(ec)['name'], 'OpenMPI') ec = EasyConfig(os.path.join(os.path.dirname(__file__), 'easyconfigs', 'hwloc-1.6.2-GCC-4.6.4.eb')) tc_comps = det_toolchain_compilers(ec) self.assertEqual(['/'.join([x['name'], x['version']]) for x in tc_comps], ['GCC/4.6.4']) self.assertEqual(det_toolchain_mpi(ec), None) ec = EasyConfig(os.path.join(os.path.dirname(__file__), 'easyconfigs', 'toy-0.0.eb')) self.assertEqual(det_toolchain_compilers(ec), None) self.assertEqual(det_toolchain_mpi(ec), None)
def det_module_subdir(self, ec): """ Determine module subdirectory, relative to the top of the module path. This determines the separation between module names exposed to users, and what's part of the $MODULEPATH. Examples: Core, Compiler/GCC/4.8.3, MPI/GCC/4.8.3/OpenMPI/1.6.5 """ # determine prefix based on type of toolchain used tc_comps = det_toolchain_compilers(ec) if tc_comps is None: # no compiler in toolchain, dummy toolchain => Core module subdir = CORE else: tc_comp_name, tc_comp_ver = self.det_toolchain_compilers_name_version(tc_comps) tc_mpi = det_toolchain_mpi(ec) if tc_mpi is None: # compiler-only toolchain => Compiler/<compiler_name>/<compiler_version> namespace subdir = os.path.join(COMPILER, tc_comp_name, tc_comp_ver) else: # compiler-MPI toolchain => MPI/<comp_name>/<comp_version>/<MPI_name>/<MPI_version> namespace tc_mpi_fullver = tc_mpi["version"] + tc_mpi["versionsuffix"] subdir = os.path.join(MPI, tc_comp_name, tc_comp_ver, tc_mpi["name"], tc_mpi_fullver) return subdir
def det_module_subdir(self, ec): """ Determine module subdirectory, relative to the top of the module path. This determines the separation between module names exposed to users, and what's part of the $MODULEPATH. Examples: Core, Compiler/GCC/4.8.3, MPI/GCC/4.8.3/OpenMPI/1.6.5 """ tc_comps = det_toolchain_compilers(ec) tc_comp_info = self.det_toolchain_compilers_name_version(tc_comps) # determine prefix based on type of toolchain used if tc_comp_info is None: # no compiler in toolchain, dummy toolchain => Core module subdir = CORE # except if the module is a MPI settings module stripped_name = re.sub('-settings$', '', ec['name']) if stripped_name in mpi_with_settings: subdir = os.path.join(MPI_SETTINGS, stripped_name, ec['version']) else: tc_comp_name, tc_comp_ver = self._find_relevant_compiler_info( tc_comp_info) tc_mpi = det_toolchain_mpi(ec) if tc_mpi is None: # compiler-only toolchain => Compiler/<compiler_name>/<compiler_version> namespace # but we want the mpi module class to stand alone if ec['moduleclass'] == MODULECLASS_MPI: subdir = os.path.join(COMPILER, MODULECLASS_MPI, tc_comp_name, tc_comp_ver) else: subdir = os.path.join(COMPILER, tc_comp_name, tc_comp_ver) else: tc_mpi_name, tc_mpi_ver = self._find_relevant_mpi_info(tc_mpi) # compiler-MPI toolchain => MPI/<comp_name>/<comp_version>/<MPI_name>/<MPI_version> namespace subdir = os.path.join(MPI, tc_comp_name, tc_comp_ver, tc_mpi_name, tc_mpi_ver) return subdir