Skip to content

Commit 90ef820

Browse files
committed
change MPI_Aint datatype
1 parent c2db007 commit 90ef820

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

deps/gen_functions.c

Lines changed: 4 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

src/MPI.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#__precompile__()
1+
__precompile__()
22

33
module MPI
44

src/mpi-base.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function Type_create_struct{T <: Any}(::Type{T}) # <: Any effectively
131131

132132
# put data in MPI format
133133
blocklengths = ones(Cint, nfields)
134-
displacements = zeros(Csize_t, nfields) # size_t == MPI_Aint ?
134+
displacements = zeros(Cptrdiff_t, nfields) # size_t == MPI_Aint ?
135135
types = zeros(Cint, nfields)
136136
for i=1:nfields
137137
displacements[i] = offsets[i]
@@ -141,7 +141,7 @@ function Type_create_struct{T <: Any}(::Type{T}) # <: Any effectively
141141
# create the datatype
142142
newtype_ref = Ref{Cint}()
143143
flag = Ref{Cint}()
144-
ccall(MPI_TYPE_CREATE_STRUCT, Void, (Ptr{Cint}, Ptr{Cint}, Ptr{Csize_t},
144+
ccall(MPI_TYPE_CREATE_STRUCT, Void, (Ptr{Cint}, Ptr{Cint}, Ptr{Cptrdiff_t},
145145
Ptr{Cint}, Ptr{Cint}, Ptr{Cint}), &nfields, blocklengths, displacements, types,
146146
newtype_ref, flag)
147147

0 commit comments

Comments
 (0)