Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fortran docs #260

Merged
merged 3 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions src/fortran/client.F90
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ 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=c_int8_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(client_type), intent(in) :: self !< Fortran SmartRedis 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
integer(kind=enum_kind) :: code

include 'client/put_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -419,6 +424,11 @@ 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=c_int16_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(client_type), intent(in) :: self !< Fortran SmartRedis 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
integer(kind=enum_kind) :: code

include 'client/put_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -430,6 +440,11 @@ 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=c_int32_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(client_type), intent(in) :: self !< Fortran SmartRedis 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
integer(kind=enum_kind) :: code

include 'client/put_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -441,6 +456,11 @@ 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=c_int64_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(client_type), intent(in) :: self !< Fortran SmartRedis 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
integer(kind=enum_kind) :: code

include 'client/put_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -452,6 +472,11 @@ 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=c_float), dimension(..), target, intent(in) :: data !< Data to be sent
class(client_type), intent(in) :: self !< Fortran SmartRedis 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
integer(kind=enum_kind) :: code

include 'client/put_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -463,6 +488,11 @@ 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=c_double), dimension(..), target, intent(in) :: data !< Data to be sent
class(client_type), intent(in) :: self !< Fortran SmartRedis 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
integer(kind=enum_kind) :: code

include 'client/put_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -474,6 +504,11 @@ 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=c_int8_t), dimension(..), target, intent(out) :: result !< Data to be sent
class(client_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
integer(kind=enum_kind) :: code

include 'client/unpack_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -485,6 +520,11 @@ 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=c_int16_t), dimension(..), target, intent(out) :: result !< Data to be sent
class(client_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
integer(kind=enum_kind) :: code

include 'client/unpack_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -496,6 +536,11 @@ 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=c_int32_t), dimension(..), target, intent(out) :: result !< Data to be sent
class(client_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
integer(kind=enum_kind) :: code

include 'client/unpack_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -507,6 +552,11 @@ 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=c_int64_t), dimension(..), target, intent(out) :: result !< Data to be sent
class(client_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
integer(kind=enum_kind) :: code

include 'client/unpack_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -518,6 +568,11 @@ 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=c_float), dimension(..), target, intent(out) :: result !< Data to be sent
class(client_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
integer(kind=enum_kind) :: code

include 'client/unpack_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -529,6 +584,11 @@ 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=c_double), dimension(..), target, intent(out) :: result !< Data to be sent
class(client_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
integer(kind=enum_kind) :: code

include 'client/unpack_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand Down
5 changes: 0 additions & 5 deletions src/fortran/client/put_tensor_methods_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@

!** Beginning of code common to all put_tensor subroutines

class(client_type), intent(in) :: self !< Fortran SLIC 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
integer(kind=enum_kind) :: code

! Local variables
integer(kind=c_size_t) :: c_n_dims ! Number of dimensions
type(c_ptr) :: data_ptr, c_dims_ptr
Expand Down
5 changes: 0 additions & 5 deletions src/fortran/client/unpack_tensor_methods_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@

!** Beginning of code common to all unpack_tensor subroutines

class(client_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
integer(kind=enum_kind) :: code

! Local variables
integer(kind=c_size_t) :: ndim ! Number of dimensions
type(c_ptr) :: data_ptr, c_dims_ptr
Expand Down
60 changes: 60 additions & 0 deletions src/fortran/dataset.F90
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ end function initialize_dataset
!> Add a tensor to a dataset whose Fortran type is the equivalent 'int8' C-type
function add_tensor_i8(self, name, data, dims) result(code)
integer(kind=c_int8_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(dataset_type), intent(in) :: self !< Fortran SmartRedis dataset
character(len=*), intent(in) :: name !< The unique name used to store in the database
integer, dimension(:), intent(in) :: dims !< The length of each dimension
integer(kind=enum_kind) :: code !< Result of the operation

include 'dataset/add_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -124,6 +129,11 @@ end function add_tensor_i8
!> Add a tensor to a dataset whose Fortran type is the equivalent 'int16' C-type
function add_tensor_i16(self, name, data, dims) result(code)
integer(kind=c_int16_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(dataset_type), intent(in) :: self !< Fortran SmartRedis dataset
character(len=*), intent(in) :: name !< The unique name used to store in the database
integer, dimension(:), intent(in) :: dims !< The length of each dimension
integer(kind=enum_kind) :: code !< Result of the operation

include 'dataset/add_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -135,6 +145,11 @@ end function add_tensor_i16
!> Add a tensor to a dataset whose Fortran type is the equivalent 'int32' C-type
function add_tensor_i32(self, name, data, dims) result(code)
integer(kind=c_int32_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(dataset_type), intent(in) :: self !< Fortran SmartRedis dataset
character(len=*), intent(in) :: name !< The unique name used to store in the database
integer, dimension(:), intent(in) :: dims !< The length of each dimension
integer(kind=enum_kind) :: code !< Result of the operation

include 'dataset/add_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -146,6 +161,11 @@ end function add_tensor_i32
!> Add a tensor to a dataset whose Fortran type is the equivalent 'int64' C-type
function add_tensor_i64(self, name, data, dims) result(code)
integer(kind=c_int64_t), dimension(..), target, intent(in) :: data !< Data to be sent
class(dataset_type), intent(in) :: self !< Fortran SmartRedis dataset
character(len=*), intent(in) :: name !< The unique name used to store in the database
integer, dimension(:), intent(in) :: dims !< The length of each dimension
integer(kind=enum_kind) :: code !< Result of the operation

include 'dataset/add_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -157,6 +177,11 @@ end function add_tensor_i64
!> Add a tensor to a dataset whose Fortran type is the equivalent 'float' C-type
function add_tensor_float(self, name, data, dims) result(code)
real(kind=c_float), dimension(..), target, intent(in) :: data !< Data to be sent
class(dataset_type), intent(in) :: self !< Fortran SmartRedis dataset
character(len=*), intent(in) :: name !< The unique name used to store in the database
integer, dimension(:), intent(in) :: dims !< The length of each dimension
integer(kind=enum_kind) :: code !< Result of the operation

include 'dataset/add_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -168,6 +193,11 @@ end function add_tensor_float
!> Add a tensor to a dataset whose Fortran type is the equivalent 'double' C-type
function add_tensor_double(self, name, data, dims) result(code)
real(kind=c_double), dimension(..), target, intent(in) :: data !< Data to be sent
class(dataset_type), intent(in) :: self !< Fortran SmartRedis dataset
character(len=*), intent(in) :: name !< The unique name used to store in the database
integer, dimension(:), intent(in) :: dims !< The length of each dimension
integer(kind=enum_kind) :: code !< Result of the operation

include 'dataset/add_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -180,6 +210,11 @@ end function add_tensor_double
!> Unpack a tensor into already allocated memory whose Fortran type is the equivalent 'int8' C-type
function unpack_dataset_tensor_i8(self, name, result, dims) result(code)
integer(kind=c_int8_t), dimension(..), target, intent(out) :: result !< Array to be populated with data
class(dataset_type), intent(in) :: self !< Pointer to the initialized dataset
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
integer(kind=enum_kind) :: code

include 'dataset/unpack_dataset_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -191,6 +226,11 @@ end function unpack_dataset_tensor_i8
!> Unpack a tensor into already allocated memory whose Fortran type is the equivalent 'int16' C-type
function unpack_dataset_tensor_i16(self, name, result, dims) result(code)
integer(kind=c_int16_t), dimension(..), target, intent(out) :: result !< Array to be populated with data
class(dataset_type), intent(in) :: self !< Pointer to the initialized dataset
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
integer(kind=enum_kind) :: code

include 'dataset/unpack_dataset_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -202,6 +242,11 @@ end function unpack_dataset_tensor_i16
!> Unpack a tensor into already allocated memory whose Fortran type is the equivalent 'int32' C-type
function unpack_dataset_tensor_i32(self, name, result, dims) result(code)
integer(kind=c_int32_t), dimension(..), target, intent(out) :: result !< Array to be populated with data
class(dataset_type), intent(in) :: self !< Pointer to the initialized dataset
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
integer(kind=enum_kind) :: code

include 'dataset/unpack_dataset_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -213,6 +258,11 @@ end function unpack_dataset_tensor_i32
!> Unpack a tensor into already allocated memory whose Fortran type is the equivalent 'int64' C-type
function unpack_dataset_tensor_i64(self, name, result, dims) result(code)
integer(kind=c_int64_t), dimension(..), target, intent(out) :: result !< Array to be populated with data
class(dataset_type), intent(in) :: self !< Pointer to the initialized dataset
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
integer(kind=enum_kind) :: code

include 'dataset/unpack_dataset_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -224,6 +274,11 @@ end function unpack_dataset_tensor_i64
!> Unpack a tensor into already allocated memory whose Fortran type is the equivalent 'float' C-type
function unpack_dataset_tensor_float(self, name, result, dims) result(code)
real(kind=c_float), dimension(..), target, intent(out) :: result !< Array to be populated with data
class(dataset_type), intent(in) :: self !< Pointer to the initialized dataset
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
integer(kind=enum_kind) :: code

include 'dataset/unpack_dataset_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand All @@ -235,6 +290,11 @@ end function unpack_dataset_tensor_float
!> Unpack a tensor into already allocated memory whose Fortran type is the equivalent 'double' C-type
function unpack_dataset_tensor_double(self, name, result, dims) result(code)
real(kind=c_double), dimension(..), target, intent(out) :: result !< Array to be populated with data
class(dataset_type), intent(in) :: self !< Pointer to the initialized dataset
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
integer(kind=enum_kind) :: code

include 'dataset/unpack_dataset_tensor_methods_common.inc'

! Define the type and call the C-interface
Expand Down
4 changes: 0 additions & 4 deletions src/fortran/dataset/add_tensor_methods_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@

!** Beginning of code common to all add_tensor subroutines

class(dataset_type), intent(in) :: self !< Fortran SLIC dataset
character(len=*), intent(in) :: name !< The unique name used to store in the database
integer, dimension(:), intent(in) :: dims !< The length of each dimension
integer(kind=enum_kind) :: code !< Result of the operation
! Local variables
integer(kind=c_size_t) :: c_n_dims ! Number of dimensions
type(c_ptr) :: data_ptr, c_dims_ptr
Expand Down
5 changes: 0 additions & 5 deletions src/fortran/dataset/unpack_dataset_tensor_methods_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@

!** Beginning of code common to all unpack_dataset_tensor subroutines

class(dataset_type), intent(in) :: self !< Pointer to the initialized dataset
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
integer(kind=enum_kind) :: code

! Local variables
integer(kind=c_size_t) :: ndim ! Number of dimensions
type(c_ptr) :: data_ptr, c_dims_ptr
Expand Down
Loading