xref: /oneTBB/integration/linux/modulefiles/tbb (revision 35e0f552)
1#%Module1.0###################################################################
2#
3# Copyright (c) 2020-2021 Intel Corporation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Why all the directory and filename boilerplate code? It is needed in order
18# to properly remove symbolic links used in assembly of the modulefiles
19# folder as well as those found within the oneAPI installation folders.
20# Without it many modulefiles will fail to work as expected.
21
22# IMPORTANT: quotes around "$variables" and "[expressions]" are there
23# to insure that paths/filenames which include spaces are handled properly.
24
25# This modulefile requires Environment Modules 4.1 or later.
26# Type `module --version` to determine the current installed version.
27
28set min_tcl_ver 8.4
29if { $tcl_version < $min_tcl_ver } {
30    puts stderr " "
31    puts stderr "ERROR: This modulefile requires tcl $min_tcl_ver or greater."
32    puts stderr "Your system reports that tclsh version $tcl_version is installed."
33    exit 1
34}
35
36# get full pathname for this script file
37set scriptpath "${ModulesCurrentModulefile}"
38
39# if modulefile script name is a symlink, resolve it
40if { "[file type "$scriptpath"]" eq "link" } {
41    set scriptpath "[file readlink "$scriptpath"]"
42}
43
44# if fullpath contains links, resolve them
45set scriptpath "[file normalize "$scriptpath"]"
46
47# get directory holding this modulefile script and others
48set modulefileroot "[file dirname "$scriptpath"]"
49
50# get name of modulefile script we are loading
51set modulefilename "[file tail "$scriptpath"]"
52
53# determine modulefile script version
54set modulefilever "[file dirname "$modulefileroot"]"
55set modulefilever "[file tail "$modulefilever"]"
56
57# point to component top-level root folder
58set componentroot "[file dirname "$modulefileroot"]"
59set componentroot "[file dirname "$componentroot"]"
60
61# get component folder name
62set componentname "[file tail "$componentroot"]"
63
64# get oneAPI top-level root folder
65set oneapiroot "[file dirname "$componentroot"]"
66
67# disallow loading multiple versions of this modulefile
68# disallow loading multiple architectures of this modulefile
69# if only 64-bit architecture exists the test still works
70set mname32 $modulefilename
71set mname64 [string trimright $mname32 "32"]
72if { [string equal "$mname32" "$mname64"] } {
73    append mname32 "32"
74}
75conflict $mname32
76conflict $mname64
77
78
79# On load print component name and version being loaded
80if { [ module-info mode load ] } {
81    puts stderr "Loading $modulefilename version $modulefilever"
82}
83
84# On `module unload` print component module name and version being removed
85# Include `module list` message only if this modulefile loads dependent modules
86if { [ module-info mode ] == "unload" || [ module-info mode ] == "remove" } {
87    puts stderr "Removing $modulefilename version $modulefilever"
88    puts stderr "Use `module list` to view any remaining dependent modules."
89}
90
91
92# ###### Component Specific env vars setup ###################################
93
94set tbbroot "$componentroot/$modulefilever"
95set tbb_target_arch "intel64"
96
97module-whatis "Intel(R) oneAPI Threading Building Blocks for $tbb_target_arch."
98
99setenv TBBROOT "$tbbroot"
100
101prepend-path CPATH "$tbbroot/include"
102prepend-path LIBRARY_PATH "$tbbroot/lib/$tbb_target_arch/gcc4.8"
103prepend-path LD_LIBRARY_PATH "$tbbroot/lib/$tbb_target_arch/gcc4.8"
104prepend-path CMAKE_PREFIX_PATH "$tbbroot"
105