about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/hdf5/0001-Updated-H5S-to-use-the-MPI-2-function-MPI_Type_get_e.patch
blob: 8b32ea4bab1c4dccce73868befeb1ed49013d05e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 38c202df4db8eddd5e6f6f7d6506ce97912a3111 Mon Sep 17 00:00:00 2001
From: Dana Robinson <derobins@hdfgroup.org>
Date: Mon, 26 Nov 2018 22:10:06 -0800
Subject: [PATCH] Updated H5S to use the MPI-2 function MPI_Type_get_exten()
 where available. OpenMPI 4.0 removed the deprecated MPI-1 MPI_type_extent()
 call by default, so this avoids needing a special OpenMPI build.

---
 src/H5Smpio.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 2bd275a729..e71e2cb858 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -879,7 +879,18 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
                     HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
             }
 
-            MPI_Type_extent (inner_type, &inner_extent);
+#if MPI_VERSION >= 2
+{
+            /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
+             * so we're using the MPI-2 version even though we don't need the lb
+             * value.
+             */
+            MPI_Aint unused_lb_arg;
+            MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent);
+}
+#else
+            MPI_Type_extent(inner_type, &inner_extent);
+#endif
             stride_in_bytes = inner_extent * (MPI_Aint)d[i].strid;
 
             /* If the element count is larger than what a 32 bit integer can hold,
@@ -1500,7 +1511,18 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
             }
         }
 
-        MPI_Type_extent (old_type, &old_extent);
+#if MPI_VERSION >= 2
+{
+        /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
+         * so we're using the MPI-2 version even though we don't need the lb
+         * value.
+         */
+        MPI_Aint unused_lb_arg;
+        MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent);
+}
+#else
+        MPI_Type_extent(old_type, &old_extent);
+#endif
 
         /* Set up the arguments for MPI_Type_struct constructor */
         type[0] = outer_type;
-- 
2.18.1