Skip to content

Commit

Permalink
Reindent, removing all tab characters
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Apr 12, 2016
1 parent 1f7dacf commit 1b8bbd8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
12 changes: 6 additions & 6 deletions src/MPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module MPI
using Compat

@windows_only begin
const depfile = "win_mpiconstants.jl"
const depfile = "win_mpiconstants.jl"
end

@unix_only begin
const depfile = joinpath(dirname(@__FILE__), "..", "deps", "src", "compile-time.jl")
isfile(depfile) || error("MPI not properly installed. Please run Pkg.build(\"MPI\")")
const depfile = joinpath(dirname(@__FILE__), "..", "deps", "src", "compile-time.jl")
isfile(depfile) || error("MPI not properly installed. Please run Pkg.build(\"MPI\")")
end

include(depfile)
Expand All @@ -20,8 +20,9 @@ include("cman.jl")

function __init__()
@unix_only begin
# need to open libmpi with RTLD_GLOBAL flag for Linux, before any ccall
# cannot use RTLD_DEEPBIND; this leads to segfaults at least on Ubuntu 15.10
# need to open libmpi with RTLD_GLOBAL flag for Linux, before
# any ccall cannot use RTLD_DEEPBIND; this leads to segfaults
# at least on Ubuntu 15.10
@eval const libmpi_handle =
Libdl.dlopen(libmpi, Libdl.RTLD_LAZY | Libdl.RTLD_GLOBAL)

Expand Down Expand Up @@ -57,7 +58,6 @@ function __init__()
Float64 => MPI_REAL8,
Complex64 => MPI_COMPLEX8,
Complex128 => MPI_COMPLEX16)

end

end
44 changes: 19 additions & 25 deletions src/mpi-base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ typealias MPIDatatype Union{Char,
UInt64,
Float32, Float64, Complex64, Complex128}

# Define a function mpitype(T) that returns the MPI datatype code
# for a given type T. The dictonary is defined in __init__ so
# the module can be precompiled
# Define a function mpitype(T) that returns the MPI datatype code for
# a given type T. The dictonary is defined in __init__ so the module
# can be precompiled

# accessor function for getting MPI datatypes
# use a function in case more behavior is needed later
function mpitype{T}(::Type{T})
return mpitype_dict[T]
end
mpitype{T}(::Type{T}) = mpitype_dict[T]

type Comm
val::Cint
Expand Down Expand Up @@ -170,7 +167,6 @@ function type_create(T::DataType)
return nothing
end


# Point-to-point communication

function Probe(src::Integer, tag::Integer, comm::Comm)
Expand Down Expand Up @@ -468,7 +464,7 @@ function Barrier(comm::Comm)
end

function Bcast!{T}(buffer::Union{Ptr{T},Array{T}}, count::Integer,
root::Integer, comm::Comm)
root::Integer, comm::Comm)
ccall(MPI_BCAST, Void,
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
buffer, &count, &mpitype(T), &root, &comm.val, &0)
Expand Down Expand Up @@ -506,7 +502,7 @@ function bcast(obj, root::Integer, comm::Comm)
end

