Skip to content

Commit 0f759b0

Browse files
committed
Add support for Microsoft MPI
1 parent 4e3386a commit 0f759b0

File tree

2 files changed

+96
-10
lines changed

2 files changed

+96
-10
lines changed

src/MPI.jl

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,29 @@ module MPI
44

55
using Compat
66

7-
const depfile = joinpath(dirname(@__FILE__), "..", "deps", "src", "compile-time.jl")
8-
isfile(depfile) || error("MPI not properly installed. Please run Pkg.build(\"MPI\")")
9-
include(depfile)
7+
if @windows? true : false
8+
include("win_mpiconstants.jl")
9+
else
10+
const depfile = joinpath(dirname(@__FILE__), "..", "deps", "src", "compile-time.jl")
11+
isfile(depfile) || error("MPI not properly installed. Please run Pkg.build(\"MPI\")")
12+
include(depfile)
13+
end
14+
1015
include("mpi-base.jl")
1116
include("cman.jl")
1217

1318
function __init__()
14-
# need to open libmpi with RTLD_GLOBAL flag for Linux, before any ccall
15-
# cannot use RTLD_DEEPBIND; this leads to segfaults at least on Ubuntu 15.10
16-
@eval const libmpi_handle =
17-
Libdl.dlopen(libmpi, Libdl.RTLD_LAZY | Libdl.RTLD_GLOBAL)
19+
if @windows? true : false
20+
else
21+
# need to open libmpi with RTLD_GLOBAL flag for Linux, before any ccall
22+
# cannot use RTLD_DEEPBIND; this leads to segfaults at least on Ubuntu 15.10
23+
@eval const libmpi_handle =
24+
Libdl.dlopen(libmpi, Libdl.RTLD_LAZY | Libdl.RTLD_GLOBAL)
1825

19-
# look up all symbols ahead of time
20-
for (jname, fname) in _mpi_functions
21-
eval(:(const $jname = Libdl.dlsym(libmpi_handle, $fname)))
26+
# look up all symbols ahead of time
27+
for (jname, fname) in _mpi_functions
28+
eval(:(const $jname = Libdl.dlsym(libmpi_handle, $fname)))
29+
end
2230
end
2331
end
2432

