From 3b3dc009cc82a2314900c31f2cfff964c7c46080 Mon Sep 17 00:00:00 2001 From: Andrew Shao Date: Thu, 4 Aug 2022 09:18:23 -0700 Subject: [PATCH] Remove references to Fortran 2018 features The database client interface code used assumed rank notation introduced in Fortran 2018 to avoid needing to duplicate intefaces for 1-7 dimensional arrays. However, MOM6 ostensibly accept only up to Fortran 2008 features and moreover, the inclusion of this new language feature breaks compilation by PGI. This is overcome by changing the declaration to assumed size. For the purposes of compatability with SmartRedis, this change is still consistent with the implementations of the affected routines. --- config_src/external/database_comms/README.md | 7 +++-- .../database_client_interface.F90 | 30 +++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/config_src/external/database_comms/README.md b/config_src/external/database_comms/README.md index 53a06b0a4a..dc541abc96 100644 --- a/config_src/external/database_comms/README.md +++ b/config_src/external/database_comms/README.md @@ -14,10 +14,11 @@ code in the new implementation is part of `MOM_MEKE.F90`. # File description -- `MOM_database_comms` contains just method signatures and elements of the +- `MOM_database_comms.F90` contains just method signatures and elements of the control structure that are imported elsewhere within the primary MOM6 code. This includes: `dbcomms_CS_type`, `dbclient_type`, and `database_comms_init` -- `smartredis_client.F90` is a skeleton of the actual SmartRedis library - used to ensure that the interfaces to the library are maintained without +- `database_client_interface.F90` is a skeleton of the a database client library + (for now nominally based on the SmartRedis library). These are included here + so that interfaces to the library can be checked at compile-time without requiring MOM6 users to compile in the the full library diff --git a/config_src/external/database_comms/database_client_interface.F90 b/config_src/external/database_comms/database_client_interface.F90 index f6a8f9ed1f..958aec1140 100644 --- a/config_src/external/database_comms/database_client_interface.F90 +++ b/config_src/external/database_comms/database_client_interface.F90 @@ -17,10 +17,10 @@ module database_client_interface contains ! Public procedures - !> Puts a tensor into the database (overloaded) + !> Puts a tensor into the database for a variety of datatypes generic :: put_tensor => put_tensor_i8, put_tensor_i16, put_tensor_i32, put_tensor_i64, & put_tensor_float, put_tensor_double - !> Retrieve the tensor in the database into already allocated memory (overloaded) + !> Retrieve the tensor in the database into already allocated memory for a variety of datatypesm generic :: unpack_tensor => unpack_tensor_i8, unpack_tensor_i16, unpack_tensor_i32, unpack_tensor_i64, & unpack_tensor_float, unpack_tensor_double @@ -126,7 +126,7 @@ module database_client_interface procedure :: poll_list_length_gte !> Repeatedly check the length of the list until it less than or equal to the given size procedure :: poll_list_length_lte - !> Retrieve vector of datasetes from the list + !> Retrieve vector of datasets from the list procedure :: get_datasets_from_list ! Private procedures @@ -269,7 +269,7 @@ end function poll_key !> Put a tensor whose Fortran type is the equivalent 'int8' C-type function put_tensor_i8(self, name, data, dims) result(code) - integer(kind=int8), dimension(..), target, intent(in) :: data !< Data to be sent + integer(kind=int8), dimension(*), target, intent(in) :: data !< Data to be sent class(dbclient_type), intent(in) :: self !< Fortran communication client character(len=*), intent(in) :: name !< The unique name used to store in the database integer, dimension(:), intent(in) :: dims !< The length of each dimension @@ -280,7 +280,7 @@ end function put_tensor_i8 !> Put a tensor whose Fortran type is the equivalent 'int16' C-type function put_tensor_i16(self, name, data, dims) result(code) - integer(kind=int16), dimension(..), target, intent(in) :: data !< Data to be sent + integer(kind=int16), dimension(*), target, intent(in) :: data !< Data to be sent class(dbclient_type), intent(in) :: self !< Fortran communication client character(len=*), intent(in) :: name !< The unique name used to store in the database integer, dimension(:), intent(in) :: dims !< The length of each dimension @@ -291,7 +291,7 @@ end function put_tensor_i16 !> Put a tensor whose Fortran type is the equivalent 'int32' C-type function put_tensor_i32(self, name, data, dims) result(code) - integer(kind=int32), dimension(..), target, intent(in) :: data !< Data to be sent + integer(kind=int32), dimension(*), target, intent(in) :: data !< Data to be sent class(dbclient_type), intent(in) :: self !< Fortran communication client character(len=*), intent(in) :: name !< The unique name used to store in the database integer, dimension(:), intent(in) :: dims !< The length of each dimension @@ -302,7 +302,7 @@ end function put_tensor_i32 !> Put a tensor whose Fortran type is the equivalent 'int64' C-type function put_tensor_i64(self, name, data, dims) result(code) - integer(kind=int64), dimension(..), target, intent(in) :: data !< Data to be sent + integer(kind=int64), dimension(*), target, intent(in) :: data !< Data to be sent class(dbclient_type), intent(in) :: self !< Fortran communication client character(len=*), intent(in) :: name !< The unique name used to store in the database integer, dimension(:), intent(in) :: dims !< The length of each dimension @@ -313,7 +313,7 @@ end function put_tensor_i64 !> Put a tensor whose Fortran type is the equivalent 'float' C-type function put_tensor_float(self, name, data, dims) result(code) - real(kind=real32), dimension(..), target, intent(in) :: data !< Data to be sent + real(kind=real32), dimension(*), target, intent(in) :: data !< Data to be sent class(dbclient_type), intent(in) :: self !< Fortran communication client character(len=*), intent(in) :: name !< The unique name used to store in the database integer, dimension(:), intent(in) :: dims !< The length of each dimension @@ -324,7 +324,7 @@ end function put_tensor_float !> Put a tensor whose Fortran type is the equivalent 'double' C-type function put_tensor_double(self, name, data, dims) result(code) - real(kind=real64), dimension(..), target, intent(in) :: data !< Data to be sent + real(kind=real64), dimension(*), target, intent(in) :: data !< Data to be sent class(dbclient_type), intent(in) :: self !< Fortran communication client character(len=*), intent(in) :: name !< The unique name used to store in the database integer, dimension(:), intent(in) :: dims !< The length of each dimension @@ -335,7 +335,7 @@ end function put_tensor_double !> Put a tensor whose Fortran type is the equivalent 'int8' C-type function unpack_tensor_i8(self, name, result, dims) result(code) - integer(kind=int8), dimension(..), target, intent(out) :: result !< Data to be sent + integer(kind=int8), dimension(*), target, intent(out) :: result !< Data to be sent class(dbclient_type), intent(in) :: self !< Pointer to the initialized client character(len=*), intent(in) :: name !< The name to use to place the tensor integer, dimension(:), intent(in) :: dims !< Length along each dimension of the tensor @@ -346,7 +346,7 @@ end function unpack_tensor_i8 !> Put a tensor whose Fortran type is the equivalent 'int16' C-type function unpack_tensor_i16(self, name, result, dims) result(code) - integer(kind=int16), dimension(..), target, intent(out) :: result !< Data to be sent + integer(kind=int16), dimension(*), target, intent(out) :: result !< Data to be sent class(dbclient_type), intent(in) :: self !< Pointer to the initialized client character(len=*), intent(in) :: name !< The name to use to place the tensor integer, dimension(:), intent(in) :: dims !< Length along each dimension of the tensor @@ -357,7 +357,7 @@ end function unpack_tensor_i16 !> Put a tensor whose Fortran type is the equivalent 'int32' C-type function unpack_tensor_i32(self, name, result, dims) result(code) - integer(kind=int32), dimension(..), target, intent(out) :: result !< Data to be sent + integer(kind=int32), dimension(*), target, intent(out) :: result !< Data to be sent class(dbclient_type), intent(in) :: self !< Pointer to the initialized client character(len=*), intent(in) :: name !< The name to use to place the tensor integer, dimension(:), intent(in) :: dims !< Length along each dimension of the tensor @@ -368,7 +368,7 @@ end function unpack_tensor_i32 !> Put a tensor whose Fortran type is the equivalent 'int64' C-type function unpack_tensor_i64(self, name, result, dims) result(code) - integer(kind=int64), dimension(..), target, intent(out) :: result !< Data to be sent + integer(kind=int64), dimension(*), target, intent(out) :: result !< Data to be sent class(dbclient_type), intent(in) :: self !< Pointer to the initialized client character(len=*), intent(in) :: name !< The name to use to place the tensor integer, dimension(:), intent(in) :: dims !< Length along each dimension of the tensor @@ -379,7 +379,7 @@ end function unpack_tensor_i64 !> Put a tensor whose Fortran type is the equivalent 'float' C-type function unpack_tensor_float(self, name, result, dims) result(code) - real(kind=real32), dimension(..), target, intent(out) :: result !< Data to be sent + real(kind=real32), dimension(*), target, intent(out) :: result !< Data to be sent class(dbclient_type), intent(in) :: self !< Pointer to the initialized client character(len=*), intent(in) :: name !< The name to use to place the tensor integer, dimension(:), intent(in) :: dims !< Length along each dimension of the tensor @@ -390,7 +390,7 @@ end function unpack_tensor_float !> Put a tensor whose Fortran type is the equivalent 'double' C-type function unpack_tensor_double(self, name, result, dims) result(code) - real(kind=real64), dimension(..), target, intent(out) :: result !< Data to be sent + real(kind=real64), dimension(*), target, intent(out) :: result !< Data to be sent class(dbclient_type), intent(in) :: self !< Pointer to the initialized client character(len=*), intent(in) :: name !< The name to use to place the tensor integer, dimension(:), intent(in) :: dims !< Length along each dimension of the tensor