function Reduce{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
op::Op, root::Integer, comm::Comm)
op::Op, root::Integer, comm::Comm)
isroot = Comm_rank(comm) == root
recvbuf = Array(T, isroot ? count : 0)
ccall(MPI_REDUCE, Void,
Expand All @@ -517,8 +513,7 @@ function Reduce{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
isroot ? recvbuf : nothing
end

function Reduce{T}(sendbuf::Array{T}, op::Op, root::Integer,
comm::Comm)
function Reduce{T}(sendbuf::Array{T}, op::Op, root::Integer, comm::Comm)
Reduce(sendbuf, length(sendbuf), op, root, comm)
end

Expand All @@ -530,7 +525,7 @@ function Reduce{T}(object::T, op::Op, root::Integer, comm::Comm)
end

function Scatter{T}(sendbuf::Union{Ptr{T},Array{T}},
count::Integer, root::Integer, comm::Comm)
count::Integer, root::Integer, comm::Comm)
recvbuf = Array(T, count)
ccall(MPI_SCATTER, Void,
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
Expand All @@ -539,8 +534,8 @@ function Scatter{T}(sendbuf::Union{Ptr{T},Array{T}},
end

function Scatterv{T}(sendbuf::Union{Ptr{T},Array{T}},
counts::Vector{Cint}, root::Integer,
comm::Comm)
counts::Vector{Cint}, root::Integer,
comm::Comm)
recvbuf = Array(T, counts[Comm_rank(comm) + 1])
recvcnt = counts[Comm_rank(comm) + 1]
disps = cumsum(counts) - counts
Expand All @@ -551,7 +546,7 @@ function Scatterv{T}(sendbuf::Union{Ptr{T},Array{T}},
end

function Gather{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
root::Integer, comm::Comm)
root::Integer, comm::Comm)
isroot = Comm_rank(comm) == root
recvbuf = Array(T, isroot ? Comm_size(comm) * count : 0)
ccall(MPI_GATHER, Void,
Expand All @@ -560,8 +555,7 @@ function Gather{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
isroot ? recvbuf : nothing
end

function Gather{T}(sendbuf::Array{T}, root::Integer,
comm::Comm)
function Gather{T}(sendbuf::Array{T}, root::Integer, comm::Comm)
Gather(sendbuf, length(sendbuf), root, comm)
end

Expand All @@ -573,7 +567,7 @@ function Gather{T}(object::T, root::Integer, comm::Comm)
end

function Allgather{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
comm::Comm)
comm::Comm)
recvbuf = Array(T, Comm_size(comm) * count)
ccall(MPI_ALLGATHER, Void,
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
Expand All @@ -592,7 +586,7 @@ function Allgather{T}(object::T, comm::Comm)
end

function Gatherv{T}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vector{Cint},
root::Integer, comm::Comm)
root::Integer, comm::Comm)
isroot = Comm_rank(comm) == root
displs = cumsum(counts) - counts
sendcnt = counts[Comm_rank(comm) + 1]
Expand All @@ -604,7 +598,7 @@ function Gatherv{T}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vector{Cint},
end

function Allgatherv{T}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vector{Cint},
comm::Comm)
comm::Comm)
displs = cumsum(counts) - counts
sendcnt = counts[Comm_rank(comm) + 1]
recvbuf = Array(T, sum(counts))
Expand All @@ -615,7 +609,7 @@ function Allgatherv{T}(sendbuf::Union{Ptr{T},Array{T}}, counts::Vector{Cint},
end

function Alltoall{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
comm::Comm)
comm::Comm)
recvbuf = Array(T, Comm_size(comm)*count)
ccall(MPI_ALLTOALL, Void,
(Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
Expand All @@ -624,7 +618,7 @@ function Alltoall{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
end

function Alltoallv{T}(sendbuf::Union{Ptr{T},Array{T}}, scounts::Vector{Cint},
rcounts::Vector{Cint}, comm::Comm)
rcounts::Vector{Cint}, comm::Comm)
recvbuf = Array(T, sum(rcounts))
sdispls = cumsum(scounts) - scounts
rdispls = cumsum(rcounts) - rcounts
Expand All @@ -635,7 +629,7 @@ function Alltoallv{T}(sendbuf::Union{Ptr{T},Array{T}}, scounts::Vector{Cint},
end

function Scan{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
op::Op, comm::Comm)
op::Op, comm::Comm)
recvbuf = Array(T, count)
ccall(MPI_SCAN, Void,
(Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
Expand All @@ -649,7 +643,7 @@ function Scan{T}(object::T, op::Op, comm::Comm)
end

function ExScan{T}(sendbuf::Union{Ptr{T},Array{T}}, count::Integer,
op::Op, comm::Comm)
op::Op, comm::Comm)
recvbuf = Array(T, count)
ccall(MPI_EXSCAN, Void,
(Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
Expand Down

0 comments on commit 1b8bbd8

Please sign in to comment.