| 1 |
# Common stuff for modulefile for package bar |
| 2 |
# Using "homebrewed flavors" strategy |
| 3 |
# |
| 4 |
# This file expects the following Tcl variables to have been |
| 5 |
# previously set: |
| 6 |
# version: version of bar |
| 7 |
|
| 8 |
# Declare the path where the packages are installed |
| 9 |
# The reference to the environment variable is a hack |
| 10 |
# for this example; normally one would hard code a path |
| 11 |
set rootdir $::env(MOD_GIT_ROOTDIR) |
| 12 |
set swroot $rootdir/doc/example/compiler-etc-dependencies/dummy-sw-root |
| 13 |
|
| 14 |
# Also get location of and load common procedures |
| 15 |
# This is a hack for the cookbook examples, in production |
| 16 |
# one should either |
| 17 |
# 1) declare the procedures in a site config file (preferred) |
| 18 |
# 2) hardcode the path to $tcllibdir and common_utilities.tcl |
| 19 |
set tcllibdir $rootdir/doc/example/compiler-etc-dependencies/tcllib |
| 20 |
source $tcllibdir/common_utilities.tcl |
| 21 |
|
| 22 |
proc ModulesHelp { } { |
| 23 |
puts stderr " |
| 24 |
bar: Test dummy version of bar $version |
| 25 |
|
| 26 |
For testing packages depending on compilers/MPI |
| 27 |
|
| 28 |
" |
| 29 |
} |
| 30 |
|
| 31 |
module-whatis "Dummy bar $version" |
| 32 |
|
| 33 |
# Figure out what compiler we have loaded |
| 34 |
# Will default to and load default compiler if none loaded |
| 35 |
set ctag [ GetLoadedCompiler 1 1 1 ] |
| 36 |
|
| 37 |
# Figure out what simd is loaded |
| 38 |
set simd [ GetTagOfModuleLoaded simd ] |
| 39 |
# If no simd loaded, default to sse4.1 |
| 40 |
if { $simd eq {} } { |
| 41 |
set simd simd/sse4.1 |
| 42 |
# We will load this so autohandling knows is a dependency |
| 43 |
module load $simd |
| 44 |
PrintLoadInfo "Setting simd to $simd" |
| 45 |
} |
| 46 |
# Just get version of simd |
| 47 |
set simdVersion [ lindex [ split $simd / ] 1 ] |
| 48 |
|
| 49 |
# Compute the installation prefix |
| 50 |
set pkgroot $swroot/bar |
| 51 |
set vroot $pkgroot/$version |
| 52 |
set prefix $vroot/$ctag/$simdVersion |
| 53 |
|
| 54 |
# Make sure there is a build for this foo version/compiler/simd |
| 55 |
# I.e. that the prefix exists |
| 56 |
if ![ file exists $prefix ] { |
| 57 |
# Not built for this compiler/MPI, alert user and abort |
| 58 |
PrintLoadError " |
| 59 |
foo/$version does not appear to be built for compiler $ctag and $simd |
| 60 |
|
| 61 |
Please select a different openmpi version or different compiler/simd combination. |
| 62 |
" |
| 63 |
} |
| 64 |
|
| 65 |
# We need to prereq the compiler to allow autohandling to work |
| 66 |
prereq $ctag |
| 67 |
# and simd |
| 68 |
prereq $simd |
| 69 |
|
| 70 |
# Set environment variables |
| 71 |
setenv FOO_DIR $prefix |
| 72 |
|
| 73 |
set bindir $prefix/bin |
| 74 |
set libdir $prefix/lib |
| 75 |
set incdir $prefix/include |
| 76 |
|
| 77 |
prepend-path PATH $bindir |
| 78 |
prepend-path LIBRARY_PATH $libdir |
| 79 |
prepend-path LD_LIBRARY_PATH $libdir |
| 80 |
prepend-path CPATH $incdir |
| 81 |
|
| 82 |
conflict bar |