|
1234567891011121314151617181920212223242526272829 |
- module TestRedisModule
- contains
- subroutine testRedis
- use iso_c_binding
- use smartredis_client, only : client_type
-
- implicit none
- include "..\sredis\enum_fortran.inc"
- integer, parameter :: dim1 = 10
- integer, parameter :: dim2 = 20
- integer, parameter :: dim3 = 30
- real(kind=8), dimension(dim1, dim2, dim3) :: recv_array_real_64
- real(kind=c_double), dimension(dim1, dim2, dim3) :: send_array_real_64
- integer :: i, j, k, result
- type(client_type) :: client
-
- call random_number(send_array_real_64)
- ! Initialize a client
- result = client%initialize(.true.)!, "smartredis_put_get_3D") ! Change .false. to .true. if not using a clustered database
- if (result .ne. SRNoError) error stop 'client%initialize failed'
- ! Send a tensor to the database via the client and verify that we can retrieve it
- result = client%put_tensor("send_array", send_array_real_64, shape(send_array_real_64))
- if (result .ne. SRNoError) error stop 'client%put_tensor failed'
- result = client%unpack_tensor("send_array", recv_array_real_64, shape(recv_array_real_64))
- if (result .ne. SRNoError) error stop 'client%unpack_tensor failed'
- ! Done
- call exit()
- end subroutine
- end module TestRedisModule
|