Skip to content

Commit

Permalink
Merge pull request #1864 from jedwards4b/check_netcdf_errfix
Browse files Browse the repository at this point in the history
fix error in check_netcdf call and in detecting dap
  • Loading branch information
jedwards4b authored Mar 18, 2021
2 parents 813e7c1 + 9a4e836 commit 357ca50
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/autotools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
sudo apt-spy2 fix --commit
# after selecting a specific mirror, we need to run 'apt-get update'
sudo apt-get update
sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev
sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev
- name: cache-pnetcdf
id: cache-pnetcdf
uses: actions/cache@v2
Expand All @@ -50,6 +50,6 @@ jobs:
- name: autoreconf
run: autoreconf -i
- name: configure
run: ./configure --enable-fortran --enable-docs
run: ./configure --enable-fortran --enable-docs --with-mpiexec='mpiexec --oversubscribe'
- name: make check
run: make -j check
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
set -x
mkdir build
cd build
cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/usr/include -DPnetCDF_PATH='/home/runner/pnetcdf' -DPIO_ENABLE_FORTRAN=Off -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off ..
cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/usr/include -DPnetCDF_PATH='/home/runner/pnetcdf' -DPIO_ENABLE_FORTRAN=Off -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off -DMPIEXEC_PREFLAGS="--oversubscribe" ..
make VERBOSE=1
make tests VERBOSE=1
ctest -VV
5 changes: 2 additions & 3 deletions .github/workflows/strict_autotools_ubuntu_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
sudo apt-spy2 fix --commit
# after selecting a specific mirror, we need to run 'apt-get update'
sudo apt-get update
sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev
sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev
- name: cache-pnetcdf
id: cache-pnetcdf
Expand Down Expand Up @@ -56,7 +56,6 @@ jobs:
export CFLAGS="-std=c99 -Wall"
export FFLAGS="-Wall"
export FCFLAGS="-Wall"
export DISTCHECK_CONFIGURE_FLAGS="--enable-fortran"
export DISTCHECK_CONFIGURE_FLAGS="--enable-fortran --with-mpiexec='/usr/bin/mpiexec --oversubscribe'"
./configure
make -j distcheck
8 changes: 5 additions & 3 deletions CTestScript.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ execute_process (COMMAND ${HOSTNAME_CMD}
## -- Set hostname ID (e.g., alcf, nwsc, nersc, ...)
message ("hostname is ${HOSTNAME}")

if (DEFINED HOSTNAME_ID)
else()
# UCAR/NWSC Machines
if (HOSTNAME MATCHES "^yslogin" OR
HOSTNAME MATCHES "^geyser" OR
Expand All @@ -51,7 +53,7 @@ if (HOSTNAME MATCHES "^yslogin" OR
# New UCAR/NWSC SGI Machines
elseif (HOSTNAME MATCHES "^laramie" OR
HOSTNAME MATCHES "^chadmin" OR
HOSTNAME MATCHES "^cheyenne")
HOSTNAME MATCHES "^cheyenne")
set (HOSTNAME_ID "nwscla")
# ALCF/Argonne Machines
elseif (HOSTNAME MATCHES "^mira" OR
Expand Down Expand Up @@ -87,10 +89,10 @@ else ()
if (CMAKE_SYSTEM_NAME MATCHES "Catamount")
set (HOSTNAME_ID "ncsa")
else ()
set (HOSTNAME_ID "unknown")
set (HOSTNAME_ID "unknown")
endif ()
endif ()

endif()
## -- Get system info

find_program (UNAME NAMES uname)
Expand Down
5 changes: 2 additions & 3 deletions cmake/LibMPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function (platform_name RETURN_VARIABLE)

if (SITENAME MATCHES "^laramie" OR
SITENAME MATCHES "^cheyenne" OR
SITENAME MATCHES "^chadmin")
SITENAME MATCHES "^chadmin")

set (${RETURN_VARIABLE} "nwscla" PARENT_SCOPE)
set (${RETURN_VARIABLE} "nwscla" PARENT_SCOPE)

# ALCF/Argonne Machines
elseif (SITENAME MATCHES "^mira" OR
Expand Down Expand Up @@ -67,7 +67,6 @@ function (platform_name RETURN_VARIABLE)
set (${RETURN_VARIABLE} "unknown" PARENT_SCOPE)

endif ()

endfunction ()

#==============================================================================
Expand Down
6 changes: 3 additions & 3 deletions cmake/TryNetCDF_DAP.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

int main()
{
#if NC_HAS_DAP==1
return 0;
#if NC_HAS_DAP==1 || NC_HAS_DAP2==1 || NC_HAS_DAP4==1
return 0;
#else
XXX;
XXX;
#endif
}
81 changes: 38 additions & 43 deletions src/clib/pio_getput_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,8 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset
int *request;

PLOG((2, "PIOc_put_vars_tc calling pnetcdf function"));
flush_output_buffer(file, false, num_elem*typelen);

/*vdesc = &file->varlist[varid];*/
if ((ierr = get_var_desc(varid, &file->varlist, &vdesc)))
return pio_err(ios, file, ierr, __FILE__, __LINE__);
Expand All @@ -1148,47 +1150,42 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset
sizeof(int) * (vdesc->nreqs + PIO_REQUEST_ALLOC_CHUNK))))
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
request = vdesc->request + vdesc->nreqs;
PLOG((2, "PIOc_put_vars_tc request = %d", vdesc->request));
PLOG((2, "PIOc_put_vars_tc request = %d size = %d", vdesc->request, num_elem*typelen));

/* Only the IO master actually does the call. */
// if (ios->iomaster == MPI_ROOT)
// {
switch(xtype)
{
case NC_BYTE:
ierr = ncmpi_bput_vars_schar(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_CHAR:
ierr = ncmpi_bput_vars_text(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_SHORT:
ierr = ncmpi_bput_vars_short(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_INT:
ierr = ncmpi_bput_vars_int(file->fh, varid, start, count, fake_stride, buf, request);
break;
case PIO_LONG_INTERNAL:
ierr = ncmpi_bput_vars_long(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_FLOAT:
ierr = ncmpi_bput_vars_float(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_DOUBLE:
ierr = ncmpi_bput_vars_double(file->fh, varid, start, count, fake_stride, buf, request);
break;
default:
return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__);
}
PLOG((2, "PIOc_put_vars_tc io_rank 0 done with pnetcdf call, ierr=%d", ierr));
switch(xtype)
{
case NC_BYTE:
ierr = ncmpi_bput_vars_schar(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_CHAR:
ierr = ncmpi_bput_vars_text(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_SHORT:
ierr = ncmpi_bput_vars_short(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_INT:
ierr = ncmpi_bput_vars_int(file->fh, varid, start, count, fake_stride, buf, request);
break;
case PIO_LONG_INTERNAL:
ierr = ncmpi_bput_vars_long(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_FLOAT:
ierr = ncmpi_bput_vars_float(file->fh, varid, start, count, fake_stride, buf, request);
break;
case NC_DOUBLE:
ierr = ncmpi_bput_vars_double(file->fh, varid, start, count, fake_stride, buf, request);
break;
default:
return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__);
}
PLOG((2, "PIOc_put_vars_tc io_rank 0 done with pnetcdf call, ierr=%d", ierr));

// }
// else
// *request = PIO_REQ_NULL;

vdesc->nreqs++;
flush_output_buffer(file, false, 0);
PLOG((2, "PIOc_put_vars_tc flushed output buffer"));
if(ierr == -40)
// flush_output_buffer(file, ierr == PIO_EINSUFFBUF, 0);
// PLOG((2, "PIOc_put_vars_tc flushed output buffer"));

if(ierr == PIO_EINVALCOORDS)
for(int i=0; i<ndims; i++)
PLOG((2,"start[%d] %ld count[%d] %ld\n",i,start[i],i,count[i]));
} /* endif ndims == 0 */
Expand Down Expand Up @@ -1265,15 +1262,13 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset
if (ndims && !stride_present)
free(fake_stride);

if (ierr)
return check_netcdf(file, ierr, __FILE__, __LINE__);
}

/* Broadcast and check the return code. */
/* if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) */
/* return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); */
/* if (ierr) */
/* return check_netcdf(file, ierr, __FILE__, __LINE__); */
if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if (ierr)
return check_netcdf(file, ierr, __FILE__, __LINE__);
PLOG((2, "PIOc_put_vars_tc bcast netcdf return code %d complete", ierr));

return PIO_NOERR;
Expand Down

0 comments on commit 357ca50

Please sign in to comment.