Skip to content
Snippets Groups Projects
Commit 46d2fba2 authored by Kaushik Kulkarni's avatar Kaushik Kulkarni Committed by Andreas Klöckner
Browse files

numpyify scalars before calling MPI-reduce on them

parent b325eeaf
No related branches found
No related tags found
No related merge requests found
Pipeline #179619 passed
......@@ -143,8 +143,9 @@ def nodal_sum(dcoll: DiscretizationCollection, dd, vec) -> float:
# NOTE: Don't move this
from mpi4py import MPI
actx = vec.array_context
return comm.allreduce(nodal_sum_loc(dcoll, dd, vec), op=MPI.SUM)
return comm.allreduce(actx.to_numpy(nodal_sum_loc(dcoll, dd, vec)), op=MPI.SUM)
def nodal_sum_loc(dcoll: DiscretizationCollection, dd, vec) -> float:
......@@ -177,8 +178,9 @@ def nodal_min(dcoll: DiscretizationCollection, dd, vec) -> float:
# NOTE: Don't move this
from mpi4py import MPI
actx = vec.array_context
return comm.allreduce(nodal_min_loc(dcoll, dd, vec), op=MPI.MIN)
return comm.allreduce(actx.to_numpy(nodal_min_loc(dcoll, dd, vec)), op=MPI.MIN)
def nodal_min_loc(dcoll: DiscretizationCollection, dd, vec) -> float:
......@@ -213,8 +215,9 @@ def nodal_max(dcoll: DiscretizationCollection, dd, vec) -> float:
# NOTE: Don't move this
from mpi4py import MPI
actx = vec.array_context
return comm.allreduce(nodal_max_loc(dcoll, dd, vec), op=MPI.MAX)
return comm.allreduce(actx.to_numpy(nodal_max_loc(dcoll, dd, vec)), op=MPI.MAX)
def nodal_max_loc(dcoll: DiscretizationCollection, dd, vec) -> float:
......
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