starting step to parallelization

A collection of noteworthy items selected by our moderators from discussions about making and using models with NEURON.

Moderators: wwlytton, tom_morse

Post Reply
menica
Posts: 68
Joined: Wed Sep 02, 2015 11:02 am

starting step to parallelization

Post by menica » Fri Mar 23, 2018 11:42 am

hi,
I would like to parallelize my code for parameters sweep analysis, but before to deal with its complexity I am getting familiar to the method. I have an embarrassingly parallel computationsand I am using the Bulletin board style.

I am still not sure if my first step to the parallelization is correct.

Here the simple code I tested:

Code: Select all

load_file("nrngui.hoc")

objref pc 
pc = new ParallelContext(2) 

print "number of hosts: ", pc.nhost(), "\thost id: ", pc.id()

create soma
soma {
	L = 10
	diam = 10
	nseg = 1
	insert hh
}

tstop = 1500
dt = 0.025
v_init = -65

objref stim
soma stim = new IClamp(0.5)
stim.del = 100
stim.dur = 5
stim.amp = 5



objref g,s
g= new Vector(3)
s= new Vector(3)
g.x[0] = 0.0001
g.x[1] = 0.12
g.x[2] = 2
s.x[0] = 0.0001
s.x[1] = 0.12
s.x[2] = 2


pc.runworker()

strdef pccmd

proc batrun4() { 

	for i=0,2 {	
		for j=0,2 {
			sprint(pccmd, "soma.gnabar_hh = g.x[%d] soma.gkbar_hh= s.x[%d] run()\n", i, j)
			pc.submit("pccmd")
				}
			}
    while ((id=pc.working()) != 0) { 
    	print "hello"
  	//print "id", id
  }
}


batrun4() 
pc.done()
quit()


To me it seems that only for the case i=2 and j=2 the id returned by working() is positive.
Any help in understanding this?

Thanks

Post Reply