test_stress Subroutine

public subroutine test_stress(this)

Arguments

Type IntentOptional Attributes Name
class(MpiTestMethod), intent(inout) :: this

Calls

proc~~test_stress~~CallsGraph proc~test_stress test_stress assertequal assertequal proc~test_stress->assertequal getmpicommunicator getmpicommunicator proc~test_stress->getmpicommunicator getprocessrank getprocessrank proc~test_stress->getprocessrank mpi_comm_split mpi_comm_split proc~test_stress->mpi_comm_split none~connect_to_client DirectoryService%connect_to_client proc~test_stress->none~connect_to_client none~connect_to_server DirectoryService%connect_to_server proc~test_stress->none~connect_to_server none~free_directory_resources DirectoryService%free_directory_resources proc~test_stress->none~free_directory_resources none~publish DirectoryService%publish proc~test_stress->none~publish

Source Code

   subroutine test_stress(this)
      class (MpiTestMethod), intent(inout) :: this

      type (DirectoryService) :: ds
      integer :: comm

      integer :: color, key
      type (MockServer) :: mock_server
      type (MockClient) :: mock_client

      integer :: ierror

      ds = DirectoryService(this%getMpiCommunicator())

      select case (this%getProcessRank())
      case (0:3)
         color = 0 ! client
      case (4:5) ! none
         color = 2
      case (6:7)
         color = 1 ! server
      end select
         
      key = 0
      call MPI_Comm_split(this%getMpiCommunicator(), color, key, comm, ierror)
      @assertEqual(0, ierror)

      select case (color)
      case (1) ! server
         mock_server = MockServer(comm)
         call ds%publish(portInfo('input', mock_server), mock_server)
         call ds%connect_to_client('input', mock_server)
      case (0) ! client
         mock_client = MockClient()
         call ds%connect_to_server('input', mock_client, comm)
      end select

      call ds%free_directory_resources()

    end subroutine test_stress