Hi all,
I was trying to calculate the spin parameter for a halo with the following simple script,
center = [0.495013, 0.494046, 0.495160]
radius = 100 # pc
pf = load("DD0019/output_0019")
sp = pf.h.sphere(center, radius/pf["pc"])
gas_spin = sp.quantities["BaryonSpinParameter"]()
and it doesn't work in parallel. It gives the following traceback.
---
Traceback (most recent call last):
File "spin.py", line 9, in <module>
gas_spin = sp.quantities["BaryonSpinParameter"]()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.6-intel.egg/yt/data_objects/derived_quantities.py", line 85, in __call__
self.func(e, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.6-intel.egg/yt/data_objects/derived_quantities.py", line 237, in _BaryonSpinParameter
am = data["SpecificAngularMomentum"]*data["CellMassMsun"]
ValueError: shape mismatch: objects cannot be broadcast to a single shape
Traceback (most recent call last):
File "spin.py", line 9, in <module>
gas_spin = sp.quantities["BaryonSpinParameter"]()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.6-intel.egg/yt/data_objects/derived_quantities.py", line 85, in __call__
self.func(e, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.6-intel.egg/yt/data_objects/derived_quantities.py", line 237, in _BaryonSpinParameter
am = data["SpecificAngularMomentum"]*data["CellMassMsun"]
ValueError: shape mismatch: objects cannot be broadcast to a single shape
---
This happens on multiple systems. I looked into this further, and I think the shapes of the angular momentum data are not being preserved in the MPI calls. Also the shapes appear wrong in a serial calculation. In serial, everything looks fine until data["SpecificAngularMomentum"] is returned. Here are the shapes of the arrays.
v_vec: (3,16,16,16)
cross product of r_vec and v_vec: (3,16,16,16)
and the returned array from _SpecificAngularMomentum has a shape of (3,0)!
Then when I try to run it with 2 processors, the shapes change to
v_vec: (3,4096)
cross: (3,4096)
_SpecificAngularMomentum result: (12288,)
Can someone replicate this error? Any ideas?
Thanks,
John