BAS Main Index
  [Science]   [BAS home]   [Met home]   [Beowulf home] Antarctic Meteorology 


[simplified version; old version] | Another way: see Alan Iwis page.

Propagating the environment in MPP

The model requires numerous environmental variables to be set in order to run. In the "standard" version, the file ...parexe... is written, containing the setup of the environment, followed by execution of the executable. Spiffy. On a cray, and who knows under scali/myrinet, presumably that works. Under mpich, it doesn't: jobs are simply rsh'd onto remote nodes, and *don't* pick up a copy of the environment of their spawning process.

Andy Heaps and I solved this independantly. His version (available where?) makes PE0 send the env variables to the other processors. My version makes all the processors read their env from a file.

  1. Once only, your sysadmin needs to edit qsmain, and add the following lines (I ought to make this a script mod but haven't) delimited by "WMC"'s:
    #L----------------------------------------------------------------------
    #L Step 2 - Compile
    #L
        echo "\nqsmain($SECONDS): ***\tRunning qsmncompile"
    # <WMC 2002/04/19>
      echo WMC: making $DATAW/wsetenv-include
      echo "      open(unit=200,file='$HOME/test-env-$RUNID',status='old')" > $DATAW/wsetenv-include
    # </WMC>
    
    and
    # <WMC 2002/04/19>
    # Make the file that will be read to supply the environment
      env | make-test-env.pl > ~/test-env-$RUNID
    
      echo "$LOADMODULE" >> $PAREXE
      chmod u+x $PAREXE
    
    # This bit is somewhat optional but it makes life cleaner: don't actually try
    # to run the exec if its MPP
      if test $UM_NPES -eq 1
      then
        echo WMC: running your executable on $HOSTNAME because you only asked for one \($UM_NPES\) proc
        $LOADMODULE >>$OUTPUT #run without server process
      else
        echo WMC: not actually running your executable because you asked for $UM_NPES processors.
        echo      go to $DATAW and mpirun it by hand, until we get PBS set up...
        CC=0
      fi
    # </WMC>
    
  2. in mods-for-the-executable in the umui, include wmc-set-env1.upd and wmc-set-env-c.upd (one is a fortran mod, one c; guess which...). Get these from modsets page.
  3. Run the model under mpich as "usual":
       mpirun -np n -machinefile mf -nolocal RUNID.exe 1>one 2>two </dev/null &
    
    Note that this has the slight advantage that *you* can run it by hand instead of from within a script.

And there we are. Did you use it? Did it work for you? Yes/No, let me know... wmc@bas.ac.uk

Past last modified: 19/4/2002   /   wmc@bas.ac.uk

© Copyright Natural Environment Research Council - British Antarctic Survey 2001