Page 1 of 1

Another Kind of parallelisation

Posted: Wed Nov 14, 2007 9:09 am
by Vincent d
Hi everyone,

A frequency parameter for my stimulation is increased at each turn of a loop, 50 frequencies are tested at each run.

I've parallelised the process such that n trials can be performed simultaneously, for a statistical analysis. (i use the ParallelNetManager)

Is there any easy way to parallel the process such that n groups of processors are working on n independant trials, AND within each of these groups, each processors is testing 1 assigned frequency?

This would lead to a 50 times shorter duration.

Thank you for any idea or comment,

=)

Posted: Thu Nov 15, 2007 8:02 am
by hines
Is there any easy way to parallel the process such that n groups of processors are working on n independant trials, AND within each of these groups, each processors is testing 1 assigned frequency?
I interpret this as a set of ntrial*nfreq
independent runs. i.e.

Code: Select all

for itrial = 1, ntrial {
    for ifreq = 1, nfreq {
        do_a_sim(itrial, ifreq)
    }
}
and if that is the case then the master can submit to the bulletin board enough two parameter "todo" items to keep all the processors busy.

However, if one of the above loops in fact is a single run network simulation then I am afraid the bulletin board and
network communication presently cannot be used simultaneously and one must do all communication in a way compatible with network communication. i.e. if a network sim uses 10 processes and you have 50 available, then you can combine 5 networks into one large network and do a run. Then use pc.barrier, pc.allreduce, pc.allgather, and pc.broadcast to exchange data. The latter is new in the alpha version and can be used to send an string or Vector from
any pc.id to all the other ranks.

Posted: Thu Nov 15, 2007 8:12 am
by Vincent d
Well, it relies on the main script structure...

Organize your functions and variables such that the total number of task is: #tasks = #repetitions . #values to be tested

i use this simple code:

///////////////////////////////////////////////////////////////////

n // Number of tasks
N // Number of repetitions

pnm1 = new ParallelNetManager(n)
pnm1.round_robin()
pnm1.ncell = n

for i=0, n-1 {

variable = any_function_of_i(i,N,...)

if(i%pnm1.nhost == pnm1.myid){

///// Execute whatever you want here...
///// function(variable,...)...

}
}

pnm1.pc.runworker
pnm1.pc.done()

///////////////////////////////////////////////////////////////////

Then it should be effeciently parallelized!

I hope it would help...

Bye,

=)

Posted: Thu Nov 15, 2007 8:16 am
by Vincent d
We posted simultaneously!

Thank you for answering, your help is precious.

=)