Skip to content

Commit

Permalink
merged changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Aug 19, 2020
2 parents f269769 + a59a55b commit cab47c3
Show file tree
Hide file tree
Showing 51 changed files with 71 additions and 152 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ before_script:
- export CC=mpicc
- export FC=mpif90
- export CPPFLAGS='-I/usr/include'
- wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.1.tar.gz
- tar -xzvf pnetcdf-1.12.1.tar.gz
- wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.1.tar.gz &> /dev/null
- tar -xzf pnetcdf-1.12.1.tar.gz
- pushd pnetcdf-1.12.1
- ./configure --prefix=/usr --enable-shared --disable-cxx
- make
Expand All @@ -41,9 +41,9 @@ env:
script:
- nc-config --all
- autoreconf -i
- export CFLAGS='-std=c99 -fsanitize=address -fno-omit-frame-pointer -Werror'
- export FFLAGS='-fsanitize=address -fno-omit-frame-pointer'
- export FCFLAGS='-fsanitize=address -fno-omit-frame-pointer -Werror'
- export CFLAGS='-g -std=c99 -fsanitize=address -fno-omit-frame-pointer -Werror'
- export FFLAGS='-g -fsanitize=address -fno-omit-frame-pointer'
- export FCFLAGS='-g -fsanitize=address -fno-omit-frame-pointer -Werror'
- export DISTCHECK_CONFIGURE_FLAGS='--enable-fortran'
- ./configure --enable-fortran --enable-developer-docs
- make -j distcheck
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ endif
SUBDIRS = src tests examples ${DOC} scripts cmake

# Add these files to the distribution.
EXTRA_DIST = CMakeLists.txt set_flags.am COPYRIGHT cmake_config.h.in \
EXTRA_DIST = CMakeLists.txt COPYRIGHT cmake_config.h.in \
libpio.settings.in
7 changes: 5 additions & 2 deletions cmake_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/
#ifndef _PIO_CONFIG_
#define _PIO_CONFIG_
/* Set to avoid warning in intel19 compiler wrt strnlen */
#define _GNU_SOURCE

/** The major part of the version number. */
#define PIO_VERSION_MAJOR @VERSION_MAJOR@
Expand Down Expand Up @@ -35,4 +33,9 @@
#cmakedefine HAVE_PAR_FILTERS
#cmakedefine NETCDF_INTEGRATION

#cmakedefine HAVE_PAR_FILTERS
#cmakedefine NETCDF_INTEGRATION
#cmakedefine _NETCDF4
#cmakedefine _PNETCDF

#endif /* _PIO_CONFIG_ */
20 changes: 2 additions & 18 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ test "x$enable_timing" = xyes || enable_timing=no
AC_MSG_RESULT([$enable_timing])
if test "x$enable_timing" = xyes; then
AC_DEFINE([TIMING], 1, [If true, use GPTL timing library.])
AC_DEFINE([HAVE_MPI], [1], [required by GPTL timing library])
fi
AM_CONDITIONAL(USE_GPTL, [test "x$enable_timing" = xyes])

Expand Down Expand Up @@ -224,24 +225,7 @@ if test "x$enable_docs" = xyes; then
AC_CONFIG_FILES([doc/Doxyfile])
fi

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

# ????
AC_DEFINE([CPRGNU], [1], [defined by CMake build])

# We must have MPI to build PIO.
AC_DEFINE([HAVE_MPI], [1], [defined by CMake build])

# ???
AC_DEFINE([INCLUDE_CMAKE_FCI], [1], [defined by CMake build])

# All builds are on LINUX.
AC_DEFINE([LINUX], [1], [defined by CMake build])

# Define to solve intel compiler warning.
AC_DEFINE([_GNU_SOURCE], [1], [solve strnlen declared implicitly warning on intel compiler])
AC_MSG_NOTICE([finding libraries])

