# Common modulefile for mvapich
# Using "modulerc based" strategy
# Expects the following variables to have been
# previously defined:
#	version: version of mvapich
#	compilerTag: the compiler to use

# Declare the path where the packages are installed
# The reference to the environment variable is a hack
# for this example; normally one would hard code a path
set rootdir $::env(MOD_GIT_ROOTDIR)
set swroot $rootdir/doc/example/compiler-etc-dependencies/dummy-sw-root

# Also get location of and load common procedures
# This is a hack for the cookbook examples, in production
# one should either
# 1) declare the procedures in a site config file (preferred)
# 2) hardcode the path to $tcllibdir and common_utilities.tcl
set tcllibdir $rootdir/doc/example/compiler-etc-dependencies/tcllib
source $tcllibdir/common_utilities.tcl

proc ModulesHelp { } {
   global version compilerTag
   puts stderr "
mvapich: Test dummy version of mvapich $version

mvapich version: $version
Compiler: $compilerTag

For testing packages depending on compilers/MPI

"
}

module-whatis "Dummy mvapich $version (built for $compilerTag)"

# Make sure loadedCompiler matches what we want.  And
# load compiler if no compiler loaded
#LoadedCompilerMatches $compilerTag 1 1
# For Env Modules 3.x, set requireIt to 0
LoadedCompilerMatches $compilerTag 0 1

# Compute the installation prefix
set pkgroot $swroot/mvapich
set vroot $pkgroot/$version
set prefix $vroot/$compilerTag

# Set environment variables
setenv MPI_DIR $prefix

set bindir $prefix/bin
set libdir $prefix/lib
set incdir $prefix/include

prepend-path PATH            $bindir
prepend-path LIBRARY_PATH    $libdir
prepend-path LD_LIBRARY_PATH $libdir
prepend-path CPATH           $incdir
