Skip to content

Commit f52ade0

Browse files
authored
Merge pull request #1974 from jedwards4b/fix_scalar_write_issue
fix scalar write issue, fix serial build issue
2 parents 6d52a8c + 3661a58 commit f52ade0

20 files changed

+247
-113
lines changed

.github/actions/parallelio_cmake/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,5 @@ runs:
137137
-DPnetCDF_C_LIBRARY=${{ inputs.pnetcdf_library }} \
138138
$GITHUB_WORKSPACE/parallelio-src
139139
make VERBOSE=1
140-
make tests
140+
#make tests
141141
make install

.github/workflows/autotools.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ jobs:
5252
cd $GITHUB_WORKSPACE
5353
make check
5454
55-
- name: Setup tmate session
56-
if: ${{ failure() }}
57-
uses: mxschmitt/action-tmate@v3
55+
# - name: Setup tmate session
56+
# if: ${{ failure() }}
57+
# uses: mxschmitt/action-tmate@v3

.github/workflows/cmake.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
sudo apt-get update
2727
sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran \
2828
libjpeg-dev libz-dev openmpi-bin libopenmpi-dev cmake pnetcdf-bin libpnetcdf-dev libnetcdff-dev
29+
nc-config --all
2930
3031
- name: cmake build
3132
uses: ./.github/actions/parallelio_cmake

.github/workflows/intel.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ jobs:
121121
- name: parallelio tests
122122
run: |
123123
pushd $GITHUB_WORKSPACE/build
124-
#make tests
124+
make tests
125125
ctest -VV -E test_async_
126126
popd
127127
# the following can be used by developers to login to the github server in case of errors
128128
# see https://github.com/marketplace/actions/debugging-with-tmate for further details
129-
- name: Setup tmate session
130-
if: ${{ failure() }}
131-
uses: mxschmitt/action-tmate@v3
129+
# - name: Setup tmate session
130+
# if: ${{ failure() }}
131+
# uses: mxschmitt/action-tmate@v3

CMakeLists.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ project (PIO C)
1010
# The project version number.
1111
set(VERSION_MAJOR 2 CACHE STRING "Project major version number.")
1212
set(VERSION_MINOR 6 CACHE STRING "Project minor version number.")
13-
set(VERSION_PATCH 1 CACHE STRING "Project patch version number.")
13+
set(VERSION_PATCH 2 CACHE STRING "Project patch version number.")
1414
mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH)
1515

1616
# Create version info in autotools parlance for pio_meta.h.
@@ -358,8 +358,16 @@ int main() {return 0;}" HAVE_SZIP_WRITE)
358358
# Check to see if parallel filters are supported by HDF5/netcdf-c.
359359
###
360360
if (HAVE_NETCDF_PAR)
361-
check_function_exists(nc_inq_filter_avail HAVE_PAR_FILTERS)
361+
CHECK_C_SOURCE_COMPILES("
362+
#include <netcdf_meta.h>
363+
#if !NC_HAS_PAR_FILTERS
364+
choke me
365+
#endif
366+
int main() {return 0;}" HAVE_PAR_FILTERS)
367+
else()
368+
set(HAVE_PAR_FILTERS 0)
362369
endif()
370+
363371
###
364372
# Check to see if this is netcdf-c-4.7.2, which won't work.
365373
###

configure.ac

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Ed Hartnett 8/16/17
33

44
# Initialize autoconf and automake.
5-
AC_INIT(pio, 2.6.1)
5+
AC_INIT(pio, 2.6.2)
66
AC_CONFIG_SRCDIR(src/clib/pio_darray.c)
77
AM_INIT_AUTOMAKE([foreign serial-tests])
88

@@ -11,15 +11,15 @@ AM_INIT_AUTOMAKE([foreign serial-tests])
1111
# AC_DEFINE_UNQUOTED for config.h.
1212
AC_SUBST([PIO_VERSION_MAJOR]) PIO_VERSION_MAJOR=2
1313
AC_SUBST([PIO_VERSION_MINOR]) PIO_VERSION_MINOR=6
14-
AC_SUBST([PIO_VERSION_PATCH]) PIO_VERSION_PATCH=1
14+
AC_SUBST([PIO_VERSION_PATCH]) PIO_VERSION_PATCH=2
1515
AC_DEFINE_UNQUOTED([PIO_VERSION_MAJOR], [$PIO_VERSION_MAJOR], [PIO major version])
1616
AC_DEFINE_UNQUOTED([PIO_VERSION_MINOR], [$PIO_VERSION_MINOR], [PIO minor version])
1717
AC_DEFINE_UNQUOTED([PIO_VERSION_PATCH], [$PIO_VERSION_PATCH], [PIO patch version])
1818

1919
# Once more for the documentation.
2020
AC_SUBST([VERSION_MAJOR], [2])
2121
AC_SUBST([VERSION_MINOR], [6])
22-
AC_SUBST([VERSION_PATCH], [1])
22+
AC_SUBST([VERSION_PATCH], [2])
2323

2424

2525
# The m4 directory holds macros for autoconf.

src/clib/pio.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -1267,9 +1267,8 @@ extern "C" {
12671267
const long long *op);
12681268
int PIOc_put_vard_ulonglong(int ncid, int varid, int decompid, const PIO_Offset recnum,
12691269
const unsigned long long *op);
1270-
/* use this variable in the NETCDF library (introduced in v4.9.0) to determine if the following
1271-
functions are available */
1272-
#ifdef NC_HAS_MULTIFILTERS
1270+
1271+
#ifdef NC_HAS_PAR_FILTERS
12731272
int PIOc_def_var_filter(int ncid, int varid,unsigned int id, size_t nparams, unsigned int *params);
12741273
int PIOc_inq_var_filter_ids(int ncid, int varid, size_t *nfiltersp, unsigned int *ids);
12751274
int PIOc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t *nparamsp, unsigned int *params );

src/clib/pio_file.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ PIOc_createfile(int iosysid, int *ncidp, int *iotype, const char *filename,
156156

157157
PLOG((1, "PIOc_createfile iosysid = %d iotype = %d filename = %s mode = %d",
158158
iosysid, *iotype, filename, mode));
159-
159+
160160
/* Create the file. */
161161
if ((ret = PIOc_createfile_int(iosysid, ncidp, iotype, filename, mode, 0)))
162162
return pio_err(ios, NULL, ret, __FILE__, __LINE__);

src/clib/pio_getput_int.c

+36-85
Original file line numberDiff line numberDiff line change
@@ -1085,100 +1085,51 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset
10851085
#ifdef _PNETCDF
10861086
if (file->iotype == PIO_IOTYPE_PNETCDF)
10871087
{
1088-
if (ndims == 0)
1089-
if ((ierr = ncmpi_begin_indep_data(file->fh)))
1090-
return pio_err(ios, file, ierr, __FILE__, __LINE__);
10911088
if (ios->iomain == MPI_ROOT)
10921089
{
1093-
/* Scalars have to be handled differently. */
1094-
if (ndims == 0)
1090+
/* This is not a scalar var. */
1091+
var_desc_t *vdesc;
1092+
1093+
PLOG((2, "PIOc_put_vars_tc calling pnetcdf function"));
1094+
1095+
if ((ierr = get_var_desc(varid, &file->varlist, &vdesc)))
1096+
return pio_err(ios, file, ierr, __FILE__, __LINE__);
1097+
1098+
switch(xtype)
10951099
{
1096-
/* This is a scalar var. */
1097-
PLOG((2, "pnetcdf writing scalar with ncmpi_put_vars_*() file->fh = %d varid = %d",
1098-
file->fh, varid));
1099-
pioassert(!start && !count && !stride, "expected NULLs", __FILE__, __LINE__);
1100-
1101-
1102-
/* Only the IO main does the IO, so we are not really
1103-
* getting parallel IO here. */
1104-
1105-
switch(xtype)
1106-
{
1107-
case NC_BYTE:
1108-
ierr = ncmpi_put_vars_schar(file->fh, varid, start, count, stride, buf);
1109-
break;
1110-
case NC_CHAR:
1111-
ierr = ncmpi_put_vars_text(file->fh, varid, start, count, stride, buf);
1112-
break;
1113-
case NC_SHORT:
1114-
ierr = ncmpi_put_vars_short(file->fh, varid, start, count, stride, buf);
1115-
break;
1116-
case NC_INT:
1117-
ierr = ncmpi_put_vars_int(file->fh, varid, start, count, stride, buf);
1118-
break;
1119-
case PIO_LONG_INTERNAL:
1120-
ierr = ncmpi_put_vars_long(file->fh, varid, start, count, stride, buf);
1121-
break;
1122-
case NC_FLOAT:
1123-
ierr = ncmpi_put_vars_float(file->fh, varid, start, count, stride, buf);
1124-
break;
1125-
case NC_DOUBLE:
1126-
ierr = ncmpi_put_vars_double(file->fh, varid, start, count, stride, buf);
1127-
break;
1128-
default:
1129-
return pio_err(ios, file, PIO_EBADIOTYPE, __FILE__, __LINE__);
1130-
}
1100+
case NC_BYTE:
1101+
ierr = ncmpi_bput_vars_schar(file->fh, varid, start, count, fake_stride, buf, NULL);
1102+
break;
1103+
case NC_CHAR:
1104+
ierr = ncmpi_bput_vars_text(file->fh, varid, start, count, fake_stride, buf, NULL);
1105+
break;
1106+
case NC_SHORT:
1107+
ierr = ncmpi_bput_vars_short(file->fh, varid, start, count, fake_stride, buf, NULL);
1108+
break;
1109+
case NC_INT:
1110+
ierr = ncmpi_bput_vars_int(file->fh, varid, start, count, fake_stride, buf, NULL);
1111+
break;
1112+
case PIO_LONG_INTERNAL:
1113+
ierr = ncmpi_bput_vars_long(file->fh, varid, start, count, fake_stride, buf, NULL);
1114+
break;
1115+
case NC_FLOAT:
1116+
ierr = ncmpi_bput_vars_float(file->fh, varid, start, count, fake_stride, buf, NULL);
1117+
break;
1118+
case NC_DOUBLE:
1119+
ierr = ncmpi_bput_vars_double(file->fh, varid, start, count, fake_stride, buf, NULL);
1120+
break;
1121+
default:
1122+
return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__);
11311123
}
1132-
else
1133-
{
1134-
/* This is not a scalar var. */
1135-
var_desc_t *vdesc;
1136-
1137-
PLOG((2, "PIOc_put_vars_tc calling pnetcdf function"));
1138-
1139-
if ((ierr = get_var_desc(varid, &file->varlist, &vdesc)))
1140-
return pio_err(ios, file, ierr, __FILE__, __LINE__);
1141-
1142-
switch(xtype)
1143-
{
1144-
case NC_BYTE:
1145-
ierr = ncmpi_bput_vars_schar(file->fh, varid, start, count, fake_stride, buf, NULL);
1146-
break;
1147-
case NC_CHAR:
1148-
ierr = ncmpi_bput_vars_text(file->fh, varid, start, count, fake_stride, buf, NULL);
1149-
break;
1150-
case NC_SHORT:
1151-
ierr = ncmpi_bput_vars_short(file->fh, varid, start, count, fake_stride, buf, NULL);
1152-
break;
1153-
case NC_INT:
1154-
ierr = ncmpi_bput_vars_int(file->fh, varid, start, count, fake_stride, buf, NULL);
1155-
break;
1156-
case PIO_LONG_INTERNAL:
1157-
ierr = ncmpi_bput_vars_long(file->fh, varid, start, count, fake_stride, buf, NULL);
1158-
break;
1159-
case NC_FLOAT:
1160-
ierr = ncmpi_bput_vars_float(file->fh, varid, start, count, fake_stride, buf, NULL);
1161-
break;
1162-
case NC_DOUBLE:
1163-
ierr = ncmpi_bput_vars_double(file->fh, varid, start, count, fake_stride, buf, NULL);
1164-
break;
1165-
default:
1166-
return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__);
1167-
}
1168-
PLOG((2, "PIOc_put_vars_tc io_rank 0 done with pnetcdf call, ierr=%d", ierr));
1169-
1170-
1171-
vdesc->nreqs++;
1124+
PLOG((2, "PIOc_put_vars_tc io_rank 0 done with pnetcdf call, ierr=%d", ierr));
1125+
1126+
1127+
vdesc->nreqs++;
11721128

11731129
if(ierr == PIO_EINVALCOORDS)
11741130
for(int i=0; i<ndims; i++)
11751131
PLOG((2,"start[%d] %ld count[%d] %ld\n",i,start[i],i,count[i]));
1176-
} /* endif ndims == 0 */
11771132
} /* end if MPI_ROOT */
1178-
/* Turn off independent access for pnetcdf file. */
1179-
if(ndims == 0)
1180-
if ((ierr = ncmpi_end_indep_data(file->fh)))
1181-
return pio_err(ios, file, ierr, __FILE__, __LINE__);
11821133
}
11831134
#endif /* _PNETCDF */
11841135

src/clib/pio_internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <limits.h>
1818
#include <math.h>
1919
#include <netcdf.h>
20-
#ifdef PIO_HAS_PAR_FILTERS
20+
#ifdef NC_HAS_PAR_FILTERS
2121
#include <netcdf_filter.h>
2222
#include <netcdf_meta.h>
2323
#endif

src/clib/pio_nc4.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,6 @@ PIOc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, unsign
13961396
return PIO_NOERR;
13971397
}
13981398
#ifdef PIO_HAS_PAR_FILTERS
1399-
14001399
/**
14011400
* Get the variable filter ids if any
14021401
*
@@ -1794,8 +1793,10 @@ PIOc_inq_var_zstandard(int ncid, int varid, int* hasfilterp, int *levelp)
17941793

17951794
return PIO_NOERR;
17961795
}
1796+
// NC_HAS_ZSTD
17971797
#endif
1798-
1798+
#endif
1799+
#ifdef PIO_HAS_PAR_FILTERS
17991800
/**
18001801
*
18011802
*
@@ -1875,7 +1876,9 @@ PIOc_inq_filter_avail(int ncid, unsigned int id )
18751876

18761877
return ierr;
18771878
}
1878-
#endif
1879+
// PIO_HAS_PAR_FILTERS
1880+
#endif
1881+
// NC_HAS_MULTIFILTERS
18791882
#endif
18801883
#ifdef NC_HAS_QUANTIZE
18811884
/**

src/clib/pioc_support.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3111,15 +3111,15 @@ iotype_is_valid(int iotype)
31113111
ret++;
31123112

31133113
/* Some builds include netCDF-4. */
3114-
#ifdef _NETCDF4
3114+
#ifdef NC_HAS_NC4
31153115
if (iotype == PIO_IOTYPE_NETCDF4C || iotype == PIO_IOTYPE_NETCDF4P)
31163116
ret++;
31173117
#endif /* _NETCDF4 */
31183118

31193119
/* Some builds include pnetcdf. */
3120+
#ifdef _PNETCDF
31203121
if (iotype == PIO_IOTYPE_PNETCDF)
31213122
ret++;
3122-
#ifdef _PNETCDF
31233123
#endif /* _PNETCDF */
31243124

31253125
return ret;

src/flib/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ else ()
200200
target_compile_definitions (gptl
201201
PUBLIC NO_MPIMOD)
202202
endif()
203+
target_compile_definitions (piof PUBLIC NO_MPIMOD)
203204
endif ()
204205

205206
#===== GPTL =====

src/ncint/ncintdispatch.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ NC_Dispatch NCINT_dispatcher = {
127127
NC_NOTNC4_def_var_filter,
128128
NC_NOTNC4_set_var_chunk_cache,
129129
NC_NOTNC4_get_var_chunk_cache,
130+
#ifdef PIO_HAS_PAR_FILTERS
130131
#if NC_DISPATCH_VERSION == 2
131132
PIO_NCINT_filter_actions,
132133
#endif
@@ -141,6 +142,7 @@ NC_Dispatch NCINT_dispatcher = {
141142
#if NC_DISPATCH_VERSION >= 5
142143
PIOc_inq_filter_avail,
143144
#endif
145+
#endif
144146
};
145147

146148
/**
@@ -229,10 +231,11 @@ PIO_NCINT_create(const char *path, int cmode, size_t initialsz, int basepe,
229231
if ((ret = nc4_file_list_add(ncid, path, cmode, NULL)))
230232
return ret;
231233

232-
/* Create the file with PIO. The final parameter tests
234+
/* Create the file with PIO. The final parameter tells
233235
* createfile_int to accept the externally assigned ncid. */
234236
if ((ret = PIOc_createfile_int(diosysid, &ncid, &iotype, path, cmode, 1)))
235237
return ret;
238+
236239

237240
return PIO_NOERR;
238241
}

tests/cunit/test_intercomm2.c

+1
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ int main(int argc, char **argv)
338338
sprintf(filename[fmt], "test_intercomm2_%d.nc", flavor[fmt]);
339339

340340
/* Create a netCDF file with one dimension and one variable. */
341+
341342
if ((ret = PIOc_createfile(iosysid[my_comp_idx], &ncid, &flavor[fmt], filename[fmt],
342343
NC_CLOBBER)))
343344
ERR(ret);

tests/cunit/test_pioc.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,9 @@ int test_scalar(int iosysid, int num_flavors, int *flavor, int my_rank, int asyn
18271827
int test_val = TEST_VAL_42;
18281828
if ((ret = PIOc_put_var_int(ncid, varid, &test_val)))
18291829
ERR(ret);
1830+
/* flush the write buffer */
1831+
if ((ret = PIOc_sync(ncid)))
1832+
ERR(ret);
18301833

18311834
/* Check the scalar var. */
18321835
if ((ret = check_scalar_var(ncid, varid, flavor[fmt], my_rank)))
@@ -2326,7 +2329,6 @@ int test_all(int iosysid, int num_flavors, int *flavor, int my_rank, MPI_Comm te
23262329
/* This will be our file name for writing out decompositions. */
23272330
sprintf(filename, "decomp_%d.txt", my_rank);
23282331
sprintf(nc_filename, "decomp_%d.nc", my_rank);
2329-
23302332
/* This is a simple test that just creates the decomp with
23312333
* async. */
23322334
if (async)

0 commit comments

Comments
 (0)