I have tried to run a simple program (below) on two nodes. It should transfer the value 99 of the variable "a" between nodes 1 and 0.
If my program is correct, then I should see a value 99 assigned to the variable "a" on both nodes 0 and 1. But after running the program the variable "a" has the value 99 only on the node 1, where it was set to this value, and value 1 on the node 0, where it should be transfered. That means that the transfer across nodes did not happened.
The most probably I am not using these methods properly.
Does somebody know how to use them correctly?
Code: Select all
load_file("nrngui.hoc")
objref pc
proc set_maxstep() { pc.set_maxstep(5) }
proc doinit() { stdinit() }
proc psolve() { pc.psolve($1) print_a() }
proc print_a() { print "My id: ", pc.id, " a= ", a, "time= ", t }
proc tr() { pc.setup_transfer() }
proc set_a() { if (pc.id == 1) a = 99 }
cvode.active(0)
pc = new ParallelContext()
tstop = 100
a = 1
if (pc.id == 0) {
pc.target_var(&a, 0)
pc.setup_transfer()
}
if (pc.id == 1) {
pc.source_var(&a, 0)
pc.setup_transfer()
}
pc.runworker()
pc.context("set_maxstep()\n")
set_maxstep()
pc.context("tr()\n")
tr()
pc.context("doinit()\n")
doinit()
pc.context("set_a()\n")
pc.context("psolve", tstop)
psolve(tstop)
pc.done()
quit()
numprocs=2
NEURON -- VERSION 6.0.870 (1745) 2007-05-16 (1745M)
by John W. Moore, Michael Hines, and Ted Carnevale
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2007
1
1
0
1
1
1
1
1
My id: 1 a= 99 time= 99.975
My id: 0 a= 1 time= 99.975
0