#%Module

# NOTE: This is an automatically-generated file!  (generated by the
# Open MPI RPM).  Any changes made here will be lost a) if the RPM is
# uninstalled, or b) if the RPM is upgraded or uninstalled.

proc ModulesHelp { } {
   puts stderr "This module adds MPICH intel 1.2.7p1 to various paths"
}

module-whatis   "Sets up MPICH intel 1.2.7p1 in your environment"

# We check to see if any incompatible intel compilers are loaded
if {[module-info mode load] && ![module-info mode remove]} {
  if {[info exists env(LOADEDMODULES)]} {
    set envloaded [split $env(LOADEDMODULES) ":"]
    foreach mod [lsort -decreasing $envloaded] {
      set mmod "$mod/"
      # if an mpich module and it is different from us - then it conflicts, easy
      if {[string first "mpich/" $mmod] == 0 && [string first "mpich/intel/1.2.7p1/32" $mmod] != 0 } {
        puts stderr "Conflicting module $mod - removing before inserting requested module mpich/intel/1.2.7p1/32"
        module unload $mod
      }
    }
    foreach conflicts [ split "openmpi/ lam/ mpich2/" " " ] {
      set envloaded [split $env(LOADEDMODULES) ":"]
      foreach mod [lsort -decreasing $envloaded] {
        set mmod "$mod/"
        if {[string first $conflicts $mmod] == 0} {
          puts stderr "Conflicting module $mmod - removing before inserting requested module mpich/intel/1.2.7p1/32"
          module unload $mod
          }
      }
    }
  }
}

module load intel/9.1/32
prepend-path PATH "/usr/local/mpich/1.2.7p1/intel/i386/bin"
prepend-path LD_LIBRARY_PATH "/usr/local/mpich/1.2.7p1/intel/i386/lib:/usr/local/intel/lib:/usr/local/intel/lib/mpich-intel"
prepend-path MANPATH "/usr/local/mpich/1.2.7p1/intel/i386/man"
append-path -delim { } LOCAL_LDFLAGS "-L/usr/local/mpich/1.2.7p1/intel/i386/lib -L/usr/local/intel/lib -L/usr/local/intel/lib/mpich-intel"
prepend-path C_INCLUDE_PATH "/usr/local/mpich/1.2.7p1/intel/i386/include:/usr/local/intel/include "
prepend-path CPLUS_INCLUDE_PATH "/usr/local/mpich/1.2.7p1/intel/i386/include:/usr/local/intel/include"
prepend-path FPATH "/usr/local/mpich/1.2.7p1/intel/i386/include:/usr/local/intel/include"
prepend-path LIBRARY_PATH "/usr/local/mpich/1.2.7p1/intel/i386/lib:/usr/local/intel/lib:/usr/local/intel/lib/mpich-intel"

