Page 1 of 1

reading environment variables in (parallel) neuron

Posted: Wed May 02, 2007 4:27 pm
by ubartsch
I have a hopefully simple question:

I would like to run multiple versions of my parallel(!) network with different parameter sets. Therefore a started intance of nrn would need some kind of awareness which process it is.
Multiple ideas how to realise that:

Is there any way to read MPI environment variables directly from nrn?
(Which would be most handy!)

Is there a way to read shell environment variables?

Is there any other way apart from here documents to pass variables to neuron.
(The qeue managing software on our cluster doest doesn't deem to like this type of scripting?!)

Many thanks for some hints

Posted: Thu May 03, 2007 11:08 am
by hines
Do you mean you are simultaneously running distinct mpiexec or mpirun commands with nrniv as the program along with a -mpi argument?

If there is only one mpiexec then everyone can figure out what to do based on their rank value.

But in the first case, sounds like what is really needed is a

Code: Select all

-e "statements"
so every rank of a given mpiexec nrniv instance has the same statement but they are different for different mpiexec groups. Anyway, for now you can work around the absence of -e and the strange limitations of your queue system, by using environment variables that you read from a mod file. ie. wrap getenv to make it available to the hoc interpreter.

Actually, perhaps your queue system is not strange and the reason that here scripts don't work is because mpiexec nrniv does not give a stdin to nrniv. I see

Code: Select all

[hines@localhost ~]$ mpiexec -help

mpiexec [global args] [local args] executable [args]
   where global args may be
      -s <spec>                    # direct stdin to "all" or 1,2 or 2-4,6

Posted: Sat May 05, 2007 11:23 am
by hines
A -c "statement" option has been added.

Posted: Mon May 07, 2007 8:34 am
by ubartsch
Thanks, very much!
I spoke to our admin and the new Neuron version will be installed "soon".

But in the mean time I would need a quick hack to run my programs.
This is the mod file I've written:

Code: Select all

TITLE getenv

get environment vars for parallel batch simulation

	GLOBAL jobid
	GLOBAL taskid


#include <stdio.h>
#include <stdlib.h>

//static double jobid, taskid;
static loadenv() 
char *j, *t;
  j = getenv("JOB_ID");
  //printf ("%s \n", j);
  t = getenv("SGE_TASK_ID");



And it compiles fine, but Neuron doesn't seem to read the variables.
I've put that mech in dummy_cell template and after creating the cell the value of jobid_getenv is still the standard value from definition (0).
I couldn't figure out how to make these variables availbale to hoc.
The nrnivmodl generated c file suggest they are declared as global varibales and pointer have been set but something is missing I guess.

Many thanks for a final hint.