Skip to content

Commit 8ac9a3d

Browse files
authored
Merge pull request #205 from barche/win-constants
Add omitted windows MPI constants
2 parents c7f6287 + 538468c commit 8ac9a3d

File tree

6 files changed

+105
-59
lines changed

6 files changed

+105
-59
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ env:
1515
before_install:
1616
- sh ./conf/travis-install-mpi.sh $MPI_IMPL
1717
- export PATH=$HOME/OpenMPI/bin:$HOME/MPICH/bin:$PATH
18+
- export CC=mpicc
19+
- export FC=mpif90
1820
# Work around OpenMPI attempting to create overly long temporary
1921
# file names - and erroring as a result
2022
- export TMPDIR=/tmp

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ install:
2323
$env:JULIA_URL,
2424
"C:\projects\julia-binary.exe")
2525
- ps: (new-object net.webclient).DownloadFile(
26-
"https://download.microsoft.com/download/D/7/B/D7BBA00F-71B7-436B-80BC-4D22F2EE9862/MSMpiSetup.exe",
26+
"https://download.microsoft.com/download/2/E/C/2EC96D7F-687B-4613-80F6-E10F670A2D97/msmpisetup.exe",
2727
"C:\projects\MSMpiSetup.exe")
2828
# Run installer silently, output to C:\projects\julia
2929
- C:\projects\julia-binary.exe /S /D=C:\projects\julia

src/mpi-base.jl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ function Win_sync(win::Win)
878878
end
879879

880880
function Win_sync(win::CWin)
881-
ccall(:MPI_Win_sync, Void, (CWin,), win)
881+
ccall((:MPI_Win_sync, libmpi), Void, (CWin,), win)
882882
end
883883

