@@ -3,15 +3,12 @@ typealias MPIDatatype Union{Char,
33 UInt64,
44 Float32, Float64, Complex64, Complex128}
55
6- # Define a function mpitype(T) that returns the MPI datatype code
7- # for a given type T. The dictonary is defined in __init__ so
8- # the module can be precompiled
6+ # Define a function mpitype(T) that returns the MPI datatype code for
7+ # a given type T. The dictonary is defined in __init__ so the module
8+ # can be precompiled
99
1010# accessor function for getting MPI datatypes
11- # use a function in case more behavior is needed later
12- function mpitype {T} (:: Type{T} )
13- return mpitype_dict[T]
14- end
11+ mpitype {T} (:: Type{T} ) = mpitype_dict[T]
1512
1613type Comm
1714 val:: Cint
@@ -170,7 +167,6 @@ function type_create(T::DataType)
170167 return nothing
171168end
172169
173-
174170# Point-to-point communication
175171
176172function Probe (src:: Integer , tag:: Integer , comm:: Comm )
@@ -468,7 +464,7 @@ function Barrier(comm::Comm)
468464end
469465
470466function Bcast! {T} (buffer:: Union{Ptr{T},Array{T}} , count:: Integer ,
471- root:: Integer , comm:: Comm )
467+ root:: Integer , comm:: Comm )
472468 ccall (MPI_BCAST, Void,
473469 (Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
474470 buffer, & count, & mpitype (T), & root, & comm. val, & 0 )
@@ -506,7 +502,7 @@ function bcast(obj, root::Integer, comm::Comm)
506502end
507503
508504function Reduce {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
509- op:: Op , root:: Integer , comm:: Comm )
505+ op:: Op , root:: Integer , comm:: Comm )
510506 isroot = Comm_rank (comm) == root
511507 recvbuf = Array (T, isroot ? count : 0 )
512508 ccall (MPI_REDUCE, Void,
@@ -517,8 +513,7 @@ function Reduce{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
517513 isroot ? recvbuf : nothing
518514end
519515
520- function Reduce {T} (sendbuf:: Array{T} , op:: Op , root:: Integer ,
521- comm:: Comm )
516+ function Reduce {T} (sendbuf:: Array{T} , op:: Op , root:: Integer , comm:: Comm )
522517 Reduce (sendbuf, length (sendbuf), op, root, comm)
523518end
524519
@@ -530,7 +525,7 @@ function Reduce{T}(object::T, op::Op, root::Integer, comm::Comm)
530525end
531526
532527function Scatter {T} (sendbuf:: Union{Ptr{T},Array{T}} ,
533- count:: Integer , root:: Integer , comm:: Comm )
528+ count:: Integer , root:: Integer , comm:: Comm )
534529 recvbuf = Array (T, count)
535530 ccall (MPI_SCATTER, Void,
536531 (Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
@@ -539,8 +534,8 @@ function Scatter{T}(sendbuf::Union{Ptr{T},Array{T}},
539534end
540535
541536function Scatterv {T} (sendbuf:: Union{Ptr{T},Array{T}} ,
542- counts:: Vector{Cint} , root:: Integer ,
543- comm:: Comm )
537+ counts:: Vector{Cint} , root:: Integer ,
538+ comm:: Comm )
544539 recvbuf = Array (T, counts[Comm_rank (comm) + 1 ])
545540 recvcnt = counts[Comm_rank (comm) + 1 ]
546541 disps = cumsum (counts) - counts
@@ -551,7 +546,7 @@ function Scatterv{T}(sendbuf::Union{Ptr{T},Array{T}},
551546end
552547
553548function Gather {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
554- root:: Integer , comm:: Comm )
549+ root:: Integer , comm:: Comm )
555550 isroot = Comm_rank (comm) == root
556551 recvbuf = Array (T, isroot ? Comm_size (comm) * count : 0 )
557552 ccall (MPI_GATHER, Void,
@@ -560,8 +555,7 @@ function Gather{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
560555 isroot ? recvbuf : nothing
561556end
562557
563- function Gather {T} (sendbuf:: Array{T} , root:: Integer ,
564- comm:: Comm )
558+ function Gather {T} (sendbuf:: Array{T} , root:: Integer , comm:: Comm )
565559 Gather (sendbuf, length (sendbuf), root, comm)
566560end
567561
@@ -573,7 +567,7 @@ function Gather{T}(object::T, root::Integer, comm::Comm)
573567end
574568
575569function Allgather {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
576- comm:: Comm )
570+ comm:: Comm )
577571 recvbuf = Array (T, Comm_size (comm) * count)
578572 ccall (MPI_ALLGATHER, Void,
579573 (Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
@@ -592,7 +586,7 @@ function Allgather{T}(object::T, comm::Comm)
592586end
593587
594588function Gatherv {T} (sendbuf:: Union{Ptr{T},Array{T}} , counts:: Vector{Cint} ,
595- root:: Integer , comm:: Comm )
589+ root:: Integer , comm:: Comm )
596590 isroot = Comm_rank (comm) == root
597591 displs = cumsum (counts) - counts
598592 sendcnt = counts[Comm_rank (comm) + 1 ]
@@ -604,7 +598,7 @@ function Gatherv{T}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vector{Cint},
604598end
605599
606600function Allgatherv {T} (sendbuf:: Union{Ptr{T},Array{T}} , counts:: Vector{Cint} ,
607- comm:: Comm )
601+ comm:: Comm )
608602 displs = cumsum (counts) - counts
609603 sendcnt = counts[Comm_rank (comm) + 1 ]
610604 recvbuf = Array (T, sum (counts))
@@ -615,7 +609,7 @@ function Allgatherv{T}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vector{Cint},
615609end
616610
617611function Alltoall {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
618- comm:: Comm )
612+ comm:: Comm )
619613 recvbuf = Array (T, Comm_size (comm)* count)
620614 ccall (MPI_ALLTOALL, Void,
621615 (Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
@@ -624,7 +618,7 @@ function Alltoall{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
624618end
625619
626620function Alltoallv {T} (sendbuf:: Union{Ptr{T},Array{T}} , scounts:: Vector{Cint} ,
627- rcounts:: Vector{Cint} , comm:: Comm )
621+ rcounts:: Vector{Cint} , comm:: Comm )
628622 recvbuf = Array (T, sum (rcounts))
629623 sdispls = cumsum (scounts) - scounts
630624 rdispls = cumsum (rcounts) - rcounts
@@ -635,7 +629,7 @@ function Alltoallv{T}(sendbuf::Union{Ptr{T},Array{T}}, scounts::Vector{Cint},
635629end
636630
637631function Scan {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
638- op:: Op , comm:: Comm )
632+ op:: Op , comm:: Comm )
639633 recvbuf = Array (T, count)
640634 ccall (MPI_SCAN, Void,
641635 (Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
@@ -649,7 +643,7 @@ function Scan{T}(object::T, op::Op, comm::Comm)
649643end
650644
651645function ExScan {T} (sendbuf:: Union{Ptr{T},Array{T}} , count:: Integer ,
652- op:: Op , comm:: Comm )
646+ op:: Op , comm:: Comm )
653647 recvbuf = Array (T, count)
654648 ccall (MPI_EXSCAN, Void,
655649 (Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
0 commit comments