Skip to content

Commit

Permalink
moving fortran ncint functions to their own mod file
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jul 13, 2019
1 parent f9a064e commit b35c6bb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 70 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ if test "x$enable_netcdf_integration" = xyes; then
fi

AM_CONDITIONAL(BUILD_NCINT, [test "x$enable_netcdf_integration" = xyes])
AM_CONDITIONAL(NETCDF_INTEGRATION, [test "x$enable_netcdf_integration" = xyes])

AC_CONFIG_FILES([tests/general/pio_tutil.F90:tests/general/util/pio_tutil.F90])

Expand Down
21 changes: 19 additions & 2 deletions src/flib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ libpiof_la_LDFLAGS = -version-info 2:0:1
# The library soure files.
libpiof_la_LIBADD = libpio_nf.la libpio_kinds.la libpio_support.la \
libpiodarray.la libpionfatt.la libpionfget.la libpionfput.la \
libpiolib_mod.la libpio.la
libpiolib_mod.la

if NETCDF_INTEGRATION
libpiof_la_LIBADD += libncint_mod.la
endif
libpiof_la_LIBADD += libpio.la

libpiof_la_SOURCES = pio_types.F90

# Build these uninstalled convenience libraries.
noinst_LTLIBRARIES = libpio_kinds.la libpio_types.la \
libpio_support.la libpio_nf.la libpiodarray.la libpionfatt.la \
libpionfget.la libpionfput.la libpiolib_mod.la libpio.la
if NETCDF_INTEGRATION
noinst_LTLIBRARIES += libncint_mod.la
endif

# The convenience libraries depends on their source.
libpio_kinds_la_SOURCES = pio_kinds.F90
Expand All @@ -36,6 +44,7 @@ libpionfatt_la_SOURCES = pionfatt_mod.F90
libpionfget_la_SOURCES = pionfget_mod.F90
libpionfput_la_SOURCES = pionfput_mod.F90
libpiolib_mod_la_SOURCES = piolib_mod.F90
libncint_mod_la_SOURCES = ncint_mod.F90
libpio_la_SOURCES = pio.F90

# These F90 files are generated from .F90.in files, using the script
Expand All @@ -59,16 +68,24 @@ pionfatt_mod.mod: pionfatt_mod.F90 pionfatt_mod.$(OBJEXT)
pionfget_mod.mod: pionfget_mod.F90 pionfget_mod.$(OBJEXT)
pionfput_mod.mod: pionfput_mod.F90 pionfput_mod.$(OBJEXT)
piolib_mod.mod: piolib_mod.$(OBJEXT)
ncint_mod.mod: ncint_mod.$(OBJEXT)
pio.mod: pio.$(OBJEXT)

# Some mod files depend on other mod files.
pio.$(OBJEXT): pio_kinds.mod piolib_mod.mod pio_types.mod piodarray.mod \
DEPEND_FILES = pio_kinds.mod piolib_mod.mod pio_types.mod piodarray.mod \
pio_nf.mod pionfatt_mod.mod pionfget_mod.mod pionfput_mod.mod pio_support.mod
if NETCDF_INTEGRATION
DEPEND_FILES += ncint_mod.mod
endif
pio.$(OBJEXT): $(DEPEND_FILES)

# Mod files are built and then installed as headers.
MODFILES = pio_kinds.mod pio_types.mod pio_support.mod pio_nf.mod \
piodarray.mod pionfatt_mod.mod pionfget_mod.mod pionfput_mod.mod \
piolib_mod.mod pio.mod
if NETCDF_INTEGRATION
MODFILES += ncint_mod.mod
endif
BUILT_SOURCES = $(MODFILES)
include_HEADERS = $(MODFILES)

