@@ -4,7 +4,7 @@ typealias MPIDatatype Union{Char,
4
4
Float32, Float64, Complex64, Complex128}
5
5
6
6
# Define a function mpitype(T) that returns the MPI datatype code
7
- # for a given type T<:MPIDatatype . This works better with precompilation
7
+ # for a given type T. This works better with precompilation
8
8
# than a dictionary (since DataType keys need to be re-hashed at runtime),
9
9
# and also allows the datatype code to be inlined at compile-time.
10
10
@@ -184,27 +184,27 @@ function Iprobe(src::Integer, tag::Integer, comm::Comm)
184
184
true , stat
185
185
end
186
186
187
- function Get_count {T<:MPIDatatype } (stat:: Status , :: Type{T} )
187
+ function Get_count {T} (stat:: Status , :: Type{T} )
188
188
count = Ref {Cint} ()
189
189
ccall (MPI_GET_COUNT, Void, (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
190
190
stat. val, & mpitype (T), count, & 0 )
191
191
Int (count[])
192
192
end
193
193
194
- function Send {T<:MPIDatatype } (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
194
+ function Send {T} (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
195
195
dest:: Integer , tag:: Integer , comm:: Comm )
196
196
ccall (MPI_SEND, Void,
197
197
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint},
198
198
Ptr{Cint}),
199
199
buf, & count, & mpitype (T), & dest, & tag, & comm. val, & 0 )
200
200
end
201
201
202
- function Send {T<:MPIDatatype } (buf:: Array{T} , dest:: Integer , tag:: Integer ,
202
+ function Send {T} (buf:: Array{T} , dest:: Integer , tag:: Integer ,
203
203
comm:: Comm )
204
204
Send (buf, length (buf), dest, tag, comm)
205
205
end
206
206
207
- function Send {T<:MPIDatatype } (obj:: T , dest:: Integer , tag:: Integer , comm:: Comm )
207
+ function Send {T} (obj:: T , dest:: Integer , tag:: Integer , comm:: Comm )
208
208
buf = [obj]
209
209
Send (buf, dest, tag, comm)
210
210
end
@@ -214,7 +214,7 @@ function send(obj, dest::Integer, tag::Integer, comm::Comm)
214
214
Send (buf, dest, tag, comm)
215
215
end
216
216
217
- function Isend {T<:MPIDatatype } (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
217
+ function Isend {T} (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
218
218
dest:: Integer , tag:: Integer , comm:: Comm )
219
219
rval = Ref {Cint} ()
220
220
ccall (MPI_ISEND, Void,
@@ -224,12 +224,12 @@ function Isend{T<:MPIDatatype}(buf::Union{Ptr{T},Array{T}}, count::Integer,
224
224
Request (rval[], buf)
225
225
end
226
226
227
- function Isend {T<:MPIDatatype } (buf:: Array{T} , dest:: Integer , tag:: Integer ,
227
+ function Isend {T} (buf:: Array{T} , dest:: Integer , tag:: Integer ,
228
228
comm:: Comm )
229
229
Isend (buf, length (buf), dest, tag, comm)
230
230
end
231
231
232
- function Isend {T<:MPIDatatype } (obj:: T , dest:: Integer , tag:: Integer , comm:: Comm )
232
+ function Isend {T} (obj:: T , dest:: Integer , tag:: Integer , comm:: Comm )
233
233
buf = [obj]
234
234
Isend (buf, dest, tag, comm)
235
235
end
@@ -239,7 +239,7 @@ function isend(obj, dest::Integer, tag::Integer, comm::Comm)
239
239
Isend (buf, dest, tag, comm)
240
240
end
241
241
242
- function Recv! {T<:MPIDatatype } (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
242
+ function Recv! {T} (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
243
243
src:: Integer , tag:: Integer , comm:: Comm )
244
244
stat = Status ()
245
245
ccall (MPI_RECV, Void,
@@ -249,12 +249,12 @@ function Recv!{T<:MPIDatatype}(buf::Union{Ptr{T},Array{T}}, count::Integer,
249
249
stat
250
250
end
251
251
252
- function Recv! {T<:MPIDatatype } (buf:: Array{T} , src:: Integer , tag:: Integer ,
252
+ function Recv! {T} (buf:: Array{T} , src:: Integer , tag:: Integer ,
253
253
comm:: Comm )
254
254
Recv! (buf, length (buf), src, tag, comm)
255
255
end
256
256
257
- function Recv {T<:MPIDatatype } (:: Type{T} , src:: Integer , tag:: Integer , comm:: Comm )
257
+ function Recv {T} (:: Type{T} , src:: Integer , tag:: Integer , comm:: Comm )
258
258
buf = Ref{T}
259
259
stat = Recv! (buf, src, tag, comm)
260
260
(buf[], stat)
@@ -268,7 +268,7 @@ function recv(src::Integer, tag::Integer, comm::Comm)
268
268
(MPI. deserialize (buf), stat)
269
269
end
270
270
271
- function Irecv! {T<:MPIDatatype } (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
271
+ function Irecv! {T} (buf:: Union{Ptr{T},Array{T}} , count:: Integer ,
272
272
src:: Integer , tag:: Integer , comm:: Comm )
273
273
val = Ref {Cint} ()
274
274
ccall (MPI_IRECV, Void,
@@ -278,7 +278,7 @@ function Irecv!{T<:MPIDatatype}(buf::Union{Ptr{T},Array{T}}, count::Integer,
278
278
Request (val[], buf)
279
279
end
280
280
281
- function Irecv! {T<:MPIDatatype } (buf:: Array{T} , src:: Integer , tag:: Integer ,
281
+ function Irecv! {T} (buf:: Array{T} , src:: Integer , tag:: Integer ,
282
282
comm:: Comm )
283
283
Irecv! (buf, length (buf), src, tag, comm)
284
284
end
@@ -450,20 +450,20 @@ function Barrier(comm::Comm)
450
450
ccall (MPI_BARRIER, Void, (Ptr{Cint},Ptr{Cint}), & comm. val, & 0 )
451
451
end
452
452
453
- function Bcast! {T<:MPIDatatype } (buffer:: Union{Ptr{T},Array{T}} , count:: Integer ,
453
+ function Bcast! {T} (buffer:: Union{Ptr{T},Array{T}} , count:: Integer ,
454
454
root:: Integer , comm:: Comm )
455
455
ccall (MPI_BCAST, Void,
456
456
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
457
457
buffer, & count, & mpitype (T), & root, & comm. val, & 0 )
458
458
buffer
459
459
end
460
460
461
- function Bcast! {T<:MPIDatatype } (buffer:: Array{T} , root:: Integer , comm:: Comm )
461
+ function Bcast! {T} (buffer:: Array{T} , root:: Integer , comm:: Comm )
462
462
Bcast! (buffer, length (buffer), root, comm)
463
463
end
464
464
465
465
#=
466
- function Bcast{T<:MPIDatatype }(obj::T, root::Integer, comm::Comm)
466
+ function Bcast{T}(obj::T, root::Integer, comm::Comm)
467
467
buf = [T]
468
468
Bcast!(buf, root, comm)
469
469
buf[1]
@@ -488,7 +488,7 @@ function bcast(obj, root::Integer, comm::Comm)
488
488
obj
489
489
end
490
490
491
- function Reduce {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
491
+ function Reduce {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
492
492
op:: Op , root:: Integer , comm:: Comm )
493
493
isroot = Comm_rank (comm) == root
494
494
recvbuf = Array (T, isroot ? count : 0 )
@@ -500,19 +500,19 @@ function Reduce{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
500
500
isroot ? recvbuf : nothing
501
501
end
502
502
503
- function Reduce {T<:MPIDatatype } (sendbuf:: Array{T} , op:: Op , root:: Integer ,
503
+ function Reduce {T} (sendbuf:: Array{T} , op:: Op , root:: Integer ,
504
504
comm:: Comm )
505
505
Reduce (sendbuf, length (sendbuf), op, root, comm)
506
506
end
507
507
508
- function Reduce {T<:MPIDatatype } (object:: T , op:: Op , root:: Integer , comm:: Comm )
508
+ function Reduce {T} (object:: T , op:: Op , root:: Integer , comm:: Comm )
509
509
isroot = Comm_rank (comm) == root
510
510
sendbuf = T[object]
511
511
recvbuf = Reduce (sendbuf, op, root, comm)
512
512
isroot ? recvbuf[1 ] : nothing
513
513
end
514
514
515
- function Scatter {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} ,
515
+ function Scatter {T} (sendbuf:: Union{Ptr{T},Array{T}} ,
516
516
count:: Integer , root:: Integer , comm:: Comm )
517
517
recvbuf = Array (T, count)
518
518
ccall (MPI_SCATTER, Void,
@@ -521,7 +521,7 @@ function Scatter{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}},
521
521
recvbuf
522
522
end
523
523
524
- function Scatterv {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} ,
524
+ function Scatterv {T} (sendbuf:: Union{Ptr{T},Array{T}} ,
525
525
counts:: Vector{Cint} , root:: Integer ,
526
526
comm:: Comm )
527
527
recvbuf = Array (T, counts[Comm_rank (comm) + 1 ])
@@ -533,7 +533,7 @@ function Scatterv{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}},
533
533
recvbuf
534
534
end
535
535
536
- function Gather {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
536
+ function Gather {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
537
537
root:: Integer , comm:: Comm )
538
538
isroot = Comm_rank (comm) == root
539
539
recvbuf = Array (T, isroot ? Comm_size (comm) * count : 0 )
@@ -543,19 +543,19 @@ function Gather{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
543
543
isroot ? recvbuf : nothing
544
544
end
545
545
546
- function Gather {T<:MPIDatatype } (sendbuf:: Array{T} , root:: Integer ,
546
+ function Gather {T} (sendbuf:: Array{T} , root:: Integer ,
547
547
comm:: Comm )
548
548
Gather (sendbuf, length (sendbuf), root, comm)
549
549
end
550
550
551
- function Gather {T<:MPIDatatype } (object:: T , root:: Integer , comm:: Comm )
551
+ function Gather {T} (object:: T , root:: Integer , comm:: Comm )
552
552
isroot = Comm_rank (comm) == root
553
553
sendbuf = T[object]
554
554
recvbuf = Gather (sendbuf, root, comm)
555
555
isroot ? recvbuf : nothing
556
556
end
557
557
558
- function Allgather {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
558
+ function Allgather {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
559
559
comm:: Comm )
560
560
recvbuf = Array (T, Comm_size (comm) * count)
561
561
ccall (MPI_ALLGATHER, Void,
@@ -564,17 +564,17 @@ function Allgather{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, count::Integ
564
564
recvbuf
565
565
end
566
566
567
- function Allgather {T<:MPIDatatype } (sendbuf:: Array{T} , comm:: Comm )
567
+ function Allgather {T} (sendbuf:: Array{T} , comm:: Comm )
568
568
Allgather (sendbuf, length (sendbuf), comm)
569
569
end
570
570
571
- function Allgather {T<:MPIDatatype } (object:: T , comm:: Comm )
571
+ function Allgather {T} (object:: T , comm:: Comm )
572
572
sendbuf = T[object]
573
573
recvbuf = Allgather (sendbuf, comm)
574
574
recvbuf
575
575
end
576
576
577
- function Gatherv {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , counts:: Vector{Cint} ,
577
+ function Gatherv {T} (sendbuf:: Union{Ptr{T},Array{T}} , counts:: Vector{Cint} ,
578
578
root:: Integer , comm:: Comm )
579
579
isroot = Comm_rank (comm) == root
580
580
displs = cumsum (counts) - counts
@@ -586,7 +586,7 @@ function Gatherv{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vector
586
586
isroot ? recvbuf : nothing
587
587
end
588
588
589
- function Allgatherv {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , counts:: Vector{Cint} ,
589
+ function Allgatherv {T} (sendbuf:: Union{Ptr{T},Array{T}} , counts:: Vector{Cint} ,
590
590
comm:: Comm )
591
591
displs = cumsum (counts) - counts
592
592
sendcnt = counts[Comm_rank (comm) + 1 ]
@@ -597,7 +597,7 @@ function Allgatherv{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vec
597
597
recvbuf
598
598
end
599
599
600
- function Alltoall {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
600
+ function Alltoall {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
601
601
comm:: Comm )
602
602
recvbuf = Array (T, Comm_size (comm)* count)
603
603
ccall (MPI_ALLTOALL, Void,
@@ -606,7 +606,7 @@ function Alltoall{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, count::Intege
606
606
recvbuf
607
607
end
608
608
609
- function Alltoallv {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , scounts:: Vector{Cint} ,
609
+ function Alltoallv {T} (sendbuf:: Union{Ptr{T},Array{T}} , scounts:: Vector{Cint} ,
610
610
rcounts:: Vector{Cint} , comm:: Comm )
611
611
recvbuf = Array (T, sum (rcounts))
612
612
sdispls = cumsum (scounts) - scounts
@@ -617,7 +617,7 @@ function Alltoallv{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, scounts::Vec
617
617
recvbuf
618
618
end
619
619
620
- function Scan {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
620
+ function Scan {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
621
621
op:: Op , comm:: Comm )
622
622
recvbuf = Array (T, count)
623
623
ccall (MPI_SCAN, Void,
@@ -626,12 +626,12 @@ function Scan{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
626
626
recvbuf
627
627
end
628
628
629
- function Scan {T<:MPIDatatype } (object:: T , op:: Op , comm:: Comm )
629
+ function Scan {T} (object:: T , op:: Op , comm:: Comm )
630
630
sendbuf = T[object]
631
631
Scan (sendbuf,1 ,op,comm)
632
632
end
633
633
634
- function ExScan {T<:MPIDatatype } (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
634
+ function ExScan {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
635
635
op:: Op , comm:: Comm )
636
636
recvbuf = Array (T, count)
637
637
ccall (MPI_EXSCAN, Void,
@@ -640,7 +640,7 @@ function ExScan{T<:MPIDatatype}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
640
640
recvbuf
641
641
end
642
642
643
- function ExScan {T<:MPIDatatype } (object:: T , op:: Op , comm:: Comm )
643
+ function ExScan {T} (object:: T , op:: Op , comm:: Comm )
644
644
sendbuf = T[object]
645
645
ExScan (sendbuf,1 ,op,comm)
646
646
end
0 commit comments