Skip to content

Commit adecf4f

Browse files
committed
Merge pull request #122 from JuliaParallel/eschnett/test-wait
Make Test / Wait routines more type-stable
2 parents 6b63242 + 10c11cb commit adecf4f

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

src/mpi-base.jl

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ function Waitall!(reqs::Array{Request,1})
320320
reqs[i].val = reqvals[i]
321321
reqs[i].buffer = nothing
322322
stats[i] = Status()
323-
stats[i].val[:] = statvals[:,i]
323+
for v in 1:MPI_STATUS_SIZE
324+
stats[i].val[v] = statvals[v,i]
325+
end
324326
end
325327
stats
326328
end
@@ -341,7 +343,9 @@ function Testall!(reqs::Array{Request,1})
341343
reqs[i].val = reqvals[i]
342344
reqs[i].buffer = nothing
343345
stats[i] = Status()
344-
stats[i].val[:] = statvals[:,i]
346+
for v in 1:MPI_STATUS_SIZE
347+
stats[i].val[v] = statvals[v,i]
348+
end
345349
end
346350
(true, stats)
347351
end
@@ -354,7 +358,7 @@ function Waitany!(reqs::Array{Request,1})
354358
ccall(MPI_WAITANY, Void,
355359
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
356360
&count, reqvals, index, statvals, &0)
357-
index = ind[]
361+
index = Int(ind[])
358362
reqs[index].val = reqvals[index]
359363
reqa[index].buffer = nothing
360364
(index, stat)
@@ -372,7 +376,7 @@ function Testany!(reqs::Array{Request,1})
372376
if flag[] == 0
373377
return (false, 0, nothing)
374378
end
375-
index = ind[]
379+
index = Int(ind[])
376380
reqs[index].val = reqvals[index]
377381
reqs[index].buffer = nothing
378382
(true, index, stat)
@@ -387,20 +391,22 @@ function Waitsome!(reqs::Array{Request,1})
387391
ccall(MPI_WAITSOME, Void,
388392
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
389393
&count, reqvals, outcnt, inds, statvals, &0)
390-
outcount = outcnt[]
394+
outcount = Int(outcnt[])
391395
# This can happen if there were no valid requests
392-
if outcount == MPI_UNDEFINED
396+
if outcount == UNDEFINED
393397
outcount = 0
394398
end
395399
indices = Array(Int, outcount)
396400
stats = Array(Status, outcount)
397401
for i in 1:outcount
398-
ind = inds[i]
402+
ind = Int(inds[i])
399403
reqs[ind].val = reqvals[ind]
400404
reqs[ind].buffer = nothing
401405
indices[i] = inds[i]
402406
stats[i] = Status()
403-
stats[i].val[:] = statvals[:,i]
407+
for v in 1:MPI_STATUS_SIZE
408+
stats[i].val[v] = statvals[v,i]
409+
end
404410
end
405411
(indices, stats)
406412
end
@@ -416,18 +422,20 @@ function Testsome!(reqs::Array{Request,1})
416422
&count, reqvals, outcnt, inds, statvals, &0)
417423
outcount = outcnt[]
418424
# This can happen if there were no valid requests
419-
if outcount == MPI_UNDEFINED
425+
if outcount == UNDEFINED
420426
outcount = 0
421427
end
422428
indices = Array(Int, outcount)
423429
stats = Array(Status, outcount)
424430
for i in 1:outcount
425-
ind = inds[i]
431+
ind = Int(inds[i])
426432
reqs[ind].val = reqvals[ind]
427433
reqs[ind].buffer = nothing
428434
indices[i] = inds[i]
429435
stats[i] = Status()
430-
stats[i].val[:] = statvals[:,i]
436+
for v in 1:MPI_STATUS_SIZE
437+
stats[i].val[v] = statvals[v,i]
438+
end
431439
end
432440
(indices, stats)
433441
end

0 commit comments

Comments
 (0)