Skip to content

Commit

Permalink
Add mixed precision (#52)
Browse files Browse the repository at this point in the history
* Removing OVERLOAD_R4s in mpp and fms2_io

* Removing #ifdef OVERLOAD_R4 and associated #endif in severl Fortran F90 and inc files.

* Added test function for mpp_scatter. Extracted mpp_gather tests into their own file (test_mpp_gatscat.F90)
also has the test for mpp_scatter. Added comments to interface in mpp_scatter.h.

* Added mpp scatter 3D test.

* Add mixed precision (#34)

* Removing OVERLOAD_R4s in mpp and fms2_io

* Removing #ifdef OVERLOAD_R4 and associated #endif in severl Fortran F90 and inc files.

removed OVERLOAD_R4 ifdefs surrounding mpp_update_domains interfaces

added test_mpp_update_domains.F90

added module file compare_checksums with interface routines for 2d and 3d 32-bit and 64-bit real arrays
created two routines test_halo_update_r8 and test_halo_update_r4 to peform the tests for updating domains for 64-bit and 32-bit real arrays in test_mpp_update_domains.F90

removed #idef OVERLOAD_R4 blocks around routines that mpp_update_domains requires
renamed compare_checksums to compare_data_checksums
added missing variable definitions and modules to test files
updated test_fms mpp makefile with new test

commented out OVERLOAD_R4 ifdef blocks around mpp_chksum routines and definitions in mpp files
added module fill_halo with routines to fill halos for 32-bit and 64-bit arrays on different grids
updated makefile.am in test_fms/mpp with dependency defintions for test_mpp_update_domains

increased stack_max, decreased nx, ny, nz, add calls to mpp_pe, mpp_npes, and mpp_set_domains_stacksize to test_mpp_update_domains.F90, got rid of the single-pe test because og test requires more than 1 pe

added calls to read in the mpp_nml section from input.nml to change the request_multiply parameter

updated test runscript to read in mpp namelist parameter
added calls to initialize and read input namelist to main program
added debugging statements to mpp_transmit
increased hard-coded request_multiply value in mpp.F90

reverted some debugging changes, moved the #include fms_platform.h statement

removed spaces, added missing #endif back to mpp_domains_misc.inc

removed OVERLOAD_R4 ifdefs surrounding mpp_update_domains interfaces

added test_mpp_update_domains.F90

added module file compare_checksums with interface routines for 2d and 3d 32-bit and 64-bit real arrays
created two routines test_halo_update_r8 and test_halo_update_r4 to peform the tests for updating domains for 64-bit and 32-bit real arrays in test_mpp_update_domains.F90

removed #idef OVERLOAD_R4 blocks around routines that mpp_update_domains requires
renamed compare_checksums to compare_data_checksums
added missing variable definitions and modules to test files
updated test_fms mpp makefile with new test

commented out OVERLOAD_R4 ifdef blocks around mpp_chksum routines and definitions in mpp files
added module fill_halo with routines to fill halos for 32-bit and 64-bit arrays on different grids
updated makefile.am in test_fms/mpp with dependency defintions for test_mpp_update_domains

increased stack_max, decreased nx, ny, nz, add calls to mpp_pe, mpp_npes, and mpp_set_domains_stacksize to test_mpp_update_domains.F90, got rid of the single-pe test because og test requires more than 1 pe

added calls to read in the mpp_nml section from input.nml to change the request_multiply parameter

updated test runscript to read in mpp namelist parameter
added calls to initialize and read input namelist to main program
added debugging statements to mpp_transmit
increased hard-coded request_multiply value in mpp.F90

reverted some debugging changes, moved the #include fms_platform.h statement

removed spaces, added missing #endif back to mpp_domains_misc.inc

removed debugging statements from mpp_transmit_mpi.h
removed namelist read procedure from test_mpp_update_domains
changed the mpp_init argument to mpp_init_test_requests_allocated
changed pe counts to 1,2 (if available), and 10 (if availables) in test_mpp_update_domains.sh

removed debugging statements in mpp_transmit_mpi.h

removed test_halo_update and test_subset_update from test_mpp_domains
added test_subset_update_r4 and test_subset_update_r8 to test_mpp_update_domains
changed the 10-pe test to 16 pes to accommodate the test_subset_update tests

expanded test_subset_update checksum comments in test_mpp_update_domains

remove the namelist creation in test_mpp_update_domains.sh

fixed spacing, enabled masked test_halo_update tests

* Fixing comment in mpp_scatter.h. Part of adding new scatter 3D unit test.

* Added test_scatter_3D with double kind. Updated documentation.

* Adding changes based on j.l. PR review.

* Deleting some lines that were already commented out. Mostly debug/print lines.

* Changed comments to doxygen style. Moved legacy test_mpp_gather2DV routine to
original form. Added two todo comments.

* Adding inital version of test_mpp_sendrecv.F90. R4 version only!

* Adding inital version of test_mpp_sendrecv.F90. R4 version only!

* Switching to use platform_mod in test_mpp_gatscat.F90.

* Added R8 versions of tests. Changed to use platform_mod.

* Completed forst working version of test_mpp_sendrecv with R4 and R8 variables.

* Removed and improved comments in  test_mpp_sendrecv.F90.

Co-authored-by: Jess <20195932+wrongkindofdoctor@users.noreply.github.com>
  • Loading branch information
2 people authored and wrongkindofdoctor committed Oct 21, 2020
1 parent dd27f57 commit d5ef7ba
Show file tree
Hide file tree
Showing 4 changed files with 448 additions and 21 deletions.
11 changes: 8 additions & 3 deletions test_fms/mpp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ check_PROGRAMS = test_mpp \
test_mpp_gatscat \
test_mpp_sum \
test_update_domains_performance \
test_minmax
test_minmax \
test_mpp_sendrecv

# These are the sources for the tests.
test_mpp_SOURCES = test_mpp.F90
Expand All @@ -83,6 +84,7 @@ test_mpp_pe_SOURCES = test_mpp_pe.F90
test_mpp_root_pe_SOURCES=test_mpp_root_pe.F90
test_peset_SOURCES=test_peset.F90
test_mpp_gatscat_SOURCES=test_mpp_gatscat.F90
test_mpp_sendrecv_SOURCES=test_mpp_sendrecv.F90
test_mpp_update_domains_SOURCES = test_mpp_update_domains.F90 \
fill_halo.F90 compare_data_checksums.F90
test_mpp_sum_SOURCES=test_mpp_sum.F90
Expand Down Expand Up @@ -114,7 +116,8 @@ TESTS = test_mpp_domains2.sh \
test_mpp_sum.sh \
test_mpp_gatscat.sh \
test_update_domains_performance.sh \
test_minmax.sh
test_minmax.sh \
test_mpp_sendrecv.sh

# These files will also be included in the distribution.
EXTRA_DIST = input_base.nml \
Expand Down Expand Up @@ -143,7 +146,9 @@ EXTRA_DIST = input_base.nml \
test_mpp_sum.sh \
test_mpp_gatscat.sh \
test_update_domains_performance.sh \
test_minmax.sh
test_minmax.sh \
test_mpp_sendrecv.sh


compare_data_checksums.mod : compare_data_checksums.$(OBJEXT)
fill_halo.mod : fill_halo.$(OBJEXT)
Expand Down
32 changes: 14 additions & 18 deletions test_fms/mpp/test_mpp_gatscat.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
!> @note Some of the tested mpp_gather routines are legavy routines originally in file test_mpp.F90.
!> @todo Routine test_gather_2DV is a legacy routine with legacy issues. See associated comments.
program test_mpp_gatscat
#include <fms_platform.h>

#ifdef sgi_mipspro
use shmem_interface
Expand All @@ -37,6 +36,7 @@ program test_mpp_gatscat
use mpp_mod, only : mpp_gather, mpp_scatter, mpp_error, FATAL
use mpp_io_mod, only: mpp_io_init, mpp_flush
use mpp_mod, only : mpp_init_test_requests_allocated
use platform_mod

#ifdef use_MPI_GSM
use mpp_mod, only : mpp_gsm_malloc, mpp_gsm_free
Expand All @@ -51,7 +51,7 @@ program test_mpp_gatscat
pointer (locd, d)
#else
real, allocatable, dimension(:) :: d
integer(LONG_KIND) :: locd
integer(kind=i8_kind) :: locd
#endif
integer :: pe, npes, root, istat
integer :: out_unit
Expand Down Expand Up @@ -123,9 +123,8 @@ subroutine test_scatter_2D_R4(npes,pe,root,out_unit)

integer :: pelist(npes)
integer :: i,j,k
real(FLOAT_KIND), allocatable, dimension(:,:) :: data !!Data to be scattered
real(FLOAT_KIND), allocatable, dimension(:,:) :: segment
real(FLOAT_KIND) :: val
real(kind=r4_kind), allocatable, dimension(:,:) :: data !!Data to be scattered
real(kind=r4_kind), allocatable, dimension(:,:) :: segment
integer :: DS, SS !!Source data size and segment size
integer :: iz, jz !!The zeroth element to be scattered is at pos data(is+iz, js+jz)
integer :: is, ie, js, je !!The amount of data to be scattered is (ie - is)*(je - js)
Expand Down Expand Up @@ -230,9 +229,8 @@ subroutine test_scatter_2D_R8(npes,pe,root,out_unit)

integer :: pelist(npes)
integer :: i,j,k
real(DOUBLE_KIND), allocatable, dimension(:,:) :: data !!Data to be scattered
real(DOUBLE_KIND), allocatable, dimension(:,:) :: segment
real(DOUBLE_KIND) :: val
real(kind=r8_kind), allocatable, dimension(:,:) :: data !!Data to be scattered
real(kind=r8_kind), allocatable, dimension(:,:) :: segment
integer :: DS, SS !!Source data size and segment size
integer :: iz, jz !!The zeroth element to be scattered is at pos data(is+iz, js+jz)
integer :: is, ie, js, je !!The amount of data to be scattered is (ie - is)*(je - js)
Expand Down Expand Up @@ -338,9 +336,8 @@ subroutine test_scatter_3D_R4(npes,pe,root,out_unit)

integer :: pelist(npes)
integer :: i,j,k
real(FLOAT_KIND), allocatable, dimension(:,:,:) :: data !!Data to be scattered
real(FLOAT_KIND), allocatable, dimension(:,:,:) :: segment
real(FLOAT_KIND) :: val
real(kind=r4_kind), allocatable, dimension(:,:,:) :: data !!Data to be scattered
real(kind=r4_kind), allocatable, dimension(:,:,:) :: segment
integer :: DS, SS !!Source data size and segment size
integer :: iz, jz !!The zeroth element to be scattered is at pos data(is+iz, js+jz)
integer :: is, ie, js, je !!The amount of data to be scattered is (ie - is)*(je - js)
Expand Down Expand Up @@ -469,9 +466,8 @@ subroutine test_scatter_3D_R8(npes,pe,root,out_unit)

integer :: pelist(npes)
integer :: i,j,k
real(DOUBLE_KIND), allocatable, dimension(:,:,:) :: data !!Data to be scattered
real(DOUBLE_KIND), allocatable, dimension(:,:,:) :: segment
real(DOUBLE_KIND) :: val
real(kind=r8_kind), allocatable, dimension(:,:,:) :: data !!Data to be scattered
real(kind=r8_kind), allocatable, dimension(:,:,:) :: segment
integer :: DS, SS !!Source data size and segment size
integer :: iz, jz !!The zeroth element to be scattered is at pos data(is+iz, js+jz)
integer :: is, ie, js, je !!The amount of data to be scattered is (ie - is)*(je - js)
Expand Down Expand Up @@ -616,8 +612,8 @@ subroutine test_gather_R4(npes,pe,root,out_unit)

integer :: pelist(npes)
integer :: i
real(FLOAT_KIND) :: rdata(npes)
real(FLOAT_KIND) :: val
real(kind=r4_kind) :: rdata(npes)
real(kind=r4_kind) :: val

if(npes < 3)then
call mpp_error(FATAL, "Test_gather: minimum of 3 ranks required. Not testing gather; too few ranks.")
Expand Down Expand Up @@ -665,8 +661,8 @@ subroutine test_gather_R8(npes,pe,root,out_unit)

integer :: pelist(npes)
integer :: i
real(DOUBLE_KIND) :: rdata(npes)
real(DOUBLE_KIND) :: val
real(kind=r8_kind) :: rdata(npes)
real(kind=r8_kind) :: val

if(npes < 3)then
call mpp_error(FATAL, "Test_gather: minimum of 3 ranks required. Not testing gather; too few ranks.")
Expand Down
Loading

0 comments on commit d5ef7ba

Please sign in to comment.