From ad4eddb75c8a18ef5c8a4a49b83630a729858277 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 17 Aug 2020 05:49:21 -0600 Subject: [PATCH 1/7] removed NETCDF flag --- configure.ac | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac index 12f423d9c1f..a9266b71c26 100644 --- a/configure.ac +++ b/configure.ac @@ -225,8 +225,6 @@ if test "x$enable_docs" = xyes; then fi AC_MSG_NOTICE([setting flags]) -# NetCDF (at least classic) is required for PIO to build. -AC_DEFINE([_NETCDF], [1], [netCDF classic library available]) # We must have MPI to build PIO. AC_DEFINE([HAVE_MPI], [1], [defined by CMake build]) From 4754ab5f4fb10dc5459ee1cba8294c624478e8aa Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 17 Aug 2020 06:11:38 -0600 Subject: [PATCH 2/7] removed unneeded check of _NETCDF --- tests/cunit/test_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/cunit/test_common.c b/tests/cunit/test_common.c index df5d5997504..e6a2b615824 100644 --- a/tests/cunit/test_common.c +++ b/tests/cunit/test_common.c @@ -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; From 8a8ba30d3f0af5a02f17f53a88480ed3f1d8ea64 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 17 Aug 2020 06:57:03 -0600 Subject: [PATCH 3/7] more removal of unneeded pre-processor symbols --- configure.ac | 5 ++--- src/flib/pio.F90 | 2 -- tests/general/util/pio_tutil.F90 | 16 ++++------------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index a9266b71c26..1b5e7e4b720 100644 --- a/configure.ac +++ b/configure.ac @@ -229,12 +229,11 @@ AC_MSG_NOTICE([setting flags]) # We must have MPI to build PIO. AC_DEFINE([HAVE_MPI], [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.])]) AC_CHECK_HEADERS([netcdf.h netcdf_meta.h]) diff --git a/src/flib/pio.F90 b/src/flib/pio.F90 index a14a8af9912..d0e9e71d2bf 100644 --- a/src/flib/pio.F90 +++ b/src/flib/pio.F90 @@ -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 diff --git a/tests/general/util/pio_tutil.F90 b/tests/general/util/pio_tutil.F90 index 181c897f88d..c5e3383f64f 100644 --- a/tests/general/util/pio_tutil.F90 +++ b/tests/general/util/pio_tutil.F90 @@ -295,11 +295,9 @@ SUBROUTINE PIO_TF_Get_nc_iotypes(iotypes, iotype_descs, num_iotypes) ! netcdf, netcdf4p, netcdf4c num_iotypes = num_iotypes + 3 #else -#ifdef _NETCDF - ! netcdf + ! netcdf is always present. num_iotypes = num_iotypes + 1 #endif -#endif #ifdef _PNETCDF ! pnetcdf num_iotypes = num_iotypes + 1 @@ -328,12 +326,10 @@ SUBROUTINE PIO_TF_Get_nc_iotypes(iotypes, iotype_descs, num_iotypes) iotype_descs(i) = "NETCDF4P" i = i + 1 #else -#ifdef _NETCDF - ! netcdf + ! netcdf is always present. iotypes(i) = PIO_iotype_netcdf iotype_descs(i) = "NETCDF" i = i + 1 -#endif #endif END SUBROUTINE @@ -416,11 +412,9 @@ SUBROUTINE PIO_TF_Get_iotypes(iotypes, iotype_descs, num_iotypes) ! netcdf, netcdf4p, netcdf4c num_iotypes = num_iotypes + 3 #else -#ifdef _NETCDF - ! netcdf + ! netcdf is always present. num_iotypes = num_iotypes + 1 #endif -#endif #ifdef _PNETCDF ! pnetcdf num_iotypes = num_iotypes + 1 @@ -449,12 +443,10 @@ SUBROUTINE PIO_TF_Get_iotypes(iotypes, iotype_descs, num_iotypes) iotype_descs(i) = "NETCDF4P" i = i + 1 #else -#ifdef _NETCDF - ! netcdf + ! netcdf is always present. iotypes(i) = PIO_iotype_netcdf iotype_descs(i) = "NETCDF" i = i + 1 -#endif #endif END SUBROUTINE From 8a82deae20032f15fd750ed3da83cf888d811177 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 17 Aug 2020 07:17:05 -0600 Subject: [PATCH 4/7] removed more unneeded pre-processor stuff --- examples/basic/gdecomp_mod.F90 | 4 --- examples/basic/testpio.F90 | 4 --- tests/general/util/pio_tutil.F90 | 52 -------------------------------- tests/unit/driver.F90 | 7 ----- 4 files changed, 67 deletions(-) diff --git a/examples/basic/gdecomp_mod.F90 b/examples/basic/gdecomp_mod.F90 index e4f1921452e..b5b41407ad3 100644 --- a/examples/basic/gdecomp_mod.F90 +++ b/examples/basic/gdecomp_mod.F90 @@ -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 @@ -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) @@ -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 diff --git a/examples/basic/testpio.F90 b/examples/basic/testpio.F90 index 2a6e62e427a..d93d4e27521 100644 --- a/examples/basic/testpio.F90 +++ b/examples/basic/testpio.F90 @@ -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 diff --git a/tests/general/util/pio_tutil.F90 b/tests/general/util/pio_tutil.F90 index c5e3383f64f..971f10fe055 100644 --- a/tests/general/util/pio_tutil.F90 +++ b/tests/general/util/pio_tutil.F90 @@ -351,14 +351,6 @@ SUBROUTINE PIO_TF_Get_undef_nc_iotypes(iotypes, iotype_descs, num_iotypes) num_iotypes = 0 ! First find the number of io types -#ifndef _NETCDF - ! netcdf - num_iotypes = num_iotypes + 1 -#ifndef _NETCDF4 - ! netcdf4p, netcdf4c - num_iotypes = num_iotypes + 2 -#endif -#endif #ifndef _PNETCDF ! pnetcdf num_iotypes = num_iotypes + 1 @@ -374,21 +366,6 @@ SUBROUTINE PIO_TF_Get_undef_nc_iotypes(iotypes, iotype_descs, num_iotypes) iotypes(i) = PIO_iotype_pnetcdf iotype_descs(i) = "PNETCDF" i = i + 1 -#endif -#ifndef _NETCDF - ! netcdf - iotypes(i) = PIO_iotype_netcdf - iotype_descs(i) = "NETCDF" - i = i + 1 -#ifndef _NETCDF4 - ! netcdf4p, netcdf4c - iotypes(i) = PIO_iotype_netcdf4c - iotype_descs(i) = "NETCDF4C" - i = i + 1 - iotypes(i) = PIO_iotype_netcdf4p - iotype_descs(i) = "NETCDF4P" - i = i + 1 -#endif #endif END SUBROUTINE @@ -468,14 +445,6 @@ SUBROUTINE PIO_TF_Get_undef_iotypes(iotypes, iotype_descs, num_iotypes) ! First find the number of io types num_iotypes = 0 -#ifndef _NETCDF - ! netcdf - num_iotypes = num_iotypes + 1 -#ifndef _NETCDF4 - ! netcdf4p, netcdf4c - num_iotypes = num_iotypes + 2 -#endif -#endif #ifndef _PNETCDF ! pnetcdf num_iotypes = num_iotypes + 1 @@ -486,27 +455,6 @@ SUBROUTINE PIO_TF_Get_undef_iotypes(iotypes, iotype_descs, num_iotypes) ALLOCATE(iotype_descs(num_iotypes)) i = 1 -#ifndef _NETCDF - ! netcdf - iotypes(i) = PIO_iotype_netcdf - iotype_descs(i) = "NETCDF" - i = i + 1 -#ifndef _PNETCDF - ! pnetcdf - iotypes(i) = PIO_iotype_pnetcdf - iotype_descs(i) = "PNETCDF" - i = i + 1 -#endif -#ifndef _NETCDF4 - ! netcdf4p, netcdf4c - iotypes(i) = PIO_iotype_netcdf4c - iotype_descs(i) = "NETCDF4C" - i = i + 1 - iotypes(i) = PIO_iotype_netcdf4p - iotype_descs(i) = "NETCDF4P" - i = i + 1 -#endif -#endif END SUBROUTINE ! Returns a list of PIO base types diff --git a/tests/unit/driver.F90 b/tests/unit/driver.F90 index d3f3a83fd7c..6764b875595 100644 --- a/tests/unit/driver.F90 +++ b/tests/unit/driver.F90 @@ -64,13 +64,6 @@ Program pio_unit_test_driver ! Ignore namelist values if PIO not built with correct options ! (i.e. don't test pnetcdf if not built with pnetcdf) -#ifndef _NETCDF - if (ltest_netcdf) then - write(*,"(A,1x,A)") "WARNING: can not test netcdf files because PIO", & - "was not compiled with -D_NETCDF" - ltest_netcdf = .false. - end if -#endif #ifndef _NETCDF4 if (ltest_netcdf4p) then write(*,"(A,1x,A)") "WARNING: can not test netcdf4p files because PIO", & From 1ac844fffff6994f1e8e6bb44ece7f07974e2258 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 17 Aug 2020 07:20:32 -0600 Subject: [PATCH 5/7] removed more unneeded pre-processor stuff --- src/flib/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flib/Makefile.am b/src/flib/Makefile.am index 27ec676c097..abb541fdde7 100644 --- a/src/flib/Makefile.am +++ b/src/flib/Makefile.am @@ -7,7 +7,7 @@ # The library we are building. lib_LTLIBRARIES = libpiof.la -AM_CPPFLAGS = -D_NETCDF -D_NETCDF4 -D_PNETCDF +AM_CPPFLAGS = -D_NETCDF4 -D_PNETCDF # These linker flags specify libtool version info. # See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning From 85edfb8279ae6b6f34f6228843f6372d9d7ca1dc Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 17 Aug 2020 07:46:01 -0600 Subject: [PATCH 6/7] removed more unneeded pre-processor stuff --- configure.ac | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 1b5e7e4b720..da60e1afe21 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) @@ -224,14 +225,6 @@ if test "x$enable_docs" = xyes; then AC_CONFIG_FILES([doc/Doxyfile]) fi -AC_MSG_NOTICE([setting flags]) - -# We must have MPI to build PIO. -AC_DEFINE([HAVE_MPI], [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. From b258478c3cb29b6d038248c26d0793881e8fb61f Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 17 Aug 2020 08:11:01 -0600 Subject: [PATCH 7/7] removed troublesome strnlen() function --- tests/cunit/test_iosystem3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cunit/test_iosystem3.c b/tests/cunit/test_iosystem3.c index 1c91b00c5c4..e63c7e38c67 100644 --- a/tests/cunit/test_iosystem3.c +++ b/tests/cunit/test_iosystem3.c @@ -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; @@ -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);