884884
function Win_lock(lock_type::LockType, rank::Integer, assert::Integer, win::Win)
@@ -924,15 +924,14 @@ function Fetch_and_op(sourceval::MPIBuffertype{T}, returnval::MPIBuffertype{T},
924924
end
925925

926926
function Fetch_and_op(sourceval::MPIBuffertype{T}, returnval::MPIBuffertype{T}, target_rank::Integer, target_disp::Integer, op::Op, win::CWin) where T
927-
ccall(:MPI_Fetch_and_op, Void,
927+
ccall((:MPI_Fetch_and_op, libmpi), Void,
928928
(Ptr{T}, Ptr{T}, Cint, Cint, Cptrdiff_t, Cint, CWin),
929929
sourceval, returnval, mpitype(T), target_rank, target_disp, op.val, win)
930930
end
931931

932932
function Get_address(location::MPIBuffertype{T}) where T
933933
addr = Ref{Cptrdiff_t}(0)
934934
ccall(MPI_GET_ADDRESS, Void, (Ptr{T}, Ref{Cptrdiff_t}, Ref{Cint}), location, addr, 0)
935-
#ccall(:MPI_Get_address, Int, (Ptr{Void}, Ref{Cptrdiff_t}), location, addr)
936935
return addr[]
937936
end
938937

@@ -944,7 +943,7 @@ end
944943

945944
function Comm_spawn(command::String, argv::Vector{String}, nprocs::Integer, comm::Comm, errors = Vector{Cint}(nprocs))
946945
c_intercomm = Ref{CComm}()
947-
ccall(:MPI_Comm_spawn, Void,
946+
ccall((:MPI_Comm_spawn, libmpi), Void,
948947
(Cstring, Ptr{Ptr{Cchar}}, Cint, CInfo, Cint, CComm, Ref{CComm}, Ptr{Cint}),
949948
command, argv, nprocs, CInfo(INFO_NULL), 0, CComm(comm), c_intercomm, errors)
950949
return Comm(c_intercomm[])
@@ -960,18 +959,18 @@ end
960959
if HAVE_MPI_COMM_C2F
961960
# use MPI_Comm_f2c and MPI_Comm_c2f
962961
Base.convert(::Type{CComm}, comm::Comm) =
963-
ccall(:MPI_Comm_f2c, CComm, (Cint,), comm.val)
962+
ccall((:MPI_Comm_f2c, libmpi), CComm, (Cint,), comm.val)
964963
Base.convert(::Type{Comm}, ccomm::CComm) =
965-
Comm(ccall(:MPI_Comm_c2f, Cint, (CComm,), ccomm))
964+
Comm(ccall((:MPI_Comm_c2f, libmpi), Cint, (CComm,), ccomm))
966965
# Assume info is treated the same way
967966
Base.convert(::Type{CInfo}, info::Info) =
968-
ccall(:MPI_Info_f2c, CInfo, (Cint,), info.val)
967+
ccall((:MPI_Info_f2c, libmpi), CInfo, (Cint,), info.val)
969968
Base.convert(::Type{Info}, cinfo::CInfo) =
970-
Info(ccall(:MPI_Info_c2f, Cint, (CInfo,), cinfo))
969+
Info(ccall((:MPI_Info_c2f, libmpi), Cint, (CInfo,), cinfo))
971970
Base.convert(::Type{CWin}, win::Win) =
972-
ccall(:MPI_Win_f2c, CWin, (Cint,), win.val)
971+
ccall((:MPI_Win_f2c, libmpi), CWin, (Cint,), win.val)
973972
Base.convert(::Type{Win}, cwin::CWin) =
974-
Win(ccall(:MPI_Win_c2f, Cint, (CWin,), cwin))
973+
Win(ccall((:MPI_Win_c2f, libmpi), Cint, (CWin,), cwin))
975974
elseif sizeof(CComm) == sizeof(Cint)
976975
# in MPICH, both C and Fortran use identical Cint comm handles
977976
# and MPI_Comm_c2f is not provided.

src/win_mpiconstants.jl

Lines changed: 76 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ const MPI_BAND = Int32(1476395014)
2828
const MPI_BOR = Int32(1476395016)
2929
const MPI_BXOR = Int32(1476395018)
3030
const MPI_LAND = Int32(1476395013)
31+
const MPI_LOCK_EXCLUSIVE = Int32(234)
32+
const MPI_LOCK_SHARED = Int32(235)
3133
const MPI_LOR = Int32(1476395015)
3234
const MPI_LXOR = Int32(1476395017)
3335
const MPI_MAX = Int32(1476395009)
3436
const MPI_MAXLOC = Int32(1476395020)
3537
const MPI_MIN = Int32(1476395010)
3638
const MPI_MINLOC = Int32(1476395019)
39+
const MPI_NO_OP = Int32(0x5800000e)
3740
const MPI_PROD = Int32(1476395012)
3841
const MPI_REPLACE = Int32(1476395021)
3942
const MPI_SUM = Int32(1476395011)
@@ -49,50 +52,78 @@ const MPI_TAG_UB = Int32(1681915906)
4952
const MPI_UNDEFINED = Int32(-32766)
5053
const HAVE_MPI_COMM_C2F = false
5154

52-
const MPI_ABORT = (:MPI_ABORT, "msmpi.dll")
53-
const MPI_INIT = (:MPI_INIT, "msmpi.dll")
54-
const MPI_COMM_RANK = (:MPI_COMM_RANK, "msmpi.dll")
55-
const MPI_COMM_SIZE = (:MPI_COMM_SIZE, "msmpi.dll")
56-
const MPI_COMM_SPLIT = (:MPI_COMM_SPLIT, "msmpi.dll")
57-
const MPI_COMM_SPLIT_TYPE = (:MPI_COMM_SPLIT_TYPE, "msmpi.dll")
58-
const MPI_BARRIER = (:MPI_BARRIER, "msmpi.dll")
59-
const MPI_FINALIZE = (:MPI_FINALIZE, "msmpi.dll")
60-
const MPI_BCAST = (:MPI_BCAST, "msmpi.dll")
61-
const MPI_REDUCE = (:MPI_REDUCE, "msmpi.dll")
62-
const MPI_IRECV = (:MPI_IRECV, "msmpi.dll")
63-
const MPI_RECV = (:MPI_RECV, "msmpi.dll")
64-
const MPI_ISEND = (:MPI_ISEND, "msmpi.dll")
65-
const MPI_WAITALL = (:MPI_WAITALL, "msmpi.dll")
66-
const MPI_ALLGATHER = (:MPI_ALLGATHER, "msmpi.dll")
67-
const MPI_ALLGATHERV = (:MPI_ALLGATHERV, "msmpi.dll")
68-
const MPI_ALLTOALL = (:MPI_ALLTOALL, "msmpi.dll")
69-
const MPI_ALLTOALLV = (:MPI_ALLTOALLV, "msmpi.dll")
70-
const MPI_INITIALIZED = (:MPI_INITIALIZED, "msmpi.dll")
71-
const MPI_FINALIZED = (:MPI_FINALIZED, "msmpi.dll")
72-
const MPI_OP_CREATE = (:MPI_OP_CREATE, "msmpi.dll")
73-
const MPI_OP_FREE = (:MPI_OP_FREE, "msmpi.dll")
74-
const MPI_SCATTER = (:MPI_SCATTER, "msmpi.dll")
75-
const MPI_SCATTERV = (:MPI_SCATTERV, "msmpi.dll")
76-
const MPI_SEND = (:MPI_SEND, "msmpi.dll")
77-
const MPI_SCAN = (:MPI_SCAN, "msmpi.dll")
78-
const MPI_EXSCAN = (:MPI_EXSCAN, "msmpi.dll")
79-
const MPI_GATHER = (:MPI_GATHER, "msmpi.dll")
80-
const MPI_GATHERV = (:MPI_GATHERV, "msmpi.dll")
81-
const MPI_COMM_DUP = (:MPI_COMM_DUP, "msmpi.dll")
82-
const MPI_IPROBE = (:MPI_IPROBE, "msmpi.dll")
83-
const MPI_PROBE = (:MPI_PROBE, "msmpi.dll")
84-
const MPI_COMM_FREE = (:MPI_COMM_FREE, "msmpi.dll")
85-
const MPI_GET_COUNT = (:MPI_GET_COUNT, "msmpi.dll")
86-
const MPI_TEST = (:MPI_TEST, "msmpi.dll")
87-
const MPI_TESTSOME = (:MPI_TESTSOME, "msmpi.dll")
88-
const MPI_TESTANY = (:MPI_TESTANY, "msmpi.dll")
89-
const MPI_TESTALL = (:MPI_TESTALL, "msmpi.dll")
90-
const MPI_TYPE_CREATE_STRUCT = (:MPI_TYPE_CREATE_STRUCT, "msmpi.dll")
91-
const MPI_TYPE_COMMIT = (:MPI_TYPE_COMMIT, "msmpi.dll")
92-
const MPI_WAIT = (:MPI_WAIT, "msmpi.dll")
93-
const MPI_WAITSOME = (:MPI_WAITSOME, "msmpi.dll")
94-
const MPI_WAITANY = (:MPI_WAITANY, "msmpi.dll")
95-
const MPI_CANCEL = (:MPI_CANCEL, "msmpi.dll")
96-
const MPI_ALLREDUCE = (:MPI_ALLREDUCE, "msmpi.dll")
55+
const libmpi = "msmpi.dll"
56+
57+
const MPI_ABORT = (:MPI_ABORT, libmpi)
58+
const MPI_ALLREDUCE = (:MPI_ALLREDUCE, libmpi)
59+
const MPI_INIT = (:MPI_INIT, libmpi)
60+
const MPI_CANCEL = (:MPI_CANCEL, libmpi)
61+
const MPI_COMM_FREE = (:MPI_COMM_FREE, libmpi)
62+
const MPI_COMM_GET_PARENT = (:MPI_COMM_GET_PARENT, libmpi)
63+
const MPI_COMM_RANK = (:MPI_COMM_RANK, libmpi)
64+
const MPI_COMM_SIZE = (:MPI_COMM_SIZE, libmpi)
65+
const MPI_COMM_SPLIT = (:MPI_COMM_SPLIT, libmpi)
66+
const MPI_COMM_SPLIT_TYPE = (:MPI_COMM_SPLIT_TYPE, libmpi)
67+
const MPI_BARRIER = (:MPI_BARRIER, libmpi)
68+
const MPI_FINALIZE = (:MPI_FINALIZE, libmpi)
69+
const MPI_BCAST = (:MPI_BCAST, libmpi)
70+
const MPI_REDUCE = (:MPI_REDUCE, libmpi)
71+
const MPI_IRECV = (:MPI_IRECV, libmpi)
72+
const MPI_RECV = (:MPI_RECV, libmpi)
73+
const MPI_ISEND = (:MPI_ISEND, libmpi)
74+
const MPI_WAITALL = (:MPI_WAITALL, libmpi)
75+
const MPI_ALLGATHER = (:MPI_ALLGATHER, libmpi)
76+
const MPI_ALLGATHERV = (:MPI_ALLGATHERV, libmpi)
77+
const MPI_ALLTOALL = (:MPI_ALLTOALL, libmpi)
78+
const MPI_ALLTOALLV = (:MPI_ALLTOALLV, libmpi)
79+
const MPI_INFO_CREATE = (:MPI_INFO_CREATE, libmpi)
80+
const MPI_INFO_DELETE = (:MPI_INFO_DELETE, libmpi)
81+
const MPI_INFO_FREE = (:MPI_INFO_FREE, libmpi)
82+
const MPI_INFO_GET = (:MPI_INFO_GET, libmpi)
83+
const MPI_INFO_GET_VALUELEN = (:MPI_INFO_GET_VALUELEN, libmpi)
84+
const MPI_INFO_SET = (:MPI_INFO_SET, libmpi)
85+
const MPI_INITIALIZED = (:MPI_INITIALIZED, libmpi)
86+
const MPI_FINALIZED = (:MPI_FINALIZED, libmpi)
87+
const MPI_FETCH_AND_OP = (:MPI_FETCH_AND_OP, libmpi)
88+
const MPI_OP_CREATE = (:MPI_OP_CREATE, libmpi)
89+
const MPI_OP_FREE = (:MPI_OP_FREE, libmpi)
90+
const MPI_SCATTER = (:MPI_SCATTER, libmpi)
91+
const MPI_SCATTERV = (:MPI_SCATTERV, libmpi)
92+
const MPI_SEND = (:MPI_SEND, libmpi)
93+
const MPI_SCAN = (:MPI_SCAN, libmpi)
94+
const MPI_EXSCAN = (:MPI_EXSCAN, libmpi)
95+
const MPI_GET = (:MPI_GET, libmpi)
96+
const MPI_GET_ADDRESS = (:MPI_GET_ADDRESS, libmpi)
97+
const MPI_GET_COUNT = (:MPI_GET_COUNT, libmpi)
98+
const MPI_GATHER = (:MPI_GATHER, libmpi)
99+
const MPI_GATHERV = (:MPI_GATHERV, libmpi)
100+
const MPI_COMM_DUP = (:MPI_COMM_DUP, libmpi)
101+
const MPI_INTERCOMM_MERGE = (:MPI_INTERCOMM_MERGE, libmpi)
102+
const MPI_IPROBE = (:MPI_IPROBE, libmpi)
103+
const MPI_PROBE = (:MPI_PROBE, libmpi)
104+
const MPI_PUT = (:MPI_PUT, libmpi)
105+
const MPI_TEST = (:MPI_TEST, libmpi)
106+
const MPI_TESTSOME = (:MPI_TESTSOME, libmpi)
107+
const MPI_TESTANY = (:MPI_TESTANY, libmpi)
108+
const MPI_TESTALL = (:MPI_TESTALL, libmpi)
109+
const MPI_TYPE_CREATE_STRUCT = (:MPI_TYPE_CREATE_STRUCT, libmpi)
110+
const MPI_TYPE_COMMIT = (:MPI_TYPE_COMMIT, libmpi)
111+
const MPI_WAIT = (:MPI_WAIT, libmpi)
112+
const MPI_WAITANY = (:MPI_WAITANY, libmpi)
113+
const MPI_WAITSOME = (:MPI_WAITSOME, libmpi)
114+
const MPI_WIN_ATTACH = (:MPI_WIN_ATTACH, libmpi)
115+
const MPI_WIN_CREATE = (:MPI_WIN_CREATE, libmpi)
116+
const MPI_WIN_CREATE_DYNAMIC = (:MPI_WIN_CREATE, libmpi)
117+
const MPI_WIN_DETACH = (:MPI_WIN_DETACH, libmpi)
118+
const MPI_WIN_FENCE = (:MPI_WIN_FENCE, libmpi)
119+
const MPI_WIN_FLUSH = (:MPI_WIN_FLUSH, libmpi)
120+
const MPI_WIN_FREE = (:MPI_WIN_FREE, libmpi)
121+
const MPI_WIN_LOCK = (:MPI_WIN_LOCK, libmpi)
122+
const MPI_WIN_SYNC = (:MPI_WIN_SYNC, libmpi)
123+
const MPI_WIN_UNLOCK = (:MPI_WIN_UNLOCK, libmpi)
124+
const MPI_WTICK = (:MPI_WTICK, libmpi)
125+
const MPI_WTIME = (:MPI_WTIME, libmpi)
97126

98127
primitive type CComm 32 end
128+
primitive type CInfo 32 end
129+
primitive type CWin 32 end

test/runtests.jl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ juliafiles = ["test_cman_julia.jl"]
2020
# Files to run with mpiexec -n 1
2121
singlefiles = ["test_spawn.jl"]
2222

23+
excludedfiles = []
24+
if is_windows()
25+
excludedfiles = ["test_info.jl", "test_onesided.jl"]
26+
if Sys.WORD_SIZE == 32
27+
push!(excludedfiles, "test_spawn.jl")
28+
end
29+
end
30+
2331
function runtests()
2432
nprocs = clamp(Sys.CPU_CORES, 2, 4)
2533
exename = joinpath(BINDIR, Base.julia_exename())
@@ -28,13 +36,19 @@ function runtests()
2836
testfiles = sort(filter(istest, readdir(testdir)))
2937

3038
extra_args = []
31-
if contains(readlines(open(`mpiexec --version`)[1])[1], "OpenRTE")
32-
push!(extra_args,"--oversubscribe")
39+
@static if !is_windows()
40+
if contains(readlines(open(`mpiexec --version`)[1])[1], "OpenRTE")
41+
push!(extra_args,"--oversubscribe")
42+
end
3343
end
3444

3545
nfail = 0
3646
print_with_color(:white, "Running MPI.jl tests\n")
3747
for f in testfiles
48+
if f excludedfiles
49+
println("Skipping disabled test $f")
50+
continue
51+
end
3852
try
3953
coverage_opt = coverage_opts[Base.JLOptions().code_coverage]
4054
if f singlefiles

test/test_cman_julia.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using MPI
33

44
# Start workers via `mpiexec` that communicate among themselves via MPI;
55
# communicate with the workers via TCP
6-
if contains(readlines(open(`mpiexec --version`)[1])[1], "OpenRTE")
6+
if !is_windows() && contains(readlines(open(`mpiexec --version`)[1])[1], "OpenRTE")
77
mgr = MPI.MPIManager(np=4, mpirun_cmd=`mpiexec --oversubscribe -n 4`)
88
else
99
mgr = MPI.MPIManager(np=4)

0 commit comments

Comments
 (0)