Skip to content
Snippets Groups Projects
Commit 35b1ad0c authored by POLCHER Jan's avatar POLCHER Jan :bicyclist_tone4:
Browse files

A more elegant exit when a processor does not have any land points.

parent 7fb79a28
No related branches found
No related tags found
No related merge requests found
......@@ -50,23 +50,24 @@ def halfpartition(partin, land) :
def fit_partition(partin, land):
partout = []
for i, dom in enumerate(partin):
l = land[dom["jstart"]:dom["jstart"]+dom["nbj"],dom["istart"]:dom["istart"]+dom["nbi"]]
l1 = np.sum(l, axis = 0)
if dom["nbland"] > 0 :
l = land[dom["jstart"]:dom["jstart"]+dom["nbj"],dom["istart"]:dom["istart"]+dom["nbi"]]
l1 = np.sum(l, axis = 0)
i0 = np.where(l1>0)[0][0]
i1 = np.where(l1>0)[0][-1]
i0 = np.where(l1>0)[0][0]
i1 = np.where(l1>0)[0][-1]
l2 = np.ma.sum(l, axis = 1)
j0 = np.where(l2>0)[0][0]
j1 = np.where(l2>0)[0][-1]
l2 = np.ma.sum(l, axis = 1)
j0 = np.where(l2>0)[0][0]
j1 = np.where(l2>0)[0][-1]
dom["jstart"] = j0 + dom["jstart"]
dom["nbj"] = j1-j0+1
dom["istart"] = i0 + dom["istart"]
dom["nbi"] = i1-i0+1
dom["nbland"] = int(np.nansum(land[dom["jstart"]:dom["jstart"]+dom["nbj"],dom["istart"]:dom["istart"]+dom["nbi"]]))
dom["jstart"] = j0 + dom["jstart"]
dom["nbj"] = j1-j0+1
dom["istart"] = i0 + dom["istart"]
dom["nbi"] = i1-i0+1
dom["nbland"] = int(np.nansum(land[dom["jstart"]:dom["jstart"]+dom["nbj"],dom["istart"]:dom["istart"]+dom["nbi"]]))
partout.append(dom)
partout.append(dom)
return partout
#
#
......@@ -361,6 +362,12 @@ class partition :
#
self.allistart = []
self.alljstart = []
#
if self.size != len(part) :
ERROR("There are too many processors for the size of the domain.")
ERROR(str(self.size)+" processors. But partition could only achieve "+str(len(part))+" domain with land points")
sys.exit()
#
for i in range(self.size) :
self.allistart.append(part[i]["istart"])
self.alljstart.append(part[i]["jstart"])
......
......@@ -42,15 +42,15 @@ fi
#
/bin/rm -f run.def *.txt
cp run_E2OFD.def run.def
mpirun -n 2 python ../../RoutingPreProc.py
mpirun -n 3 python ../../RoutingPreProc.py
if [ $? -gt 0 ] ; then
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "X Run E2OFD on 4 Proc failed X"
echo "X Run E2OFD on 3 Proc failed X"
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
exit
else
echo "=================================="
echo "= Run E2OFD on 4 Proc successful ="
echo "= Run E2OFD on 3 Proc successful ="
echo "=================================="
ls -lt
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment