Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 line
1.3 KiB

  1. module TestRedisModule
  2. contains
  3. subroutine testRedis
  4. use iso_c_binding
  5. use smartredis_client, only : client_type
  6. implicit none
  7. include "..\sredis\enum_fortran.inc"
  8. integer, parameter :: dim1 = 10
  9. integer, parameter :: dim2 = 20
  10. integer, parameter :: dim3 = 30
  11. real(kind=8), dimension(dim1, dim2, dim3) :: recv_array_real_64
  12. real(kind=c_double), dimension(dim1, dim2, dim3) :: send_array_real_64
  13. integer :: i, j, k, result
  14. type(client_type) :: client
  15. call random_number(send_array_real_64)
  16. ! Initialize a client
  17. result = client%initialize(.true.)!, "smartredis_put_get_3D") ! Change .false. to .true. if not using a clustered database
  18. if (result .ne. SRNoError) error stop 'client%initialize failed'
  19. ! Send a tensor to the database via the client and verify that we can retrieve it
  20. result = client%put_tensor("send_array", send_array_real_64, shape(send_array_real_64))
  21. if (result .ne. SRNoError) error stop 'client%put_tensor failed'
  22. result = client%unpack_tensor("send_array", recv_array_real_64, shape(recv_array_real_64))
  23. if (result .ne. SRNoError) error stop 'client%unpack_tensor failed'
  24. ! Done
  25. call exit()
  26. end subroutine
  27. end module TestRedisModule