#%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 Open MPI gcc 1.2.2 to various paths"
}

module-whatis   "Sets up Open MPI gcc 1.2.2 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 "openmpi/" $mmod] == 0 && [string first "openmpi/gcc/1.2.2/64" $mmod] != 0 } {
        puts stderr "Conflicting module $mod - removing before inserting requested module openmpi/gcc/1.2.2/64"
        module unload $mod
      }
    }
    foreach conflicts [ split "mpich/ mpich2/ lam/ intel/" " " ] {
      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 openmpi/gcc/1.2.2/64"
          module unload $mod
          }
      }
    }
  }
}



prepend-path PATH "/usr/local/openmpi/1.2.2/gcc/x86_64/bin"
prepend-path LD_LIBRARY_PATH "/usr/local/openmpi/1.2.2/gcc/x86_64/lib64:/usr/local/lib64/openmpi-gcc"
prepend-path MANPATH "/usr/local/openmpi/1.2.2/gcc/x86_64/man"
#append-path -d { } LOCAL_LDFLAGS "-L/usr/local/openmpi/1.2.2/gcc/x86_64/lib64 -L/usr/local/lib64/openmpi-gcc"
