How to write a parallel FitnessPrimitive

General issues of interest both for network and
individual cell parallelization.

Moderator: hines

Post Reply
mctavish
Posts: 74
Joined: Tue Mar 14, 2006 6:10 pm
Location: New Haven, CT

How to write a parallel FitnessPrimitive

Post by mctavish » Thu Jul 20, 2006 1:20 am

I have a FitnessPrimitive I am using with the MRF. When I try to run in parallel, I get the following error.

Code: Select all

save_context not a public member of FitnessPrimitive
/home/tom/neuron/nrn/i686/bin/nrniv: FitnessPrimitive save_context
 near line 0
 {paropt()}
           ^
        ParmFitness[0].save_context()
      ParmFitness[0].use_parallel(1)
    MulRunFitter[0].paropt()
/home/tom/neuron/nrn/i686/bin/nrniv: interrupted
 near line 0
 ^
Is there a shell tutorial of how to write hoc code for parallel processing, or even more specifically, for me to modify my FitnessPrimitive hoc code?

hines
Site Admin
Posts: 1580
Joined: Wed May 18, 2005 3:32 pm

Post by hines » Sat Jul 22, 2006 10:21 am

That was inadvertently left out.
I will have to add the save_context, restore_context pair to that class. Or you
can try to do it in nrn/lib/hoc/mulfit.hoc/eoneprim.hoc in analogy to eonefunc.hoc. I believe mere empty stubs are not sufficient.

But are you sure that your fitting project
is significantly parallelizable? Parallelization means only that the generators are run on different machines
during the process of computing the overall error function. Thus best results are obtained when the number of generators is an integer multiple of the number of machines and each generator takes the same amount of time.

mctavish
Posts: 74
Joined: Tue Mar 14, 2006 6:10 pm
Location: New Haven, CT

Post by mctavish » Tue Jul 25, 2006 5:12 am

I do not have separate generators, but the generator is parallelizable (I believe) in that it can ask for the fitness of several runs and then can evaluate the pool of results later for further processing.

hines
Site Admin
Posts: 1580
Joined: Wed May 18, 2005 3:32 pm

Post by hines » Tue Jul 25, 2006 7:22 am

I have committed the fixes for parallel fitting when one or more of the multiple generators are FitnessPrimitive.
However, from your last message, this will not help because you have one FitnessPrimitive which needs to be parallelized internally. The only way to do this is to provide your own parallel implementation using a ParallelContext instance and do your own interprocessor communication through the bulletin board.

eacheon
Posts: 97
Joined: Wed Jan 18, 2006 2:20 pm

Post by eacheon » Sun Dec 10, 2006 6:11 pm

I am also interested in parallelized fitting even with only one generator. I have one Multiple Run Fitter as my generator. It tooks minutes to finish one run of the model, I hope this can somehow be improved by rewriting some of my code so when I click on "|| Optimize", NEURON could distribute some runs on different CPUs (we have a cluster so it makes sense to me), so it is faster to explore the parameter space.

How difficult is this task? I guess the human time devoted is worth since in case of multiple run fitter, each run usually takes some time. and a whole optimization takes hundreds of runs...

If it possible, I am thinking giving -mpi switch a try.

hines
Site Admin
Posts: 1580
Joined: Wed May 18, 2005 3:32 pm

Post by hines » Fri Dec 15, 2006 7:12 am

Since you have only one generator, I'm afraid the || switch is not going to help.
It only parallelizes up to the number
of generators. I have not parallelized
the praxis method itself but there are
a few places we might be opportunistic
when it needs to evaluate the fitness
function two or three times to do its
basic line search. And I believe that
in some cases it can do more than
one line search at once such as when
it is calculating conjugate gradients.
The other direction is to parallelize an
individual run. I'm guessing you are using
a single cell and it is now possible to
split it into many pieces and harder to
arrange that the pieces are nearly the
same size. See
http://www.neuron.yale.edu/neuron/stati ... multisplit
You may want my help on this and if you send me enough code to do a single run
I'll take a look at the degree to which multisplit is applicable. In any case, be aware that presently the -mpi argument means that there is no gui and you are running in batch mode. (the MultiRunFitter still works in this mode but you must start it using hoc code
since nothing will appear on your screen.)

Post Reply