Skip to content

Commit c5c5ffc

Browse files
authored
Merge pull request #265 from JuliaParallel/sb/no-compat
remove Compat
2 parents a4bd17d + ef05443 commit c5c5ffc

18 files changed

+34
-59
lines changed

Project.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ version = "0.9.0"
55

66
[deps]
77
BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
8-
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
98
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
109
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1110
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
11+
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1212
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
13-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1413

1514
[compat]
1615
julia = "1"
16+
17+
[extras]
18+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
19+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
20+
21+
[targets]
22+
test = ["Test", "LinearAlgebra"]

src/MPI.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
VERSION < v"0.7.0-beta2.199" && __precompile__()
2-
31
module MPI
42

5-
using Compat
6-
7-
using Libdl
3+
using Libdl, Serialization
84

9-
@static if Compat.Sys.iswindows()
5+
@static if Sys.iswindows()
106
const depfile = "win_mpiconstants.jl"
117
end
128

13-
@static if Compat.Sys.isunix()
9+
@static if Sys.isunix()
1410
const depfile = joinpath(dirname(@__FILE__), "..", "deps", "src", "compile-time.jl")
1511
isfile(depfile) || error("MPI not properly installed. Please run Pkg.build(\"MPI\")")
1612
end
@@ -48,7 +44,7 @@ function recordDataType(T::DataType, mpiT::Cint; force=false)
4844
end
4945

5046
function __init__()
51-
@static if Compat.Sys.isunix()
47+
@static if Sys.isunix()
5248
# need to open libmpi with RTLD_GLOBAL flag for Linux, before
5349
# any ccall cannot use RTLD_DEEPBIND; this leads to segfaults
5450
# at least on Ubuntu 15.10

src/cman.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import Base: kill
22
export MPIManager, launch, manage, kill, procs, connect, mpiprocs, @mpi_do
33
export TransportMode, MPI_ON_WORKERS, TCP_TRANSPORT_ALL, MPI_TRANSPORT_ALL
4-
using Compat
5-
using Compat.Distributed
6-
import Compat.Sockets: connect, listenany, accept, IPv4, getsockname, getaddrinfo
4+
using Distributed
5+
import Sockets: connect, listenany, accept, IPv4, getsockname, getaddrinfo
76

87

98

@@ -173,7 +172,7 @@ function Distributed.launch(mgr::MPIManager, params::Dict,
173172
config.io = io
174173
# Add config to the correct slot so that MPI ranks and
175174
# Julia pids are in the same order
176-
rank = Compat.Serialization.deserialize(io)
175+
rank = Serialization.deserialize(io)
177176
idx = mgr.mode == MPI_ON_WORKERS ? rank+1 : rank
178177
configs[idx] = config
179178
end
@@ -209,7 +208,7 @@ function setup_worker(host, port, cookie)
209208

210209
# Send our MPI rank to the manager
211210
rank = MPI.Comm_rank(MPI.COMM_WORLD)
212-
Compat.Serialization.serialize(io, rank)
211+
Serialization.serialize(io, rank)
213212

214213
# Hand over control to Base
215214
if cookie == nothing

src/mpi-base.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Compat
2-
31
const MPIDatatype = Union{Char,
42
Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64,
53
UInt64,
@@ -152,13 +150,13 @@ const UNDEFINED = Int(MPI_UNDEFINED)
152150

153151
function serialize(x)
154152
s = IOBuffer()
155-
Compat.Serialization.serialize(s, x)
153+
Serialization.serialize(s, x)
156154
take!(s)
157155
end
158156

159157
function deserialize(x)
160158
s = IOBuffer(x)
161-
Compat.Serialization.deserialize(s)
159+
Serialization.deserialize(s)
162160
end
163161

164162
const REFCOUNT = Threads.Atomic{Int}(1)

src/mpi-op.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
using Compat
1+
import Base.Threads: nthreads, threadid
22

33
# Implement user-defined MPI reduction operations, by passing Julia
44
# functions as callbacks to MPI.
55

6-
# for defining thread-local variables; can use Compat
7-
# once JuliaLang/Compat.jl#223 is resolved.
8-
if isdefined(Base, :Threads)
9-
import Base.Threads: nthreads, threadid
10-
else
11-
nthreads() = 1
12-
threadid() = 1
13-
end
14-
156
# Unfortunately, MPI_Op_create takes a function that does not accept
167
# a void* "thunk" parameter, making it impossible to fully simulate
178
# a closure. So, we have to use a global variable instead. (Since

test/runtests.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
using MPI
22
using Test
33

4-
using Compat
5-
import Compat.String
6-
import Compat.Sys: BINDIR
7-
84
# Code coverage command line options; must correspond to src/julia.h
95
# and src/ui/repl.c
106
const JL_LOG_NONE = 0
@@ -32,20 +28,20 @@ end
3228

3329
function runtests()
3430
nprocs = clamp(Sys.CPU_THREADS, 2, 4)
35-
exename = joinpath(BINDIR, Base.julia_exename())
31+
exename = joinpath(Sys.BINDIR, Base.julia_exename())
3632
testdir = dirname(@__FILE__)
3733
istest(f) = endswith(f, ".jl") && startswith(f, "test_")
3834
testfiles = sort(filter(istest, readdir(testdir)))
3935

4036
extra_args = []
41-
@static if !Compat.Sys.iswindows()
42-
if Compat.occursin( "OpenRTE", Compat.open(f->read(f, String),`mpiexec --version`))
37+
@static if !Sys.iswindows()
38+
if occursin( "OpenRTE", open(f->read(f, String),`mpiexec --version`))
4339
push!(extra_args,"--oversubscribe")
4440
end
4541
end
4642

4743
nfail = 0
48-
Compat.printstyled("Running MPI.jl tests\n"; color=:white)
44+
printstyled("Running MPI.jl tests\n"; color=:white)
4945
for f in testfiles
5046
if f excludedfiles
5147
println("Skipping disabled test $f")

test/test_basic.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using Compat
21
using Test
32
using MPI
43

test/test_cman_julia.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
using Compat
21
using Test
32
using MPI
4-
using Compat.Distributed
3+
using Distributed
54

65
# Start workers via `mpiexec` that communicate among themselves via MPI;
76
# communicate with the workers via TCP
8-
if !Sys.iswindows() && Compat.occursin( "OpenRTE", Compat.open(f->read(f, String),`mpiexec --version`))
7+
if !Sys.iswindows() && occursin( "OpenRTE", open(f->read(f, String),`mpiexec --version`))
98
mgr = MPI.MPIManager(np=4, mpirun_cmd=`mpiexec --oversubscribe -n 4`)
109
else
1110
mgr = MPI.MPIManager(np=4)

test/test_datatype.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using Compat
21
using Test
32
using MPI
43

test/test_onesided.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using Compat
21
using Test
32
using MPI
43

0 commit comments

Comments
 (0)