quantum-espresso/UtilXlib/tests/test_mp_sum_rv_buffer_gpu.f90

51 lines
1.1 KiB
Fortran
Raw Permalink Normal View History

2018-02-20 23:09:28 +08:00
#if defined(__CUDA)
PROGRAM test_mp_sum_rv_buffer_gpu
!
! Simple program to check the functionalities of test_mp_sum_rv
! with buffer implementation.
!
2020-10-01 12:22:37 +08:00
USE parallel_include
2018-02-20 23:09:28 +08:00
USE cudafor
2018-02-28 18:21:12 +08:00
USE util_param, ONLY : DP
2018-02-20 23:09:28 +08:00
USE mp, ONLY : mp_sum
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
USE tester
IMPLICIT NONE
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
! test variable
INTEGER, DEVICE :: rv_d(200001)
2018-02-28 18:21:12 +08:00
REAL(DP) :: rv_h(200001)
REAL(DP) :: valid(200001)
2018-02-20 23:09:28 +08:00
!
CALL test%init()
#if defined(__MPI)
world_group = MPI_COMM_WORLD
#endif
CALL mp_world_start(world_group)
rv_h(:) = mpime + 1
rv_d = rv_h
CALL mp_sum(rv_d, world_comm)
rv_h = rv_d
!
valid(:) = 0.5*nproc*(nproc+1)
CALL test%assert_equal(rv_h, valid )
!
CALL collect_results(test)
2018-02-20 23:09:28 +08:00
!
CALL mp_world_end()
!
IF (mpime .eq. 0) CALL test%print()
!
2018-02-20 23:09:28 +08:00
END PROGRAM test_mp_sum_rv_buffer_gpu
#else
PROGRAM test_mp_sum_rv_buffer_gpu
CALL no_test()
END PROGRAM test_mp_sum_rv_buffer_gpu
#endif