mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
merge ejh_par_leak
This commit is contained in:
commit
3949bd61bc
@ -695,48 +695,6 @@ dumpopenobjects(NC_HDF5_FILE_INFO_T* h5)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef NC4NOTUSED
|
||||
/**
|
||||
* @internal Define the names of attributes to ignore added by the
|
||||
* HDF5 dimension scale; these attached to variables. They cannot be
|
||||
* modified thru the netcdf-4 API.
|
||||
*/
|
||||
static const char* NC_RESERVED_VARATT_LIST[] = {
|
||||
NC_ATT_REFERENCE_LIST,
|
||||
NC_ATT_CLASS,
|
||||
NC_ATT_DIMENSION_LIST,
|
||||
NC_ATT_NAME,
|
||||
NC_ATT_COORDINATES,
|
||||
NC_DIMID_ATT_NAME,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal Define the names of attributes to ignore because they are
|
||||
* "hidden" global attributes. They can be read, but not modified thru
|
||||
* the netcdf-4 API.
|
||||
*/
|
||||
static const char* NC_RESERVED_ATT_LIST[] = {
|
||||
NC_ATT_FORMAT,
|
||||
NC3_STRICT_ATT_NAME,
|
||||
NCPROPS,
|
||||
ISNETCDF4ATT,
|
||||
SUPERBLOCKATT,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal Define the subset of the reserved list that is readable
|
||||
* by name only
|
||||
*/
|
||||
static const char* NC_RESERVED_SPECIAL_LIST[] = {
|
||||
ISNETCDF4ATT,
|
||||
SUPERBLOCKATT,
|
||||
NCPROPS,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
size_t nc4_chunk_cache_size = CHUNK_CACHE_SIZE; /**< Default chunk cache size. */
|
||||
size_t nc4_chunk_cache_nelems = CHUNK_CACHE_NELEMS; /**< Default chunk cache number of elements. */
|
||||
float nc4_chunk_cache_preemption = CHUNK_CACHE_PREEMPTION; /**< Default chunk cache preemption. */
|
||||
|
@ -684,13 +684,8 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
#endif
|
||||
int retval = NC_NOERR, range_error = 0, i, d2;
|
||||
void *bufr = NULL;
|
||||
#ifndef HDF5_CONVERT
|
||||
int need_to_convert = 0;
|
||||
size_t len = 1;
|
||||
#endif
|
||||
#ifdef HDF5_CONVERT
|
||||
hid_t mem_typeid = 0;
|
||||
#endif
|
||||
|
||||
/* Find our metadata for this file, group, and var. */
|
||||
assert(nc);
|
||||
@ -782,7 +777,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
BAIL(NC_EHDFERR);
|
||||
}
|
||||
|
||||
#ifndef HDF5_CONVERT
|
||||
/* Are we going to convert any data? (No converting of compound or
|
||||
* opaque types.) */
|
||||
if ((mem_nc_type != var->type_info->hdr.id || (var->type_info->hdr.id == NC_INT && is_long)) &&
|
||||
@ -811,28 +805,12 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
BAIL(NC_ENOMEM);
|
||||
}
|
||||
else
|
||||
#endif /* ifndef HDF5_CONVERT */
|
||||
bufr = data;
|
||||
|
||||
#ifdef HDF5_CONVERT
|
||||
/* Get the HDF type of the data in memory. */
|
||||
if ((retval = nc4_get_hdf_typeid(h5, mem_nc_type, &mem_typeid,
|
||||
var->type_info->endianness)))
|
||||
BAIL(retval);
|
||||
#endif
|
||||
|
||||
/* Create the data transfer property list. */
|
||||
if ((xfer_plistid = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
|
||||
/* Apply the callback function which will detect range
|
||||
* errors. Which one to call depends on the length of the
|
||||
* destination buffer type. */
|
||||
#ifdef HDF5_CONVERT
|
||||
if (H5Pset_type_conv_cb(xfer_plistid, except_func, &range_error) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PARALLEL4
|
||||
/* Set up parallel I/O, if needed. */
|
||||
if ((retval = set_par_access(h5, var, xfer_plistid)))
|
||||
@ -918,7 +896,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HDF5_CONVERT
|
||||
/* Do we need to convert the data? */
|
||||
if (need_to_convert)
|
||||
{
|
||||
@ -927,7 +904,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
(h5->cmode & NC_CLASSIC_MODEL), is_long, 0)))
|
||||
BAIL(retval);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Write the data. At last! */
|
||||
LOG((4, "about to H5Dwrite datasetid 0x%x mem_spaceid 0x%x "
|
||||
@ -950,19 +926,13 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
range_error = 0;
|
||||
|
||||
exit:
|
||||
#ifdef HDF5_CONVERT
|
||||
if (mem_typeid > 0 && H5Tclose(mem_typeid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#endif
|
||||
if (file_spaceid > 0 && H5Sclose(file_spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
if (mem_spaceid > 0 && H5Sclose(mem_spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
if (xfer_plistid && (H5Pclose(xfer_plistid) < 0))
|
||||
BAIL2(NC_EPARINIT);
|
||||
#ifndef HDF5_CONVERT
|
||||
if (need_to_convert && bufr) free(bufr);
|
||||
#endif
|
||||
|
||||
/* If there was an error return it, otherwise return any potential
|
||||
range error value. If none, return NC_NOERR as usual.*/
|
||||
@ -1018,13 +988,8 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
int fill_value_size[NC_MAX_VAR_DIMS];
|
||||
int scalar = 0, retval = NC_NOERR, range_error = 0, i, d2;
|
||||
void *bufr = NULL;
|
||||
#ifdef HDF5_CONVERT
|
||||
hid_t mem_typeid = 0;
|
||||
#endif
|
||||
#ifndef HDF5_CONVERT
|
||||
int need_to_convert = 0;
|
||||
size_t len = 1;
|
||||
#endif
|
||||
|
||||
/* Find our metadata for this file, group, and var. */
|
||||
assert(nc);
|
||||
@ -1184,7 +1149,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
bufr = *(char **)data;
|
||||
}
|
||||
|
||||
#ifndef HDF5_CONVERT
|
||||
/* Are we going to convert any data? (No converting of compound or
|
||||
* opaque types.) */
|
||||
if ((mem_nc_type != var->type_info->hdr.id || (var->type_info->hdr.id == NC_INT && is_long)) &&
|
||||
@ -1206,29 +1170,13 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
BAIL(NC_ENOMEM);
|
||||
}
|
||||
else
|
||||
#endif /* ifndef HDF5_CONVERT */
|
||||
if(!bufr)
|
||||
bufr = data;
|
||||
|
||||
/* Get the HDF type of the data in memory. */
|
||||
#ifdef HDF5_CONVERT
|
||||
if ((retval = nc4_get_hdf_typeid(h5, mem_nc_type, &mem_typeid,
|
||||
var->type_info->endianness)))
|
||||
BAIL(retval);
|
||||
#endif
|
||||
|
||||
/* Create the data transfer property list. */
|
||||
if ((xfer_plistid = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
|
||||
#ifdef HDF5_CONVERT
|
||||
/* Apply the callback function which will detect range
|
||||
* errors. Which one to call depends on the length of the
|
||||
* destination buffer type. */
|
||||
if (H5Pset_type_conv_cb(xfer_plistid, except_func, &range_error) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PARALLEL4
|
||||
/* Set up parallel I/O, if needed. */
|
||||
if ((retval = set_par_access(h5, var, xfer_plistid)))
|
||||
@ -1241,12 +1189,7 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
mem_spaceid, file_spaceid, xfer_plistid, bufr) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
|
||||
#ifndef HDF5_CONVERT
|
||||
/* Eventually the block below will go away. Right now it's
|
||||
needed to support conversions between int/float, and range
|
||||
checking converted data in the netcdf way. These features are
|
||||
being added to HDF5 at the HDF5 World Hall of Coding right
|
||||
now, by a staff of thousands of programming gnomes. */
|
||||
/* Convert data if needed. */
|
||||
if (need_to_convert)
|
||||
{
|
||||
if ((retval = nc4_convert_type(bufr, data, var->type_info->hdr.id, mem_nc_type,
|
||||
@ -1262,7 +1205,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
range_error)
|
||||
range_error = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* For strict netcdf-3 rules, ignore erange errors between UBYTE
|
||||
* and BYTE types. */
|
||||
@ -1357,10 +1299,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
}
|
||||
|
||||
exit:
|
||||
#ifdef HDF5_CONVERT
|
||||
if (mem_typeid > 0 && H5Tclose(mem_typeid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#endif
|
||||
if (file_spaceid > 0)
|
||||
{
|
||||
if (H5Sclose(file_spaceid) < 0)
|
||||
@ -1376,10 +1314,8 @@ exit:
|
||||
if (H5Pclose(xfer_plistid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
}
|
||||
#ifndef HDF5_CONVERT
|
||||
if (need_to_convert && bufr != NULL)
|
||||
free(bufr);
|
||||
#endif
|
||||
if (xtend_size)
|
||||
free(xtend_size);
|
||||
if (fillvalue)
|
||||
|
@ -1,22 +1,9 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/*
|
||||
* Main driver of the Parallel NetCDF4 tests
|
||||
*
|
||||
*/
|
||||
/* This test of netCDF-4 parallel I/O was contributed by the HDF5
|
||||
* team. */
|
||||
|
||||
#include <nc_tests.h>
|
||||
#include "err_macros.h"
|
||||
@ -45,9 +32,9 @@
|
||||
dimension to be divided evenly, the best set of number of processor
|
||||
should be 2 power n. However, for NetCDF4 tests, the following numbers
|
||||
are generally treated as good numbers:
|
||||
1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256
|
||||
1,2,3,4,6,8,12,16
|
||||
|
||||
The maximum number of processor is 256.*/
|
||||
The maximum number of processor is 16.*/
|
||||
|
||||
int test_pio(int);
|
||||
int test_pio_attr(int);
|
||||
@ -64,7 +51,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int mpi_size, mpi_rank; /* mpi variables */
|
||||
int i;
|
||||
int NUMP[16] ={1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256};
|
||||
int NUMP[8] ={1,2,3,4,6,8,12,16};
|
||||
int size_flag = 0;
|
||||
|
||||
/* Un-buffer the stdout and stderr */
|
||||
@ -78,7 +65,7 @@ int main(int argc, char **argv)
|
||||
if (mpi_rank == 0)
|
||||
printf("\n*** Testing more advanced parallel access.\n");
|
||||
|
||||
for (i = 0; i < 16; i++){
|
||||
for (i = 0; i < 8; i++){
|
||||
if(mpi_size == NUMP[i])
|
||||
{
|
||||
size_flag = 1;
|
||||
@ -88,7 +75,7 @@ int main(int argc, char **argv)
|
||||
if(!size_flag){
|
||||
printf("mpi_size is wrong\n");
|
||||
printf(" The number of processor must be chosen from\n");
|
||||
printf(" 1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256 \n");
|
||||
printf(" 1,2,3,4,6,8,12,16 \n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -711,7 +698,7 @@ int test_pio_extend(int flag){
|
||||
int dimsVrtx[2];
|
||||
size_t start[2];
|
||||
size_t count[2];
|
||||
int vertices[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
int vertices[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &procs);
|
||||
|
Loading…
Reference in New Issue
Block a user