# Check for netCDF library.
AC_CHECK_LIB([netcdf], [nc_create], [], [AC_MSG_ERROR([Can't find or link to the netcdf library.])])
Expand Down
4 changes: 0 additions & 4 deletions examples/basic/gdecomp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,7 @@ end subroutine gdecomp_print
!==================================================================
subroutine gdecomp_DOF(gdecomp,my_task,DOF,start,count,write_decomp,test)

#ifdef _NETCDF
use netcdf ! _EXTERNAL
#endif

implicit none

Expand Down Expand Up @@ -712,7 +710,6 @@ subroutine gdecomp_DOF(gdecomp,my_task,DOF,start,count,write_decomp,test)

! --- write out arrays ---

#ifdef _NETCDF
if (wdecomp) then
write(6,*) ' '
write(6,*) trim(subname),' writing decomp info to file ',trim(ncname)
Expand All @@ -738,7 +735,6 @@ subroutine gdecomp_DOF(gdecomp,my_task,DOF,start,count,write_decomp,test)
rcode = nf90_put_var(ncid,varid(2),tskid)
rcode = nf90_close(ncid)
endif
#endif

endif ! testonly

Expand Down
4 changes: 0 additions & 4 deletions examples/basic/testpio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,7 @@ program testpio
! print *, __FILE__,__LINE__,'>',fname_r8,'<'
! print *, __FILE__,__LINE__,'>',fname_i4,'<'
! print *, __FILE__,__LINE__,'>',fname_r4,'<'
#if defined(_NETCDF) || defined(_PNETCDF)
mode = pio_64bit_offset
#else
mode = 0
#endif

if(writePhase) then
if(TestCombo) then
Expand Down
2 changes: 1 addition & 1 deletion examples/f03/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
if(${PIO_BUILD_TIMING})
SET(TIMING_LINK_LIB timing)
endif()
SET(SRC examplePio.f90)
SET(SRC examplePio.F90)
ADD_EXECUTABLE(examplePio_f90 ${SRC})
TARGET_LINK_LIBRARIES(examplePio_f90 piof pioc ${TIMING_LINK_LIB})
6 changes: 3 additions & 3 deletions examples/f03/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

# Ed Hartnett 7/17/19

# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/set_flags.am
# Find the pio.mod file.
AM_CPPFLAGS = -I$(top_srcdir)/src/flib

AM_FCFLAGS = -I$(top_srcdir)/src/flib

Expand All @@ -14,7 +14,7 @@ ${top_builddir}/src/clib/libpioc.la
# Build the test for make check.
check_PROGRAMS = examplePio

examplePio_SOURCES = examplePio.f90
examplePio_SOURCES = examplePio.F90

if RUN_TESTS
# Tests will run from a bash script.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
!> @file
!! A simple Fortran example for the ParallelIO Library.
module pioExample
Expand Down
2 changes: 1 addition & 1 deletion libpio.settings.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Extra libraries: @LIBS@
Fortran Compiler: @FC_VERSION@
FFLAGS: @FFLAGS@
FCFLAGS: @FCFLAGS@
FPPFLAGS: @FPPFLAGS@
More Fortran Flags: @FPPFLAGS@

# Features
--------
Expand Down
18 changes: 0 additions & 18 deletions set_flags.am

This file was deleted.

10 changes: 4 additions & 6 deletions src/flib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
# The library we are building.
lib_LTLIBRARIES = libpiof.la

AM_CPPFLAGS = -D_NETCDF -D_NETCDF4 -D_PNETCDF

# These linker flags specify libtool version info.
# See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
# for information regarding incrementing `-version-info`.
Expand Down Expand Up @@ -97,15 +95,15 @@ if BUILD_DOCS
BUILT_SOURCES += piodarray.f90 piolib_mod.f90 pionfatt_mod.f90 pionfget_mod.f90 \
pionfput_mod.f90 pionfatt_mod_2.f90 pionfget_mod_2.f90
piodarray.f90: piodarray.F90
$(CC) -E $< > $@
$(CC) -I../.. $(AM_CPPFLAGS) -E $< > $@
piolib_mod.f90: piolib_mod.F90
$(CC) -I../.. $(AM_CPPFLAGS) -E $< > $@
pionfatt_mod.f90: pionfatt_mod.F90
$(CC) -E $< > $@
$(CC) -I../.. $(AM_CPPFLAGS) -E $< > $@
pionfget_mod.f90: pionfget_mod.F90
$(CC) -E $< > $@
$(CC) -I../.. $(AM_CPPFLAGS) -E $< > $@
pionfput_mod.f90: pionfput_mod.F90
$(CC) -E $< > $@
$(CC) -I../.. $(AM_CPPFLAGS) -E $< > $@

# Unfortunately the genf90.pl script which generates these fortran
# files has no way of handling doxygen documentation. So use sed to
Expand Down
2 changes: 0 additions & 2 deletions src/flib/pio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ module pio
pio_iotype_pnetcdf,pio_iotype_netcdf, &
pio_global, pio_char, pio_write, pio_nowrite, pio_clobber, pio_noclobber, &
pio_max_name, pio_max_var_dims, pio_rearr_subset, pio_rearr_box, &
#if defined(_NETCDF) || defined(_PNETCDF)
pio_nofill, pio_unlimited, pio_fill_int, pio_fill_double, pio_fill_float, &
#endif
pio_64bit_offset, pio_64bit_data, &
pio_internal_error, pio_bcast_error, pio_return_error, pio_default

Expand Down
1 change: 1 addition & 0 deletions src/flib/pio_kinds.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
!! types like integer, character, logical, real4 and real8.
!!
!<
#include "config.h"
module pio_kinds

! uses mpi if available
Expand Down
1 change: 1 addition & 0 deletions src/flib/pio_nf.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
!>
!! @file
!! Code to implement the classic netCDF Fortran API in PIO.
Expand Down
1 change: 1 addition & 0 deletions src/flib/pio_support.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
!>
!! @file
!! Internal code for compiler workarounds, aborts and debug functions.
Expand Down
1 change: 1 addition & 0 deletions src/flib/pio_types.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
!>
!! @file
!! Derived datatypes and constants for PIO Fortran API.
Expand Down
1 change: 1 addition & 0 deletions src/flib/piodarray.F90.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define __PIO_FILE__ 'piodarray'
#include "config.h"
!>
!! @file
!! Read and write routines for decomposed data.
Expand Down
1 change: 1 addition & 0 deletions src/flib/pionfatt_mod.F90.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define __PIO_FILE__ "pionfatt_mod.F90"
#include "config.h"
!>
!! @file
!! @brief NetCDF attribute interface to PIO
Expand Down
1 change: 1 addition & 0 deletions src/flib/pionfget_mod.F90.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define __PIO_FILE__ "pionfget_mod.F90"
#include "config.h"
!>
!! @file
!! @brief Read Routines for non-decomposed NetCDF data.
Expand Down
1 change: 1 addition & 0 deletions src/flib/pionfput_mod.F90.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define __PIO_FILE__ "pionfput_mod.F90"
#include "config.h"
!>
!! @file
!! @brief Write routines for non-decomposed NetCDF data.
Expand Down
3 changes: 1 addition & 2 deletions tests/cunit/test_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ get_iotypes(int *num_flavors, int *flavors)
num++;
format[fmtidx++] = PIO_IOTYPE_PNETCDF;
#endif
#ifdef _NETCDF
/* NetCDF is always present. */
num++;
format[fmtidx++] = PIO_IOTYPE_NETCDF;
#endif
#ifdef _NETCDF4
num += 2;
format[fmtidx++] = PIO_IOTYPE_NETCDF4C;
Expand Down
2 changes: 1 addition & 1 deletion tests/cunit/test_darray_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int main(int argc, char **argv)

/* Initialize test. */
if ((ret = pio_test_init2(argc, argv, &my_rank, &ntasks, MIN_NTASKS,
MIN_NTASKS, 3, &test_comm)))
MIN_NTASKS, -1, &test_comm)))
ERR(ERR_INIT);

if ((ret = PIOc_set_iosystem_error_handling(PIO_DEFAULT, PIO_RETURN_ERROR, NULL)))
Expand Down
6 changes: 3 additions & 3 deletions tests/cunit/test_iosystem3.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int create_file(MPI_Comm comm, int iosysid, int format, char *filename,
return ret;

/* Write an attribute. */
if ((ret = PIOc_put_att_text(ncid, varid, attname, strnlen(filename, PIO_TF_MAX_STR_LEN),
if ((ret = PIOc_put_att_text(ncid, varid, attname, strlen(filename),
filename)))
return ret;

Expand Down Expand Up @@ -94,11 +94,11 @@ int check_file(MPI_Comm comm, int iosysid, int format, int ncid, char *filename,

/* Check the attribute. Null terminating byte deliberately ignored
* to match fortran code. */
if (!(att_data = malloc(strnlen(filename, PIO_TF_MAX_STR_LEN) * sizeof(char))))
if (!(att_data = malloc(strlen(filename) * sizeof(char))))
return PIO_ENOMEM;
if ((ret = PIOc_get_att(ncid, varid, attname, att_data)))
return ret;
if (strncmp(att_data, filename, strnlen(filename, PIO_TF_MAX_STR_LEN)))
if (strncmp(att_data, filename, strlen(filename)))
return ERR_WRONG;
free(att_data);

Expand Down
4 changes: 2 additions & 2 deletions tests/fncint/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

# Ed Hartnett 7/3/19

# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/set_flags.am
# Find the pio.mod file.
AM_CPPFLAGS = -I$(top_srcdir)/src/flib

# Link to the PIO Fortran and C libraries.
LDADD = ${top_builddir}/src/flib/libpiof.la ${top_builddir}/src/clib/libpioc.la
Expand Down
8 changes: 4 additions & 4 deletions tests/general/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# Parallel builds don't currently work in this directory.
.NOTPARALLEL:

# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/set_flags.am
# Find the pio.mod file.
AM_CPPFLAGS = -I$(top_srcdir)/src/flib

LDADD = libpio_tutil.la \
${top_builddir}/src/flib/libpiof.la \
# Link to our test, fortran, and C libraries.
LDADD = libpio_tutil.la ${top_builddir}/src/flib/libpiof.la \
${top_builddir}/src/clib/libpioc.la

# There is a test utility mod file in this subdir which must be built.
Expand Down
1 change: 1 addition & 0 deletions tests/general/ncdf_fail.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
MODULE ncdf_fail_tgv
use pio_tutil
implicit none
Expand Down
1 change: 1 addition & 0 deletions tests/general/ncdf_get_put.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
PIO_TF_TEMPLATE<PIO_TF_PREDEF_TYPENAME PIO_TF_DATA_TYPE, PIO_TF_PREDEF_TYPENAME PIO_TF_FC_DATA_TYPE>
PIO_TF_AUTO_TEST_SUB_BEGIN test_put_1datt
Implicit none
Expand Down
1 change: 1 addition & 0 deletions tests/general/ncdf_inq.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
MODULE ncdf_inq_tests_tgv
use pio_tutil
character(len=PIO_TF_MAX_STR_LEN), parameter :: tgv_fname = "pio_ncdf_inq_test_file.nc"
Expand Down
1 change: 1 addition & 0 deletions tests/general/ncdf_simple_tests.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
MODULE ncdf_simple_tests_tgv
use pio_tutil
! tgv in prefix corresponds to module name (ncdf_simple_tests_tgv)
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_decomp_fillval.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
! nc write 1d array with fillvalues (the holes are explicitly specified)
PIO_TF_TEMPLATE<PIO_TF_PREDEF_TYPENAME PIO_TF_DATA_TYPE, PIO_TF_PREDEF_TYPENAME PIO_TF_FC_DATA_TYPE>
PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_1d_explicit_fval
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_decomp_frame_tests.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
! Get a 3D column decomposition
! If force_rearrange is FALSE, the decomposition is such that
! # All even procs have VEC_HGT_SZ blocks of
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_decomp_tests.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
PIO_TF_AUTO_TEST_SUB_BEGIN init_decomp_1d_get_loc_sz
implicit none
integer, parameter :: VEC_LOCAL_SZ = 7
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_decomp_tests_1d.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
! Get a block cyclic decomposition
! If force_rearrange is FALSE, the decomposition is such that
! # All even procs have VEC_LOCAL_SZ elements
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_decomp_tests_2d.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
! Get a 2D column decomposition
! If force_rearrange is FALSE, the decomposition is such that
! # All even procs have VEC_COL_SZ rows of VEC_ROW_SZ elements
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_decomp_tests_3d.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
! Get a 3D column decomposition
! If force_rearrange is FALSE, the decomposition is such that
! # All even procs have VEC_HGT_SZ blocks of
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_fail.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
PIO_TF_AUTO_TEST_SUB_BEGIN fail_rank_even
LOGICAL cond
! Even procs fail
Expand Down
1 change: 1 addition & 0 deletions tests/general/pio_file_fail.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
PIO_TF_TEST_SUB_BEGIN create_file_always_fail(iotype, filename)
implicit none
integer, intent(in) :: iotype
Expand Down
Loading

0 comments on commit cab47c3

Please sign in to comment.