NetCDF
4.7.4
hdf5cache.c
Go to the documentation of this file.
1
/* Copyright 2018, University Corporation for Atmospheric
2
* Research. See COPYRIGHT file for copying and redistribution
3
* conditions. */
13
#include "config.h"
14
#include "hdf5internal.h"
15
16
/* These are the default chunk cache sizes for HDF5 files created or
17
* opened with netCDF-4. */
18
extern
size_t
nc4_chunk_cache_size
;
19
extern
size_t
nc4_chunk_cache_nelems
;
20
extern
float
nc4_chunk_cache_preemption
;
21
71
int
72
nc_set_chunk_cache
(
size_t
size,
size_t
nelems,
float
preemption)
73
{
74
if
(preemption < 0 || preemption > 1)
75
return
NC_EINVAL
;
76
nc4_chunk_cache_size
= size;
77
nc4_chunk_cache_nelems
= nelems;
78
nc4_chunk_cache_preemption
= preemption;
79
return
NC_NOERR
;
80
}
81
97
int
98
nc_get_chunk_cache
(
size_t
*sizep,
size_t
*nelemsp,
float
*preemptionp)
99
{
100
if
(sizep)
101
*sizep =
nc4_chunk_cache_size
;
102
103
if
(nelemsp)
104
*nelemsp =
nc4_chunk_cache_nelems
;
105
106
if
(preemptionp)
107
*preemptionp =
nc4_chunk_cache_preemption
;
108
return
NC_NOERR
;
109
}
110
124
int
125
nc_set_chunk_cache_ints(
int
size,
int
nelems,
int
preemption)
126
{
127
if
(size <= 0 || nelems <= 0 || preemption < 0 || preemption > 100)
128
return
NC_EINVAL
;
129
nc4_chunk_cache_size
= size;
130
nc4_chunk_cache_nelems
= nelems;
131
nc4_chunk_cache_preemption
= (float)preemption / 100;
132
return
NC_NOERR
;
133
}
134
148
int
149
nc_get_chunk_cache_ints(
int
*sizep,
int
*nelemsp,
int
*preemptionp)
150
{
151
if
(sizep)
152
*sizep = (int)
nc4_chunk_cache_size
;
153
if
(nelemsp)
154
*nelemsp = (int)
nc4_chunk_cache_nelems
;
155
if
(preemptionp)
156
*preemptionp = (int)(
nc4_chunk_cache_preemption
* 100);
157
158
return
NC_NOERR
;
159
}
NC_NOERR
#define NC_NOERR
No Error.
Definition:
netcdf.h:329
NC_EINVAL
#define NC_EINVAL
Invalid Argument.
Definition:
netcdf.h:339
nc4_chunk_cache_size
size_t nc4_chunk_cache_size
Default chunk cache size.
Definition:
nc4internal.c:27
nc_set_chunk_cache
int nc_set_chunk_cache(size_t size, size_t nelems, float preemption)
Set chunk cache size.
Definition:
hdf5cache.c:72
nc_get_chunk_cache
int nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp)
Get current chunk cache settings.
Definition:
hdf5cache.c:98
nc4_chunk_cache_preemption
float nc4_chunk_cache_preemption
Default chunk cache preemption.
Definition:
nc4internal.c:29
nc4_chunk_cache_nelems
size_t nc4_chunk_cache_nelems
Default chunk cache number of elements.
Definition:
nc4internal.c:28
Return to the Main Unidata NetCDF page.
Generated on Wed May 13 2020 13:14:30 for NetCDF. NetCDF is a
Unidata
library.