Skip to content

Commit 1f7dacf

Browse files
committed
Merge pull request #124 from JaredCrean2/datatypes
Support creating datatypes for Julia bitstypes.
2 parents adecf4f + e08c13f commit 1f7dacf

File tree

6 files changed

+219
-79
lines changed

6 files changed

+219
-79
lines changed

deps/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ FortranCInterface_HEADER(jlmpi_f2c.h MACRO_NAMESPACE "JLMPI_" SYMBOLS
7474
MPI_TESTALL
7575
MPI_TESTANY
7676
MPI_TESTSOME
77+
MPI_TYPE_COMMIT
78+
MPI_TYPE_CREATE_STRUCT
7779
MPI_UNPACK
7880
MPI_WAIT
7981
MPI_WAITALL

deps/gen_functions.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#include <stdio.h>
2+
#include <stddef.h>
23
#include "jlmpi_f2c.h"
34
#include "mpi.h"
45
#include "version.h"
56

7+
// check that the size of MPI_Aint is consistent
8+
typedef int check_sizeof_MPI_Aint[sizeof(MPI_Aint) == sizeof(ptrdiff_t) ? 1 : -1];
9+
610
#define STRING1(s) #s
711
#define STRING(s) STRING1(s)
812

@@ -64,6 +68,10 @@ int main(int argc, char *argv[]) {
6468
printf(" :MPI_WAITANY => \"%s\",\n", STRING(MPI_WAITANY));
6569
printf(" :MPI_WAITSOME => \"%s\",\n", STRING(MPI_WAITSOME));
6670
printf(" :MPI_WTIME => \"%s\",\n", STRING(MPI_WTIME));
71+
printf(" :MPI_TYPE_CREATE_STRUCT => \"%s\",\n",
72+
STRING(MPI_TYPE_CREATE_STRUCT));
73+
printf(" :MPI_TYPE_COMMIT => \"%s\",\n",
74+
STRING(MPI_TYPE_COMMIT));
6775
printf(")\n");
6876
printf("\n");
6977
printf("bitstype %d CComm\n", (int)(sizeof(MPI_Comm) * 8));

src/MPI.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,34 @@ function __init__()
3030
eval(:(const $jname = Libdl.dlsym(libmpi_handle, $fname)))
3131
end
3232
end
33+
34+
global const mpitype_dict = Dict{DataType, Cint}(
35+
# Older versions of OpenMPI (such as those used by default in
36+
# Travis) do not define MPI_WCHAR and the MPI_*INT*_T types for
37+
# Fortran. We thus don't require them (yet).
38+
# Char => MPI_WCHAR,
39+
# Int8 => MPI_INT8_T,
40+
# UInt8 => MPI_UINT8_T,
41+
# Int16 => MPI_INT16_T,
42+
# UInt16 => MPI_UINT16_T,
43+
# Int32 => MPI_INT32_T,
44+
# UInt32 => MPI_UINT32_T,
45+
# Int64 => MPI_INT64_T,
46+
# UInt64 => MPI_UINT64_T,
47+
Char => MPI_INTEGER4,
48+
Int8 => MPI_INTEGER1,
49+
UInt8 => MPI_INTEGER1,
50+
Int16 => MPI_INTEGER2,
51+
UInt16 => MPI_INTEGER2,
52+
Int32 => MPI_INTEGER4,
53+
UInt32 => MPI_INTEGER4,
54+
Int64 => MPI_INTEGER8,
55+
UInt64 => MPI_INTEGER8,
56+
Float32 => MPI_REAL4,
57+
Float64 => MPI_REAL8,
58+
Complex64 => MPI_COMPLEX8,
59+
Complex128 => MPI_COMPLEX16)
60+
3361
end
3462

3563
end

0 commit comments

Comments
 (0)