Skip to content

Commit 7f7b44c

Browse files
committed
Merge pull request #90 from stevengj/precompile
enable precompilation
2 parents 8851519 + 4b16cc8 commit 7f7b44c

File tree

5 files changed

+132
-114
lines changed

5 files changed

+132
-114
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
julia 0.4-
1+
julia 0.4
22
BinDeps
33
Compat

deps/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ file(WRITE ${CMAKE_BINARY_DIR}/mpi.cmake "
154154
execute_process(COMMAND ${CMAKE_BINARY_DIR}/gen_functions OUTPUT_VARIABLE FTWOC)
155155
execute_process(COMMAND ${CMAKE_BINARY_DIR}/gen_constants OUTPUT_VARIABLE FCONS)
156156
file(READ \${SRC} MPI)
157-
file(WRITE \${DST} \"const libmpi = Libdl.dlopen(\\\"${CMAKE_LIB_INSTALL_PREFIX}/libjuliampi\\\", Libdl.RTLD_LAZY|Libdl.RTLD_DEEPBIND|Libdl.RTLD_GLOBAL)\n\")
157+
file(WRITE \${DST} \"const libmpi = \\\"${CMAKE_LIB_INSTALL_PREFIX}/libjuliampi\\\"\n\")
158158
file(APPEND \${DST} \"\n\")
159159
file(APPEND \${DST} \${FTWOC})
160160
file(APPEND \${DST} \"\n\")

deps/gen_functions.c

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,55 @@
99
int main(int argc, char *argv[])
1010
{
1111
printf("const WRAPPER_VERSION = \"%s\"\n", VERSION);
12-
printf("const MPI_ABORT = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_ABORT));
13-
printf("const MPI_ALLGATHER = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_ALLGATHER));
14-
printf("const MPI_ALLGATHERV = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_ALLGATHERV));
15-
printf("const MPI_ALLREDUCE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_ALLREDUCE));
16-
printf("const MPI_ALLTOALL = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_ALLTOALL));
17-
printf("const MPI_ALLTOALLV = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_ALLTOALLV));
18-
printf("const MPI_BARRIER = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_BARRIER));
19-
printf("const MPI_BCAST = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_BCAST));
20-
printf("const MPI_BSEND = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_BSEND));
21-
printf("const MPI_CANCEL = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_CANCEL));
22-
printf("const MPI_COMM_DUP = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_COMM_DUP));
23-
printf("const MPI_COMM_FREE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_COMM_FREE));
24-
printf("const MPI_COMM_RANK = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_COMM_RANK));
25-
printf("const MPI_COMM_SIZE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_COMM_SIZE));
26-
printf("const MPI_COMM_SPLIT = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_COMM_SPLIT));
27-
printf("const MPI_EXSCAN = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_EXSCAN));
28-
printf("const MPI_FINALIZE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_FINALIZE));
29-
printf("const MPI_FINALIZED = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_FINALIZED));
30-
printf("const MPI_GATHER = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_GATHER));
31-
printf("const MPI_GATHERV = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_GATHERV));
32-
printf("const MPI_GET_COUNT = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_GET_COUNT));
33-
printf("const MPI_GET_PROCESSOR_NAME = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_GET_PROCESSOR_NAME));
34-
printf("const MPI_INIT = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_INIT));
35-
printf("const MPI_INITIALIZED = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_INITIALIZED));
36-
printf("const MPI_IPROBE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_IPROBE));
37-
printf("const MPI_IRECV = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_IRECV));
38-
printf("const MPI_ISEND = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_ISEND));
39-
printf("const MPI_OP_CREATE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_OP_CREATE));
40-
printf("const MPI_OP_FREE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_OP_FREE));
41-
printf("const MPI_PACK = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_PACK));
42-
printf("const MPI_PACK_SIZE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_PACK_SIZE));
43-
printf("const MPI_PROBE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_PROBE));
44-
printf("const MPI_RECV = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_RECV));
45-
printf("const MPI_RECV_INIT = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_RECV_INIT));
46-
printf("const MPI_REDUCE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_REDUCE));
47-
printf("const MPI_REQUEST_FREE = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_REQUEST_FREE));
48-
printf("const MPI_RSEND = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_RSEND));
49-
printf("const MPI_SCAN = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_SCAN));
50-
printf("const MPI_SCATTER = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_SCATTER));
51-
printf("const MPI_SCATTERV = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_SCATTERV));
52-
printf("const MPI_SEND = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_SEND));
53-
printf("const MPI_SEND_INIT = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_SEND_INIT));
54-
printf("const MPI_SSEND = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_SSEND));
55-
printf("const MPI_TEST = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_TEST));
56-
printf("const MPI_UNPACK = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_UNPACK));
57-
printf("const MPI_WAIT = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_WAIT));
58-
printf("const MPI_WAITALL = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_WAITALL));
59-
printf("const MPI_WAITANY = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_WAITANY));
60-
printf("const MPI_WTIME = Libdl.dlsym(libmpi, \"%s\")\n", STRING(MPI_WTIME));
12+
printf("const MPI_ABORT = :%s\n", STRING(MPI_ABORT));
13+
printf("const MPI_ALLGATHER = :%s\n", STRING(MPI_ALLGATHER));
14+
printf("const MPI_ALLGATHERV = :%s\n", STRING(MPI_ALLGATHERV));
15+
printf("const MPI_ALLREDUCE = :%s\n", STRING(MPI_ALLREDUCE));
16+
printf("const MPI_ALLTOALL = :%s\n", STRING(MPI_ALLTOALL));
17+
printf("const MPI_ALLTOALLV = :%s\n", STRING(MPI_ALLTOALLV));
18+
printf("const MPI_BARRIER = :%s\n", STRING(MPI_BARRIER));
19+
printf("const MPI_BCAST = :%s\n", STRING(MPI_BCAST));
20+
printf("const MPI_BSEND = :%s\n", STRING(MPI_BSEND));
21+
printf("const MPI_CANCEL = :%s\n", STRING(MPI_CANCEL));
22+
printf("const MPI_COMM_DUP = :%s\n", STRING(MPI_COMM_DUP));
23+
printf("const MPI_COMM_FREE = :%s\n", STRING(MPI_COMM_FREE));
24+
printf("const MPI_COMM_RANK = :%s\n", STRING(MPI_COMM_RANK));
25+
printf("const MPI_COMM_SIZE = :%s\n", STRING(MPI_COMM_SIZE));
26+
printf("const MPI_COMM_SPLIT = :%s\n", STRING(MPI_COMM_SPLIT));
27+
printf("const MPI_EXSCAN = :%s\n", STRING(MPI_EXSCAN));
28+
printf("const MPI_FINALIZE = :%s\n", STRING(MPI_FINALIZE));
29+
printf("const MPI_FINALIZED = :%s\n", STRING(MPI_FINALIZED));
30+
printf("const MPI_GATHER = :%s\n", STRING(MPI_GATHER));
31+
printf("const MPI_GATHERV = :%s\n", STRING(MPI_GATHERV));
32+
printf("const MPI_GET_COUNT = :%s\n", STRING(MPI_GET_COUNT));
33+
printf("const MPI_GET_PROCESSOR_NAME = :%s\n", STRING(MPI_GET_PROCESSOR_NAME));
34+
printf("const MPI_INIT = :%s\n", STRING(MPI_INIT));
35+
printf("const MPI_INITIALIZED = :%s\n", STRING(MPI_INITIALIZED));
36+
printf("const MPI_IPROBE = :%s\n", STRING(MPI_IPROBE));
37+
printf("const MPI_IRECV = :%s\n", STRING(MPI_IRECV));
38+
printf("const MPI_ISEND = :%s\n", STRING(MPI_ISEND));
39+
printf("const MPI_OP_CREATE = :%s\n", STRING(MPI_OP_CREATE));
40+
printf("const MPI_OP_FREE = :%s\n", STRING(MPI_OP_FREE));
41+
printf("const MPI_PACK = :%s\n", STRING(MPI_PACK));
42+
printf("const MPI_PACK_SIZE = :%s\n", STRING(MPI_PACK_SIZE));
43+
printf("const MPI_PROBE = :%s\n", STRING(MPI_PROBE));
44+
printf("const MPI_RECV = :%s\n", STRING(MPI_RECV));
45+
printf("const MPI_RECV_INIT = :%s\n", STRING(MPI_RECV_INIT));
46+
printf("const MPI_REDUCE = :%s\n", STRING(MPI_REDUCE));
47+
printf("const MPI_REQUEST_FREE = :%s\n", STRING(MPI_REQUEST_FREE));
48+
printf("const MPI_RSEND = :%s\n", STRING(MPI_RSEND));
49+
printf("const MPI_SCAN = :%s\n", STRING(MPI_SCAN));
50+
printf("const MPI_SCATTER = :%s\n", STRING(MPI_SCATTER));
51+
printf("const MPI_SCATTERV = :%s\n", STRING(MPI_SCATTERV));
52+
printf("const MPI_SEND = :%s\n", STRING(MPI_SEND));
53+
printf("const MPI_SEND_INIT = :%s\n", STRING(MPI_SEND_INIT));
54+
printf("const MPI_SSEND = :%s\n", STRING(MPI_SSEND));
55+
printf("const MPI_TEST = :%s\n", STRING(MPI_TEST));
56+
printf("const MPI_UNPACK = :%s\n", STRING(MPI_UNPACK));
57+
printf("const MPI_WAIT = :%s\n", STRING(MPI_WAIT));
58+
printf("const MPI_WAITALL = :%s\n", STRING(MPI_WAITALL));
59+
printf("const MPI_WAITANY = :%s\n", STRING(MPI_WAITANY));
60+
printf("const MPI_WTIME = :%s\n", STRING(MPI_WTIME));
6161

6262
printf("bitstype %lu CComm\n", sizeof(MPI_Comm) * 8);
6363
return 0;

src/MPI.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
__precompile__()
2+
13
module MPI
24

35
using Compat
46

5-
include("../deps/src/compile-time.jl")
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)
610
include("mpi-base.jl")
711
include("cman.jl")
812

13+
function __init__()
14+
# need to open libmpi with RTLD_GLOBAL flag for Linux, before any ccall
15+
Libdl.dlopen(libmpi, Libdl.RTLD_LAZY|Libdl.RTLD_DEEPBIND|Libdl.RTLD_GLOBAL)
16+
end
17+
918
end

0 commit comments

Comments
 (0)