Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the fortran cache API always be defined. #2098

Merged
merged 2 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions libdispatch/dvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,5 +1331,37 @@ nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp,
return ncp->dispatch->get_var_chunk_cache(ncid, varid, sizep,
nelemsp, preemptionp);
}

#ifndef USE_NETCDF4
/* Make sure the fortran API is defined, even if it only returns errors */

int
nc_set_chunk_cache_ints(int size, int nelems, int preemption)
{
return NC_ENOTBUILT;
}

int
nc_get_chunk_cache_ints(int *sizep, int *nelemsp, int *preemptionp)
{
return NC_ENOTBUILT;
}

int
nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
int preemption)
{
return NC_ENOTBUILT;
}

int
nc_get_var_chunk_cache_ints(int ncid, int varid, int *sizep,
int *nelemsp, int *preemptionp)
{
return NC_ENOTBUILT;
}

#endif /*USE_NETCDF4*/

/** @} */
/** @} */
2 changes: 2 additions & 0 deletions libhdf5/hdf5var.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ NC4_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp
/**
* @internal Define chunking stuff for a var. This is called by
* the fortran API.
* Note: see libsrc4/nc4cache.c for definition when HDF5 is disabled
*
* @param ncid File ID.
* @param varid Variable ID.
Expand Down Expand Up @@ -2147,6 +2148,7 @@ NC4_HDF5_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
/**
* @internal A wrapper for NC4_set_var_chunk_cache(), we need this
* version for fortran. Negative values leave settings as they are.
* Note: see libsrc4/nc4cache.c for definition when HDF5 is disabled
*
* @param ncid File ID.
* @param varid Variable ID.
Expand Down
26 changes: 26 additions & 0 deletions libsrc4/nc4cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp)
* but with integers instead of size_t, and with an integer preemption
* (which is the float preemtion * 100). This was required for fortran
* to avoid size_t issues.
* Note: if netcdf-4 is completely disabled, then the definitions in
* libdispatch/dfile.c take effect.
*
* @param size Cache size.
* @param nelems Number of elements.
Expand All @@ -139,6 +141,8 @@ nc_set_chunk_cache_ints(int size, int nelems, int preemption)
* nc_get_chunk_cache() but with integers instead of size_t, and with
* an integer preemption (which is the float preemtion * 100). This
* was required for fortran to avoid size_t issues.
* Note: if netcdf-4 is completely disabled, then the definitions in
* libdispatch/dfile.c take effect.
*
* @param sizep Pointer that gets cache size.
* @param nelemsp Pointer that gets number of elements.
Expand All @@ -159,3 +163,25 @@ nc_get_chunk_cache_ints(int *sizep, int *nelemsp, int *preemptionp)

return NC_NOERR;
}

#ifndef USE_HDF5
/* See definitions in libhd5/hdf5var.c */
/* Make sure they are always defined */
/* Note: if netcdf-4 is completely disabled, then the definitions in
* libdispatch/dfile.c take effect.
*/

int
nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
int preemption)
{
return NC_NOERR;
}

int
nc_def_var_chunking_ints(int ncid, int varid, int storage, int *chunksizesp)
{
return NC_NOERR;
}

#endif /*USE_HDF5*/