@@ -7,48 +7,12 @@ typealias MPIDatatype Union{Char,
7
7
# for a given type T<:MPIDatatype. This works better with precompilation
8
8
# than a dictionary (since DataType keys need to be re-hashed at runtime),
9
9
# and also allows the datatype code to be inlined at compile-time.
10
- let _int_datatypes = Dict {Int, Cint} (
11
- 1 => MPI_INTEGER1,
12
- 2 => MPI_INTEGER2,
13
- 4 => MPI_INTEGER4,
14
- 8 => MPI_INTEGER8),
15
- _real_datatypes = Dict {Int, Cint} (
16
- 4 => MPI_REAL4,
17
- 8 => MPI_REAL8)
18
- _complex_datatypes = Dict {Int, Cint} (
19
- 8 => MPI_COMPLEX8,
20
- 16 => MPI_COMPLEX16)
21
- _datatypes = Dict {DataType, Cint} (
22
- # Older versions of OpenMPI (such as those used by default in
23
- # Travis) do not define MPI_WCHAR and the MPI_*INT*_T types for
24
- # Fortran. We thus don't require them (yet).
25
- # Char => MPI_WCHAR,
26
- # Int8 => MPI_INT8_T,
27
- # UInt8 => MPI_UINT8_T,
28
- # Int16 => MPI_INT16_T,
29
- # UInt16 => MPI_UINT16_T,
30
- # Int32 => MPI_INT32_T,
31
- # UInt32 => MPI_UINT32_T,
32
- # Int64 => MPI_INT64_T,
33
- # UInt64 => MPI_UINT64_T,
34
- Char => _int_datatypes[sizeof (Char)],
35
- Int8 => _int_datatypes[sizeof (Int8)],
36
- UInt8 => _int_datatypes[sizeof (UInt8)],
37
- Int16 => _int_datatypes[sizeof (Int16)],
38
- UInt16 => _int_datatypes[sizeof (UInt16)],
39
- Int32 => _int_datatypes[sizeof (Int32)],
40
- UInt32 => _int_datatypes[sizeof (UInt32)],
41
- Int64 => _int_datatypes[sizeof (Int64)],
42
- UInt64 => _int_datatypes[sizeof (UInt64)],
43
- Float32 => _real_datatypes[sizeof (Float32)],
44
- Float64 => _real_datatypes[sizeof (Float64)],
45
- Complex64 => _complex_datatypes[sizeof (Complex64)],
46
- Complex128 => _complex_datatypes[sizeof (Complex128)])
47
-
48
- global mpitype
49
- for (T,t) in _datatypes
50
- @eval mpitype (:: Type{$T} ) = $ t
51
- end
10
+
11
+
12
+ # accessor function for getting MPI datatypes
13
+ # use a function in case more behavior is needed later
14
+ function mpitype {T} (:: Type{T} )
15
+ return mpitype_dict[T]
52
16
end
53
17
54
18
type Comm
0 commit comments