-
Notifications
You must be signed in to change notification settings - Fork 266
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
Slicing very slow in 4.7.4 (reported) #1757
Comments
I have confirmed that the simple python test program in Unidata/netcdf4-python#1018 runs two orders of magnitude slower (using netcdf4-python master and hdf5 1.10.6) when netcdf-c 4.7.4 is linked, as opposed to netcdf-4.7.3. Should be fairly easy to create a simple C program to demonstrate this. |
simple C program to test (using this file): #include <stdio.h>
#include <string.h>
#include <netcdf.h>
#define FILE_NAME "woa18_A5B7_s16_04.nc"
#define NDIMS 4
#define NLAT 100
#define NLON 100
#define NLVL 102
#define VAR_NAME "s_an"
#define ERR(e) {printf("Error: %s\n", nc_strerror(e)); return 2;}
int
main()
{
int ncid, varid, lat, lon, retval;
size_t start[NDIMS], count[NDIMS];
float data_out[NLVL];
if ((retval = nc_open(FILE_NAME, NC_NOWRITE, &ncid)))
ERR(retval);
if ((retval = nc_inq_varid(ncid, VAR_NAME, &varid)))
ERR(retval);
count[0] = 1;
count[1] = NLVL;
count[2] = 1;
count[3] = 1;
start[0] = 0;
start[1] = 0;
start[2] = 0;
start[3] = 0;
for (lat = 0; lat < NLAT; lat++)
for (lon = 0; lon < NLON; lon++)
{
start[2] = lat;
start[3] = lon;
if ((retval = nc_get_vara_float(ncid, varid, start,
count, &data_out[0])))
ERR(retval);
}
if ((retval = nc_close(ncid)))
ERR(retval);
return 0;
} with netcdf-c 4.7.3:
with netcdf-c 4.7.4, I killed it after waiting 10 minutes. |
gprof output of non-zero percent time:Each sample counts as 0.01 seconds. |
Thanks @jswhit, taking a look at this now to see if I can sort out what happened, and when. |
I've got a test script set up that should give me an avenue for using |
Good. I did a diff comparison of 4.7.3 and 4.7.4, but could not |
I believe that you (Dennis) completely replaced the vara/vars code. Wasn't that between the 4.7.3 and 4.7.4 release? Or was that already in 4.7.3? |
Ok, I've found the problem. In commit The variables being set specifically are The test/result matrix is as follows.
Clearly, the increased @jswhit in the meantime, if the netCDF-C library (v4.7.4) sets the chunk_cache_size and chunk_cache_nelems to the values from v4.7.3 at configure time, we should see this issue go away. |
Well crap! Who would have thought? And I did some performance testing, so perhaps this speeds performance in some cases but slows it in other cases. OK firstly we can check this by having @jswhit build and try it and set these two values at configure time. The can be set with --with-chunk-cache-size= and --with-chunk-cache-nelems=. So try the original two numbers and see if this solves the problem. I will ask the HDF5 support group about this, and perhaps they can provide some guidance. Also I kind of wonder whether using even smaller numbers might improve performance even more? |
Wow- this is really counter-intuitive. Normally one expects larger |
We're now seeing multiple reports; I expect we will be reverting the related changes to restore the old behavior, while we figure out why this is occurring and how to best take a second run at it. |
Mirroring an issue from the python interface, which hooks into the underlying C library.
In a nutshell, array slicing in 4.7.4 has been reported as being orders of magnitude slower than in 4.7.3. Creating an issue here in the C library to make it easier to keep track of.
The text was updated successfully, but these errors were encountered: