Skip to content

Commit

Permalink
merged ejh_bug_fix branch
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Mar 22, 2019
2 parents 524c5c9 + 0d3556e commit c45425d
Show file tree
Hide file tree
Showing 18 changed files with 257 additions and 538 deletions.
25 changes: 23 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ language: c
dist: trusty
sudo: false

branches:
only:
- master

addons:
apt:
sources:
Expand All @@ -17,17 +21,34 @@ before_install:

before_script:
- export CC=mpicc
- export FC=mpif90
- export CPPFLAGS='-I/usr/include'

- wget https://parallel-netcdf.github.io/Release/pnetcdf-1.11.0.tar.gz
- tar -xzvf pnetcdf-1.11.0.tar.gz
- ls -l
- pushd pnetcdf-1.11.0
- ./configure --prefix=/usr --enable-shared
- make
- sudo make install
- popd
env:
global:
- CC=mpicc
- FC=mpif90
- CPPFLAGS='-I/usr/include'
- CFLAGS='-std=c99'
- LDFLAGS='-L/usr/lib'

script:
- autoreconf -i
- export CFLAGS='-std=c99 -fsanitize=address -fno-omit-frame-pointer'
- ./configure
- make -j distcheck

- export CFLAGS='-std=c99'
- rm -rf build
- mkdir build
- cd build
- cmake -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off ..
- make VERBOSE=1
- make tests VERBOSE=1
- make test VERBOSE=1
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ A high-level Parallel I/O Library for structured grid applications

## Website

For complete documentation, see our website at [http://ncar.github.io/ParallelIO/](http://ncar.github.io/ParallelIO/).
For complete documentation, see our website at
[http://ncar.github.io/ParallelIO/](http://ncar.github.io/ParallelIO/).

## Mailing List

Expand Down
15 changes: 15 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if test "x$enable_logging" = xyes; then
AC_DEFINE([PIO_ENABLE_LOGGING], 1, [If true, turn on logging.])
fi


# Does the user want to enable Fortran library?
AC_MSG_CHECKING([whether Fortran library should be build])
AC_ARG_ENABLE([fortran],
Expand All @@ -50,6 +51,17 @@ test "x$enable_fortran" = xyes || enable_fortran=no
AC_MSG_RESULT([$enable_fortran])
AM_CONDITIONAL(BUILD_FORTRAN, [test "x$enable_fortran" = xyes])

# Does the user want to disable pnetcdf?
AC_MSG_CHECKING([whether pnetcdf is to be used])
AC_ARG_ENABLE([pnetcdf],
[AS_HELP_STRING([--disable-pnetcdf],
[Disable pnetcdf use.])])
test "x$enable_pnetcdf" = xno || enable_pnetcdf=yes
AC_MSG_RESULT([$enable_pnetcdf])
if test "x$enable_logging" = xyes; then
AC_DEFINE([PIO_ENABLE_LOGGING], 1, [If true, turn on logging.])
fi

# NetCDF (at least classic) is required for PIO to build.
AC_DEFINE([_NETCDF], [1], [netCDF classic library available])

Expand All @@ -75,6 +87,9 @@ AC_CHECK_LIB([netcdf], [nc_create], [], [AC_MSG_ERROR([Can't find or link to the

# Check for pnetcdf library.
AC_CHECK_LIB([pnetcdf], [ncmpi_create], [], [])
if test "x$ac_cv_lib_pnetcdf_ncmpi_create" = xno -a $enable_pnetcdf = yes; then
AC_MSG_ERROR([Pnetcdf not found. Set CPPFLAGS/LDFLAGS or use --disable-pnetcdf.])
fi

# If we have parallel-netcdf, then set these as well.
if test x$ac_cv_lib_pnetcdf_ncmpi_create = xyes; then
Expand Down
3 changes: 2 additions & 1 deletion examples/c/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/sh
# This is a test script for PIO examples.
# Ed Hartnett 5/7/18

# Stop execution of script if error is returned.
set -e

# Stop loop if ctrl-c is pressed.
trap exit SIGINT SIGTERM
trap exit INT TERM

printf 'running PIO examples...\n'

Expand Down
6 changes: 6 additions & 0 deletions src/clib/pio_getput_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,14 @@ int PIOc_get_var_tc(int ncid, int varid, nc_type xtype, void *buf)

/* Find the dimension lengths. */
for (int d = 0; d < ndims; d++)
{
if ((ierr = PIOc_inq_dimlen(ncid, dimids[d], &countp[d])))
{
free(startp);
free(countp);
return pio_err(ios, file, ierr, __FILE__, __LINE__);
}
}

/* Set up start array. */
for (int d = 0; d < ndims; d++)
Expand Down
18 changes: 9 additions & 9 deletions src/clib/pio_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,9 @@ int inq_var_deflate_handler(iosystem_desc_t *ios)
char shuffle_present;
char deflate_present;
char deflate_level_present;
int shuffle, *shufflep;
int deflate, *deflatep;
int deflate_level, *deflate_levelp;
int shuffle, *shufflep = NULL;
int deflate, *deflatep = NULL;
int deflate_level, *deflate_levelp = NULL;
int mpierr;

assert(ios);
Expand Down Expand Up @@ -2331,9 +2331,9 @@ int get_chunk_cache_handler(iosystem_desc_t *ios)
int iosysid;
int iotype;
char size_present, nelems_present, preemption_present;
PIO_Offset size, *sizep;
PIO_Offset nelems, *nelemsp;
float preemption, *preemptionp;
PIO_Offset size, *sizep = NULL;
PIO_Offset nelems, *nelemsp = NULL;
float preemption, *preemptionp = NULL;
int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */

LOG((1, "get_chunk_cache_handler called"));
Expand Down Expand Up @@ -2384,9 +2384,9 @@ int get_var_chunk_cache_handler(iosystem_desc_t *ios)
int ncid;
int varid;
char size_present, nelems_present, preemption_present;
PIO_Offset size, *sizep;
PIO_Offset nelems, *nelemsp;
float preemption, *preemptionp;
PIO_Offset size, *sizep = NULL;
PIO_Offset nelems, *nelemsp = NULL;
float preemption, *preemptionp = NULL;
int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */

LOG((1, "get_var_chunk_cache_handler called"));
Expand Down
1 change: 0 additions & 1 deletion src/clib/pio_rearrange.c
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,6 @@ void performance_tune_rearranger(iosystem_desc_t *ios, io_desc_t *iodesc)
if (!(wall = bget(2 * 4 * log2 * sizeof(double))))
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
double mintime;
int k = 0;

if ((mpierr = MPI_Barrier(mycomm)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
Expand Down
13 changes: 8 additions & 5 deletions src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,8 @@ int PIOc_readmap(const char *file, int *ndims, int **gdims, PIO_Offset *fmaplen,
if (!fp)
pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__);

fscanf(fp,"version %d npes %d ndims %d\n",&rversno, &rnpes, ndims);

if (fscanf(fp,"version %d npes %d ndims %d\n", &rversno, &rnpes, ndims) != 3)
pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__);
if (rversno != VERSNO)
return pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__);

Expand All @@ -895,20 +895,23 @@ int PIOc_readmap(const char *file, int *ndims, int **gdims, PIO_Offset *fmaplen,
if (!(tdims = calloc(*ndims, sizeof(int))))
return pio_err(NULL, NULL, PIO_ENOMEM, __FILE__, __LINE__);
for (int i = 0; i < *ndims; i++)
fscanf(fp,"%d ", tdims + i);
if (fscanf(fp,"%d ", tdims + i) != 1)
pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__);

if ((mpierr = MPI_Bcast(tdims, *ndims, MPI_INT, 0, comm)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);

for (int i = 0; i < rnpes; i++)
{
fscanf(fp, "%d %lld", &j, &maplen);
if (fscanf(fp, "%d %lld", &j, &maplen) != 2)
pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__);
if (j != i) // Not sure how this could be possible
return pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__);
if (!(tmap = malloc(maplen * sizeof(PIO_Offset))))
return pio_err(NULL, NULL, PIO_ENOMEM, __FILE__, __LINE__);
for (j = 0; j < maplen; j++)
fscanf(fp, "%lld ", tmap+j);
if (fscanf(fp, "%lld ", tmap + j) != 1)
pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__);

if (i > 0)
{
Expand Down
3 changes: 1 addition & 2 deletions tests/cunit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test_darray_multivar3 test_darray_1d test_darray_3d \
test_decomp_uneven test_decomps test_rearr test_darray_async_simple \
test_darray_async test_darray_async_many test_darray_2sync \
test_async_multicomp test_async_multi2 test_async_manyproc \
test_darray_fill test_decomp_frame test_perf1 test_perf2
test_darray_fill test_decomp_frame test_perf2

# Tests will run from a bash script.
TESTS = run_tests.sh
Expand Down Expand Up @@ -59,7 +59,6 @@ test_async_multi2_SOURCES = test_async_multi2.c test_common.c pio_tests.h
test_async_manyproc_SOURCES = test_async_manyproc.c test_common.c pio_tests.h
test_darray_fill_SOURCES = test_darray_fill.c test_common.c pio_tests.h
test_decomp_frame_SOURCES = test_decomp_frame.c test_common.c pio_tests.h
test_perf1_SOURCES = test_perf1.c test_common.c pio_tests.h
test_perf2_SOURCES = test_perf2.c test_common.c pio_tests.h

# Distribute the test script.
Expand Down
8 changes: 8 additions & 0 deletions tests/cunit/pio_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
return e; \
} while (0)

/** Handle non-MPI errors by finalizing the MPI library and goto
* exit. */
#define BAIL(e) do { \
fprintf(stderr, "%d Error %d in %s, line %d\n", my_rank, e, __FILE__, __LINE__); \
MPI_Finalize(); \
goto exit; \
} while (0)

/** Global err buffer for MPI. When there is an MPI error, this buffer
* is used to store the error message that is associated with the MPI
* error. */
Expand Down
3 changes: 2 additions & 1 deletion tests/cunit/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/sh
# This is a test script for PIO.
# Ed Hartnett

# Stop execution of script if error is returned.
set -e

# Stop loop if ctrl-c is pressed.
trap exit SIGINT SIGTERM
trap exit INT TERM

printf 'running PIO tests...\n'

Expand Down
Loading

0 comments on commit c45425d

Please sign in to comment.