Parallel neuron help!

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

Moderator: hines

Post Reply
nancyShu

Parallel neuron help!

Post by nancyShu »

Hi,


I'm running some code parallel context on a cluster and meeting a problem.

"run_1.hoc" works well without any bugs while "run_2.hoc" dosen't.
Could you give me some tips about it?

The pseudocode is this

==================
run_1.hoc:

Code: Select all

create soma
... // codes that define a soma

create synapse
... // codes that define a synapse

objref pc
pc = parallelcontext()

proc task1() {
	pc.source_var(&soma.v(0.5),1);
	pc.setup_transfer()
	pc.set_maxstep(5)
	pc.stdinit()
	pc.psolve()
}
proc task2() {
	pc.source_var(&synapse.g,1);
	pc.setup_transfer()
	pc.set_maxstep(5)
	pc.stdinit()
	pc.psolve()
}

pc.runworker()

pc.submit("task1()")
pc.submit("task2()")

while(pc.working) {
	print "cpu=",pc.id()," done!"
}

pc.done()

==================
run_2.hoc:

Code: Select all

objref pc
pc = parallelcontext()

proc task1() {
	create soma
	... // the same codes that define a soma
		// occurs some syntax errors.
	
	pc.source_var(&soma.v(0.5),1);
	pc.setup_transfer()
	pc.set_maxstep(5)
	pc.stdinit()
	pc.psolve()
}
proc task2() {
	create synapse
	... // the same codes that define a synapse
		// occurs some syntax errors.

	pc.source_var(&synapse.g,1);
	pc.setup_transfer()
	pc.set_maxstep(5)
	pc.stdinit()
	pc.psolve()
}

pc.runworker()

pc.submit("task1()")
pc.submit("task2()")

while(pc.working) {
	print "cpu=",pc.id()," done!"
}

pc.done()
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Parallel neuron help!

Post by ted »

Before a user-defined name can be treated as a section, it must first be declared with a create statement that appears outside of any proc or func. Look at the top of a template that defines a biophysical model cell class, and one of the items that appears before any proc or func will be a create statement that asserts that one or more names will be treated as sections.

Code: Select all

create soma
proc foo () {
  create soma
}
is OK, but

Code: Select all

// create soma
proc foo () {
  create soma
}
is not.
See the Programmer's Reference documentation of create:
https://www.neuron.yale.edu/neuron/stat ... ml#index-0
nancyShu

Re: Parallel neuron help!

Post by nancyShu »

I get it! Thanks Ted for the fast reply!
Post Reply