Expand Down
10 changes: 4 additions & 6 deletions src/flib/pio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ module pio
pio_freedecomp, pio_syncfile, &
pio_finalize, pio_set_hint, pio_getnumiotasks, pio_file_is_open, &
PIO_deletefile, PIO_get_numiotasks, PIO_iotype_available, &
!#ifdef NETCDF_INTEGRATION
! nf_init_intracom, &
!#endif
pio_set_rearr_opts
! #ifdef NETCDF_INTEGRATION
! nf_init_intracom, &
! #endif

#ifdef NETCDF_INTEGRATION
use ncint_mod, only: nf_init_intracom
#endif

use pio_types, only : io_desc_t, file_desc_t, var_desc_t, iosystem_desc_t, &
pio_rearr_opt_t, pio_rearr_comm_fc_opt_t, pio_rearr_comm_fc_2d_enable,&
Expand Down
62 changes: 0 additions & 62 deletions src/flib/piolib_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ module piolib_mod
PIO_deletefile, &
PIO_get_numiotasks, &
PIO_iotype_available, &
#ifdef NETCDF_INTEGRATION
nf_init_intracom, &
#endif
PIO_set_rearr_opts

!-----------------------------------------------------------------------
Expand Down Expand Up @@ -137,12 +134,6 @@ module piolib_mod
module procedure setframe
end interface PIO_setframe

#ifdef NETCDF_INTEGRATION
interface nf_init_intracom
module procedure nf_init_intracom
end interface nf_init_intracom
#endif

!>
!! Increment the record number for a future read/write of distributed
!! arrays (see @ref PIO_write_darray, @ref PIO_read_darray).
Expand Down Expand Up @@ -981,59 +972,6 @@ end function PIOc_Init_Intracomm_from_F90
#endif
end subroutine init_intracom

#ifdef NETCDF_INTEGRATION
!>
!! @public
!! @ingroup PIO_init
!! Initialize the pio subsystem. This is a collective call. Input
!! parameters are read on comp_rank=0 values on other tasks are
!! ignored. This variation of PIO_init locates the IO tasks on a
!! subset of the compute tasks.
!!
!! @param comp_rank mpi rank of each participating task,
!! @param comp_comm the mpi communicator which defines the
!! collective.
!! @param num_iotasks the number of iotasks to define.
!! @param num_aggregator the mpi aggregator count
!! @param stride the stride in the mpi rank between io tasks.
!! @param rearr @copydoc PIO_rearr_method
!! @param iosystem a derived type which can be used in subsequent
!! pio operations (defined in PIO_types).
!! @param base @em optional argument can be used to offset the first
!! io task - default base is task 1.
!! @param rearr_opts the rearranger options.
!! @author Jim Edwards
!<
subroutine nf_init_intracom(comp_rank, comp_comm, num_iotasks, num_aggregator, stride, rearr, iosystem,base, rearr_opts)
use pio_types, only : pio_internal_error, pio_rearr_opt_t
use iso_c_binding

integer(i4), intent(in) :: comp_rank
integer(i4), intent(in) :: comp_comm
integer(i4), intent(in) :: num_iotasks
integer(i4), intent(in) :: num_aggregator
integer(i4), intent(in) :: stride
integer(i4), intent(in) :: rearr
type (iosystem_desc_t), intent(out) :: iosystem ! io descriptor to initalize
integer(i4), intent(in),optional :: base
type (pio_rearr_opt_t), intent(in), optional :: rearr_opts
integer :: ierr

interface
integer(C_INT) function nc_set_iosystem(iosystemid) &
bind(C,name="nc_set_iosystem")
use iso_c_binding
integer(C_INT), intent(in), value :: iosystemid
end function nc_set_iosystem
end interface

call init_intracom(comp_rank, comp_comm, num_iotasks, num_aggregator, stride, rearr, iosystem,base, rearr_opts)

ierr = nc_set_iosystem(iosystem%iosysid)

end subroutine nf_init_intracom
#endif

!! @public
!! @ingroup PIO_init
!! Initialize the pio subsystem. This is a collective call. Input
Expand Down

0 comments on commit b35c6bb

Please sign in to comment.