Skip to content

Commit eec0516

Browse files
authored
Merge pull request #187 from JuliaParallel/kf/deprecations
Fix various deprecations on julia 0.6
2 parents 224814e + 5aaca6a commit eec0516

18 files changed

+69
-69
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
julia 0.4
22
BinDeps
3-
Compat
3+
Compat 0.9.5

src/cman.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ end
262262
function connect(mgr::MPIManager, pid::Int, config::WorkerConfig)
263263
if mgr.mode != MPI_TRANSPORT_ALL
264264
# Forward the call to the connect function in Base
265-
return invoke(connect, (ClusterManager, Int, WorkerConfig),
265+
return invoke(connect, Tuple{ClusterManager, Int, WorkerConfig},
266266
mgr, pid, config)
267267
end
268268

@@ -295,7 +295,7 @@ function start_send_event_loop(mgr::MPIManager, rank::Int)
295295
while !isready(mgr.initiate_shutdown)
296296
# When data are available, send them
297297
while nb_available(w_s) > 0
298-
data = takebuf_array(w_s.buffer)
298+
data = take!(w_s.buffer)
299299
push!(reqs, MPI.Isend(data, rank, 0, mgr.comm))
300300
end
301301
if !isempty(reqs)
@@ -402,7 +402,7 @@ function receive_event_loop(mgr::MPIManager)
402402
(hasdata, stat) = MPI.Iprobe(MPI.ANY_SOURCE, 0, mgr.comm)
403403
if hasdata
404404
count = Get_count(stat, UInt8)
405-
buf = Array(UInt8, count)
405+
buf = Array{UInt8}(count)
406406
from_rank = Get_source(stat)
407407
MPI.Recv!(buf, from_rank, 0, mgr.comm)
408408

@@ -474,7 +474,7 @@ end
474474
function mpi_do(mgr::MPIManager, expr)
475475
!mgr.initialized && wait(mgr.cond_initialized)
476476
jpids = keys(mgr.j2mpi)
477-
refs = Array(Any, length(jpids))
477+
refs = Array{Any}(length(jpids))
478478
for (i,p) in enumerate(filter(x -> x != myid(), jpids))
479479
refs[i] = remotecall(expr, p)
480480
end

src/mpi-base.jl

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const REQUEST_NULL = Request(MPI_REQUEST_NULL, nothing)
9898

9999
type Status
100100
val::Array{Cint,1}
101-
Status() = new(Array(Cint, MPI_STATUS_SIZE))
101+
Status() = new(Array{Cint}(MPI_STATUS_SIZE))
102102
end
103103
Get_error(stat::Status) = Int(stat.val[MPI_ERROR])
104104
Get_source(stat::Status) = Int(stat.val[MPI_SOURCE])
@@ -112,7 +112,7 @@ const UNDEFINED = Int(MPI_UNDEFINED)
112112
function serialize(x)
113113
s = IOBuffer()
114114
Base.serialize(s, x)
115-
Base.takebuf_array(s)
115+
take!(s)
116116
end
117117

118118
function deserialize(x)
@@ -329,7 +329,7 @@ end
329329
function recv(src::Integer, tag::Integer, comm::Comm)
330330
stat = Probe(src, tag, comm)
331331
count = Get_count(stat, UInt8)
332-
buf = Array(UInt8, count)
332+
buf = Array{UInt8}(count)
333333
stat = Recv!(buf, Get_source(stat), Get_tag(stat), comm)
334334
(MPI.deserialize(buf), stat)
335335
end
@@ -355,7 +355,7 @@ function irecv(src::Integer, tag::Integer, comm::Comm)
355355
return (false, nothing, nothing)
356356
end
357357
count = Get_count(stat, UInt8)
358-
buf = Array(UInt8, count)
358+
buf = Array{UInt8}(count)
359359
stat = Recv!(buf, Get_source(stat), Get_tag(stat), comm)
360360
(true, MPI.deserialize(buf), stat)
361361
end
@@ -383,11 +383,11 @@ end
383383
function Waitall!(reqs::Array{Request,1})
384384
count = length(reqs)
385385
reqvals = [reqs[i].val for i in 1:count]
386-
statvals = Array(Cint, MPI_STATUS_SIZE, count)
386+
statvals = Array{Cint}(MPI_STATUS_SIZE, count)
387387
ccall(MPI_WAITALL, Void,
388388
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
389389
&count, reqvals, statvals, &0)
390-
stats = Array(Status, count)
390+
stats = Array{Status}(count)
391391
for i in 1:count
392392
reqs[i].val = reqvals[i]
393393
reqs[i].buffer = nothing
@@ -403,14 +403,14 @@ function Testall!(reqs::Array{Request,1})
403403
count = length(reqs)
404404
reqvals = [reqs[i].val for i in 1:count]
405405
flag = Ref{Cint}()
406-
statvals = Array(Cint, MPI_STATUS_SIZE, count)
406+
statvals = Array{Cint}(MPI_STATUS_SIZE, count)
407407
ccall(MPI_TESTALL, Void,
408408
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
409409
&count, reqvals, flag, statvals, &0)
410410
if flag[] == 0
411411
return (false, nothing)
412412
end
413-
stats = Array(Status, count)
413+
stats = Array{Status}(count)
414414
for i in 1:count
415415
reqs[i].val = reqvals[i]
416416
reqs[i].buffer = nothing
@@ -458,8 +458,8 @@ function Waitsome!(reqs::Array{Request,1})
458458
count = length(reqs)
459459
reqvals = [reqs[i].val for i in 1:count]
460460
outcnt = Ref{Cint}()
461-
inds = Array(Cint, count)
462-
statvals = Array(Cint, MPI_STATUS_SIZE, count)
461+
inds = Array{Cint}(count)
462+
statvals = Array{Cint}(MPI_STATUS_SIZE, count)
463463
ccall(MPI_WAITSOME, Void,
464464
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
465465
&count, reqvals, outcnt, inds, statvals, &0)
@@ -468,8 +468,8 @@ function Waitsome!(reqs::Array{Request,1})
468468
if outcount == UNDEFINED
469469
outcount = 0
470470
end
471-
indices = Array(Int, outcount)
472-
stats = Array(Status, outcount)
471+
indices = Array{Int}(outcount)
472+
stats = Array{Status}(outcount)
473473
for i in 1:outcount
474474
ind = Int(inds[i])
475475
reqs[ind].val = reqvals[ind]
@@ -487,8 +487,8 @@ function Testsome!(reqs::Array{Request,1})
487487
count = length(reqs)
488488
reqvals = [reqs[i].val for i in 1:count]
489489
outcnt = Ref{Cint}()
490-
inds = Array(Cint, count)
491-
statvals = Array(Cint, MPI_STATUS_SIZE, count)
490+
inds = Array{Cint}(count)
491+
statvals = Array{Cint}(MPI_STATUS_SIZE, count)
492492
ccall(MPI_TESTSOME, Void,
493493
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
494494
&count, reqvals, outcnt, inds, statvals, &0)
@@ -497,8 +497,8 @@ function Testsome!(reqs::Array{Request,1})
497497
if outcount == UNDEFINED
498498
outcount = 0
499499
end
500-
indices = Array(Int, outcount)
501-
stats = Array(Status, outcount)
500+
indices = Array{Int}(outcount)
501+
stats = Array{Status}(outcount)
502502
for i in 1:outcount
503503
ind = Int(inds[i])
504504
reqs[ind].val = reqvals[ind]
@@ -546,14 +546,14 @@ end
546546

547547
function bcast(obj, root::Integer, comm::Comm)
548548
isroot = Comm_rank(comm) == root
549-
count = Array(Cint, 1)
549+
count = Array{Cint}(1)
550550
if isroot
551551
buf = MPI.serialize(obj)
552552
count[1] = length(buf)
553553
end
554554
Bcast!(count, root, comm)
555555
if !isroot
556-
buf = Array(UInt8, count[1])
556+
buf = Array{UInt8}(count[1])
557557
end
558558
Bcast!(buf, root, comm)
559559
if !isroot
@@ -565,7 +565,7 @@ end
565565
function Reduce{T}(sendbuf::MPIBuffertype{T}, count::Integer,
566566
op::Op, root::Integer, comm::Comm)
567567
isroot = Comm_rank(comm) == root
568-
recvbuf = Array(T, isroot ? count : 0)
568+
recvbuf = Array{T}(isroot ? count : 0)
569569
ccall(MPI_REDUCE, Void,
570570
(Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint},
571571
Ptr{Cint}, Ptr{Cint}),
@@ -618,7 +618,7 @@ include("mpi-op.jl")
618618

619619
function Scatter{T}(sendbuf::MPIBuffertype{T},count::Integer, root::Integer,
620620
comm::Comm)
621-
recvbuf = Array(T, count)
621+
recvbuf = Array{T}(count)
622622
ccall(MPI_SCATTER, Void,
623623
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint},
624624
Ptr{Cint}, Ptr{Cint}, Ptr{Cint}), sendbuf, &count, &mpitype(T),
@@ -629,7 +629,7 @@ end
629629
function Scatterv{T}(sendbuf::MPIBuffertype{T},
630630
counts::Vector{Cint}, root::Integer,
631631
comm::Comm)
632-
recvbuf = Array(T, counts[Comm_rank(comm) + 1])
632+
recvbuf = Array{T}(counts[Comm_rank(comm) + 1])
633633
recvcnt = counts[Comm_rank(comm) + 1]
634634
disps = cumsum(counts) - counts
635635
ccall(MPI_SCATTERV, Void,
@@ -641,7 +641,7 @@ end
641641
function Gather{T}(sendbuf::MPIBuffertype{T}, count::Integer,
642642
root::Integer, comm::Comm)
643643
isroot = Comm_rank(comm) == root
644-
recvbuf = Array(T, isroot ? Comm_size(comm) * count : 0)
644+
recvbuf = Array{T}(isroot ? Comm_size(comm) * count : 0)
645645
ccall(MPI_GATHER, Void,
646646
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
647647
sendbuf, &count, &mpitype(T), recvbuf, &count, &mpitype(T), &root, &comm.val, &0)
@@ -661,7 +661,7 @@ end
661661

662662
function Allgather{T}(sendbuf::MPIBuffertype{T}, count::Integer,
663663
comm::Comm)
664-
recvbuf = Array(T, Comm_size(comm) * count)
664+
recvbuf = Array{T}(Comm_size(comm) * count)
665665
ccall(MPI_ALLGATHER, Void,
666666
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
667667
sendbuf, &count, &mpitype(T), recvbuf, &count, &mpitype(T), &comm.val, &0)
@@ -683,7 +683,7 @@ function Gatherv{T}(sendbuf::MPIBuffertype{T}, counts::Vector{Cint},
683683
isroot = Comm_rank(comm) == root
684684
displs = cumsum(counts) - counts
685685
sendcnt = counts[Comm_rank(comm) + 1]
686-
recvbuf = Array(T, isroot ? sum(counts) : 0)
686+
recvbuf = Array{T}(isroot ? sum(counts) : 0)
687687
ccall(MPI_GATHERV, Void,
688688
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
689689
sendbuf, &sendcnt, &mpitype(T), recvbuf, counts, displs, &mpitype(T), &root, &comm.val, &0)
@@ -694,7 +694,7 @@ function Allgatherv{T}(sendbuf::MPIBuffertype{T}, counts::Vector{Cint},
694694
comm::Comm)
695695
displs = cumsum(counts) - counts
696696
sendcnt = counts[Comm_rank(comm) + 1]
697-
recvbuf = Array(T, sum(counts))
697+
recvbuf = Array{T}(sum(counts))
698698
ccall(MPI_ALLGATHERV, Void,
699699
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
700700
sendbuf, &sendcnt, &mpitype(T), recvbuf, counts, displs, &mpitype(T), &comm.val, &0)
@@ -703,7 +703,7 @@ end
703703

704704
function Alltoall{T}(sendbuf::MPIBuffertype{T}, count::Integer,
705705
comm::Comm)
706-
recvbuf = Array(T, Comm_size(comm)*count)
706+
recvbuf = Array{T}(Comm_size(comm)*count)
707707
ccall(MPI_ALLTOALL, Void,
708708
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
709709
sendbuf, &count, &mpitype(T), recvbuf, &count, &mpitype(T), &comm.val, &0)
@@ -712,7 +712,7 @@ end
712712

713713
function Alltoallv{T}(sendbuf::MPIBuffertype{T}, scounts::Vector{Cint},
714714
rcounts::Vector{Cint}, comm::Comm)
715-
recvbuf = Array(T, sum(rcounts))
715+
recvbuf = Array{T}(sum(rcounts))
716716
sdispls = cumsum(scounts) - scounts
717717
rdispls = cumsum(rcounts) - rcounts
718718
ccall(MPI_ALLTOALLV, Void,
@@ -723,7 +723,7 @@ end
723723

724724
function Scan{T}(sendbuf::MPIBuffertype{T}, count::Integer,
725725
op::Op, comm::Comm)
726-
recvbuf = Array(T, count)
726+
recvbuf = Array{T}(count)
727727
ccall(MPI_SCAN, Void,
728728
(Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
729729
sendbuf, recvbuf, &count, &mpitype(T), &op.val, &comm.val, &0)
@@ -737,7 +737,7 @@ end
737737

738738
function Exscan{T}(sendbuf::MPIBuffertype{T}, count::Integer,
739739
op::Op, comm::Comm)
740-
recvbuf = Array(T, count)
740+
recvbuf = Array{T}(count)
741741
ccall(MPI_EXSCAN, Void,
742742
(Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
743743
sendbuf, recvbuf, &count, &mpitype(T), &op.val, &comm.val, &0)

src/mpi-op.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ end
1616
# the reduction functions are barriers, being re-entrant is probably
1717
# not important in practice, fortunately.) For MPI_THREAD_MULTIPLE
1818
# using Julia native threading, however, we do make this global thread-local
19-
const _user_functions = Array(Function, 1) # resized to nthreads() at runtime
19+
const _user_functions = Array{Function}(1) # resized to nthreads() at runtime
2020
const _user_op = Op(MPI_OP_NULL) # _mpi_user_function operation, initialized below
2121

2222
# C callback function corresponding to MPI_User_function

test/test_allgather.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end
1010

1111
comm = MPI.COMM_WORLD
1212

13-
for typ in MPI.MPIDatatype.types
13+
for typ in (isdefined(:UnionAll) ? Base.uniontypes(MPI.MPIDatatype) : MPI.MPIDatatype.types)
1414
A = typ[MPI.Comm_rank(comm) + 1]
1515
C = allgather(A)
1616
@test typeof(C) === Vector{typ}

test/test_allgatherv.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rank = MPI.Comm_rank(comm)
1515
# Defining this to make ones work for Char
1616
Base.one(::Type{Char}) = '\01'
1717

18-
for typ in MPI.MPIDatatype.types
18+
for typ in (isdefined(:UnionAll) ? Base.uniontypes(MPI.MPIDatatype) : MPI.MPIDatatype.types)
1919

2020
A = ones(typ, mod(rank,2) + 1)
2121
counts = Cint[mod(i,2) + 1 for i in 0:(size-1)]

test/test_alltoallv.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ comm = MPI.COMM_WORLD
1212
size = MPI.Comm_size(comm)
1313
rank = MPI.Comm_rank(comm)
1414

15-
for typ in MPI.MPIDatatype.types
15+
for typ in (isdefined(:UnionAll) ? Base.uniontypes(MPI.MPIDatatype) : MPI.MPIDatatype.types)
1616
A = typ[]
1717
B = typ[]
1818
for i in 1:size

test/test_bcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ root = 0
2121
srand(17)
2222

2323
matsize = (17,17)
24-
for typ in MPI.MPIDatatype.types
24+
for typ in (isdefined(:UnionAll) ? Base.uniontypes(MPI.MPIDatatype) : MPI.MPIDatatype.types)
2525
A = rand(typ, matsize...)
2626
@test bcast_array(A, root) == A
2727
end

test/test_datatype.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ end
3232

3333
MPI.mpitype(Boundary)
3434

35-
arr = Array(Boundary, 3)
35+
arr = Array{Boundary}(3)
3636
for i=1:3
3737
arr[i] = Boundary( (comm_rank + i) % 127, i + comm_rank, i % 64)
3838
end
3939

4040
req_send = MPI.Isend(arr, dest - 1, 1, MPI.COMM_WORLD)
4141

4242
# receive the message
43-
arr_recv = Array(Boundary, 3)
43+
arr_recv = Array{Boundary}(3)
4444
req_recv = MPI.Irecv!(arr_recv, src - 1, 1, MPI.COMM_WORLD)
4545

4646
MPI.Wait!(req_send)
@@ -63,8 +63,8 @@ end
6363

6464
MPI.mpitype(Boundary2)
6565

66-
arr = Array(Boundary2, 3)
67-
arr_recv = Array(Boundary2, 3)
66+
arr = Array{Boundary2}(3)
67+
arr_recv = Array{Boundary2}(3)
6868

6969
for i=1:3
7070
arr[i] = Boundary2( (comm_rank + i) % 127, ( Int(i + comm_rank), UInt8(i % 64) ) )

test/test_exscan.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ size = MPI.Comm_size(comm)
99
rank = MPI.Comm_rank(comm)
1010

1111
# Not possible to PROD a Char (and neither Int8 with OpenMPI)
12-
typs = setdiff([MPI.MPIDatatype.types...], [Char, Int8, UInt8])
12+
typs = setdiff([(isdefined(:UnionAll) ? Base.uniontypes(MPI.MPIDatatype) : MPI.MPIDatatype.types)...], [Char, Int8, UInt8])
1313
for typ in typs
1414
val = convert(typ,rank+1)
1515
B = MPI.Exscan(val, MPI.PROD, comm)

0 commit comments

Comments
 (0)