src/win_mpiconstants.jl

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const MPI_BYTE = Int32(0x4c00010d)
2+
const MPI_WCHAR = Int32(0x4c00020e)
3+
const MPI_INT8_T = Int32(0x4c000133)
4+
const MPI_UINT8_T = Int32(0x4c000137)
5+
const MPI_INT16_T = Int32(0x4c000234)
6+
const MPI_UINT16_T = Int32(0x4c000238)
7+
const MPI_INT32_T = Int32(0x4c000435)
8+
const MPI_UINT32_T = Int32(0x4c000439)
9+
const MPI_INT64_T = Int32(0x4c000836)
10+
const MPI_UINT64_T = Int32(0x4c00083a)
11+
const MPI_REAL4 = Int32(0x4c000427)
12+
const MPI_REAL8 = Int32(0x4c000829)
13+
const MPI_COMPLEX8 = Int32(0x4c000828)
14+
const MPI_COMPLEX16 = Int32(0x4c00102a)
15+
const MPI_INTEGER1 = Int32(0x4c00012d)
16+
const MPI_INTEGER2 = Int32(0x4c00022f)
17+
const MPI_INTEGER4 = Int32(0x4c000430)
18+
const MPI_INTEGER8 = Int32(0x4c000831)
19+
const MPI_COMM_NULL = Int32(67108864)
20+
const MPI_COMM_SELF = Int32(1140850689)
21+
const MPI_COMM_WORLD = Int32(1140850688)
22+
const MPI_OP_NULL = Int32(402653184)
23+
const MPI_BAND = Int32(1476395014)
24+
const MPI_BOR = Int32(1476395016)
25+
const MPI_BXOR = Int32(1476395018)
26+
const MPI_LAND = Int32(1476395013)
27+
const MPI_LOR = Int32(1476395015)
28+
const MPI_LXOR = Int32(1476395017)
29+
const MPI_MAX = Int32(1476395009)
30+
const MPI_MAXLOC = Int32(1476395020)
31+
const MPI_MIN = Int32(1476395010)
32+
const MPI_MINLOC = Int32(1476395019)
33+
const MPI_PROD = Int32(1476395012)
34+
const MPI_REPLACE = Int32(1476395021)
35+
const MPI_SUM = Int32(1476395011)
36+
const MPI_REQUEST_NULL = Int32(738197504)
37+
const MPI_STATUS_SIZE = Int32(5)
38+
const MPI_ERROR = Int32(5)
39+
const MPI_SOURCE = Int32(3)
40+
const MPI_TAG = Int32(4)
41+
const MPI_ANY_SOURCE = Int32(-2)
42+
const MPI_ANY_TAG = Int32(-1)
43+
const MPI_TAG_UB = Int32(1681915906)
44+
const MPI_UNDEFINED = Int32(-32766)
45+
const HAVE_MPI_COMM_C2F = false
46+
47+
const MPI_INIT = (:MPI_INIT, "msmpi.dll")
48+
const MPI_COMM_RANK = (:MPI_COMM_RANK, "msmpi.dll")
49+
const MPI_COMM_SIZE = (:MPI_COMM_SIZE, "msmpi.dll")
50+
const MPI_BARRIER = (:MPI_BARRIER, "msmpi.dll")
51+
const MPI_FINALIZE = (:MPI_FINALIZE, "msmpi.dll")
52+
const MPI_BCAST = (:MPI_BCAST, "msmpi.dll")
53+
const MPI_REDUCE = (:MPI_REDUCE, "msmpi.dll")
54+
const MPI_IRECV = (:MPI_IRECV, "msmpi.dll")
55+
const MPI_RECV = (:MPI_RECV, "msmpi.dll")
56+
const MPI_ISEND = (:MPI_ISEND, "msmpi.dll")
57+
const MPI_WAITALL = (:MPI_WAITALL, "msmpi.dll")
58+
const MPI_ALLGATHER = (:MPI_ALLGATHER, "msmpi.dll")
59+
const MPI_ALLGATHERV = (:MPI_ALLGATHERV, "msmpi.dll")
60+
const MPI_ALLTOALL = (:MPI_ALLTOALL, "msmpi.dll")
61+
const MPI_ALLTOALLV = (:MPI_ALLTOALLV, "msmpi.dll")
62+
const MPI_INITIALIZED = (:MPI_INITIALIZED, "msmpi.dll")
63+
const MPI_FINALIZED = (:MPI_FINALIZED, "msmpi.dll")
64+
const MPI_SCATTER = (:MPI_SCATTER, "msmpi.dll")
65+
const MPI_SCATTERV = (:MPI_SCATTERV, "msmpi.dll")
66+
const MPI_SEND = (:MPI_SEND, "msmpi.dll")
67+
const MPI_SCAN = (:MPI_SCAN, "msmpi.dll")
68+
const MPI_EXSCAN = (:MPI_EXSCAN, "msmpi.dll")
69+
const MPI_GATHER = (:MPI_GATHER, "msmpi.dll")
70+
const MPI_GATHERV = (:MPI_GATHERV, "msmpi.dll")
71+
const MPI_COMM_DUP = (:MPI_COMM_DUP, "msmpi.dll")
72+
const MPI_IPROBE = (:MPI_IPROBE, "msmpi.dll")
73+
const MPI_PROBE = (:MPI_PROBE, "msmpi.dll")
74+
const MPI_COMM_FREE = (:MPI_COMM_FREE, "msmpi.dll")
75+
const MPI_GET_COUNT = (:MPI_GET_COUNT, "msmpi.dll")
76+
const MPI_TESTSOME = (:MPI_TESTSOME, "msmpi.dll")
77+
78+
bitstype 32 CComm

0 commit comments

Comments
 (0)