Code: Select all
from mpi4py import MPI
from neuron import h
MyString = "oldName"
print "The original string is: " + MyString
pc = h.ParallelContext()
pc.barrier()
if int(pc.id()) == 0:
MyString="newNameTest"
print "Host 0 set the string to: " + MyString
pc.barrier()
pc.broadcast(MyString, float(0)) # I've tried 0, float(0), int(0)
pc.barrier()
print "Host " + `int(pc.id())` + " now thinks the string is: " + MyString
Code: Select all
munchkin:ringpy mariannebezaire$ mpiexec -n 4 python mwe.py
numprocs=4
NEURON -- VERSION 7.5 (1455:c206cbee3a71) 2016-08-11
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits
The original string is: oldName
The original string is: oldName
The original string is: oldName
The original string is: oldName
Host 0 set the string to: newNameTest
Host 3 now thinks the string is: oldName
Host 1 now thinks the string is: oldName
Host 2 now thinks the string is: oldName
Host 0 now thinks the string is: newNameTest
munchkin:ringpy mariannebezaire$
What am I doing wrong? Thanks!>>> h.nrnversion(6)
" '--prefix=/Applications/NEURON-7.4/nrn' '--with-iv=/Applications/NEURON-7.4/iv' '--with-nrnpython=dynamic' '--with-paranrn=dynamic' 'PYLIB=-lpython' 'PYLIBLINK=-lpython'"