File: esdm-support.patch

package info (click to toggle)
netcdf-parallel 1%3A4.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 105,352 kB
  • sloc: ansic: 229,114; sh: 11,180; yacc: 2,561; makefile: 1,390; lex: 1,173; xml: 173; awk: 2
file content (80 lines) | stat: -rw-r--r-- 3,306 bytes parent folder | download | duplicates (3)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Description: Support for ESDM (Earth System Middleware )
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2020-09-01
Forwarded: no

Index: netcdf-parallel-4.7.4/include/netcdf.h
===================================================================
--- netcdf-parallel-4.7.4.orig/include/netcdf.h
+++ netcdf-parallel-4.7.4/include/netcdf.h
@@ -162,6 +162,10 @@ Use this in mode flags for both nc_creat
 
 #define NC_MAX_MAGIC_NUMBER_LEN 8 /**< Max len of user-defined format magic number. */
 
+/* ESD middleware offer netcdf mode to use MEMVOL plugin */
+#define NC_H5VOL_ESDM   0x0080  /**< Use HDF5 VOL Plugin: ESDM */
+
+
 /** Format specifier for nc_set_default_format() and returned
  *  by nc_inq_format. This returns the format as provided by
  *  the API. See nc_inq_format_extended to see the true file format.
Index: netcdf-parallel-4.7.4/libhdf5/hdf5create.c
===================================================================
--- netcdf-parallel-4.7.4.orig/libhdf5/hdf5create.c
+++ netcdf-parallel-4.7.4/libhdf5/hdf5create.c
@@ -59,9 +59,14 @@ nc4_create_file(const char *path, int cm
     int info_duped = 0; /* Whether the MPI Info object was duplicated */
 #endif /* !USE_PARALLEL4 */
 
+   hid_t vol_id;
+   if ( cmode & NC_H5VOL_ESDM )
+     vol_id = H5VLregister_by_name("h5-esdm"); // ESD middleware: use VOL plugin
+   
     assert(path);
     LOG((3, "%s: path %s mode 0x%x", __func__, path, cmode));
 
+    
     /* Add necessary structs to hold netcdf-4 file data. */
     if ((retval = nc4_file_list_add(ncid, path, NC_WRITE | cmode,
                                     (void **)&nc4_info)))
@@ -184,6 +189,12 @@ nc4_create_file(const char *path, int cm
                                              H5P_CRT_ORDER_INDEXED)) < 0)
         BAIL(NC_EHDFERR);
 
+    /* ESD middleware set vol plugin */ // TODO: Property exists by now, otherwise NetCDF would "BAIL"
+    if ( cmode & NC_H5VOL_ESDM ) {
+      if (H5Pset_vol(fapl_id, vol_id, &fapl_id) < 0) // ESD middleware: use VOL plugin
+	BAIL(NC_EHDFERR); // TODO: more sensible error code?
+    }
+   
 #ifdef HDF5_HAS_COLL_METADATA_OPS
     /* If HDF5 supports collective metadata operations, turn them
      * on. This is only relevant for parallel I/O builds of HDF5. */
Index: netcdf-parallel-4.7.4/libhdf5/hdf5open.c
===================================================================
--- netcdf-parallel-4.7.4.orig/libhdf5/hdf5open.c
+++ netcdf-parallel-4.7.4/libhdf5/hdf5open.c
@@ -669,6 +669,10 @@ nc4_open_file(const char *path, int mode
 #endif
     int retval;
 
+    hid_t vol_id;
+    if ( mode & NC_H5VOL_ESDM )
+      vol_id = H5VLregister_by_name("h5-esdm"); // ESD middleware: use VOL plugin
+    
     LOG((3, "%s: path %s mode %d", __func__, path, mode));
     assert(path);
 
@@ -772,6 +776,12 @@ nc4_open_file(const char *path, int mode
          nc4_chunk_cache_preemption));
 #endif /* USE_PARALLEL4 */
 
+    /* ESD middleware set vol plugin */ // TODO: Property exists by now, otherwise NetCDF would "BAIL"
+    if ( mode & NC_H5VOL_ESDM ) {
+        if (H5Pset_vol(fapl_id, vol_id, &fapl_id) < 0) // ESD middleware: use VOL plugin
+	    BAIL(NC_EHDFERR); // TODO: more sensible error code?
+    }
+
     /* Process  NC_INMEMORY */
     if(nc4_info->mem.inmemory) {
         NC_memio* memio;