Skip to content

Commit e83adaa

Browse files
committed
Merge pull request #83 from JuliaParallel/amitm/fix_mpido
@mpi_do prints remote exceptions if present
2 parents cad3301 + 5e677d3 commit e83adaa

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/cman.jl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,21 @@ macro mpi_do(manager, expr)
168168
refs[end] = remotecall(()->eval(Main,$(Expr(:quote,expr))), myid())
169169
end
170170

171-
[wait(r) for r in refs]
171+
# Retrieve remote exceptions if any
172+
@sync begin
173+
for r in refs
174+
@async begin
175+
resp = remotecall_fetch(r.where, r) do rr
176+
wrkr_result = take!(rr)
177+
# Only return result if it is an exception, i.e.,
178+
# Don't return a valid result of worker computation.
179+
# The call is a mpi_do and not mpi_callfetch
180+
return isa(wrkr_result, Exception) ? wrkr_result : nothing
181+
end
182+
isa(resp, Exception) && throw(resp)
183+
end
184+
end
185+
end
172186
nothing
173187
end
174188
end

0 commit comments

Comments
 (0)