[yt-users] Clump finding and mpi4py
Eve Lee
elee at cita.utoronto.ca
Mon Aug 15 13:57:39 PDT 2011
Hello,
May I ask if the current version of yt supports parallelization of clump
finding routine?
When I use mpirun.py -np (whatever number) python (name of my clump
finding routine) (some arguments my routine requires) --parallel, I keep
getting the following error:
Traceback (most recent call last):
File "find_clumps.py", line 32, in <module>
amods.level_sets.find_clumps(base, c_min, c_max, step)
File
"/home/jchong/yt/new_dev/xxx/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py",
line 188, in find_clumps
elif (child._isValid()):
File
"/home/jchong/yt/new_dev/xxx/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py",
line 143, in _isValid
self.function_value = eval(self.function)
File "<string>", line 1, in <module>
File
"/home/jchong/yt/new_dev/xxx/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
line 86, in __call__
self.func(e, *args, **kwargs)
File
"/home/jchong/yt/new_dev/xxx/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
line 347, in _IsBound
bv_x,bv_y,bv_z = data.quantities["BulkVelocity"]()
AttributeError: 'FieldDetector' object has no attribute 'quantities'
This version is updated to changeset 4457:bf868d1a8f02.
I have no problem running the same routine serially but it would be nice
if I can run parallel to save some time.
Below is my clump finding routine if it helps:
from yt.mods import *
import sys
#Find and save clumps
#Read in the command-line-passed arguments
datadir = sys.argv[1]
pltdir = sys.argv[2]
datanum_start = int(sys.argv[3])
datanum_end = int(sys.argv[4])
datanum_step = int(sys.argv[5])
for i in range(datanum_start, datanum_end, datanum_step):
pf = load(datadir+"DD%04i/data%04i" %(i,i))
center = [0.5, 0.5, 0.5]
radius = 1.0
sp = pf.h.sphere(center, radius)
particles = pf.h.find_particles_by_type(4)
if type(particles) != types.NoneType:
field = "Matter_Density" #Use both
new_function =
'self.data.quantities["IsBound"](truncate=True,include_thermal_energy=False)
> 1.0'
else:
field = "Density"
new_function =
'self.data.quantities["IsBound"](truncate=True,include_thermal_energy=False,include_particles=False)
> 1.0'
c_min = 10**na.floor(na.log10(sp[field]).min()+1)
c_max = 10**na.floor(na.log10(sp[field]).max()+1)
step = 10
#Find clumps
base = amods.level_sets.Clump(sp, None, field, function=new_function)
amods.level_sets.find_clumps(base, c_min, c_max, step)
#Save clumps
pf.h.save_object(base, "Clump")
Thanks!
Best Regards,
Eve
More information about the yt-users
mailing list