main Program

Uses

  • program~~main~13~~UsesGraph program~main~13 main module~fakeextdatamod_server FakeExtDataMod_server program~main~13->module~fakeextdatamod_server module~mapl_exceptionhandling MAPL_ExceptionHandling program~main~13->module~mapl_exceptionhandling module~pfio pFIO program~main~13->module~pfio module~server_demo_cli server_demo_CLI program~main~13->module~server_demo_cli mpi mpi program~main~13->mpi

Calls

program~~main~13~~CallsGraph program~main~13 main connect_to_client connect_to_client program~main~13->connect_to_client mpi_comm_rank mpi_comm_rank program~main~13->mpi_comm_rank mpi_comm_size mpi_comm_size program~main~13->mpi_comm_size mpi_comm_split mpi_comm_split program~main~13->mpi_comm_split mpi_finalize mpi_finalize program~main~13->mpi_finalize mpi_init_thread mpi_init_thread program~main~13->mpi_init_thread none~finalize~11 FakeExtData%finalize program~main~13->none~finalize~11 none~init~6 FakeExtData%init program~main~13->none~init~6 none~run~12 FakeExtData%run program~main~13->none~run~12 proc~process_command_line~3 process_command_line program~main~13->proc~process_command_line~3 publish publish program~main~13->publish start start program~main~13->start none~terminate~9 ClientThread%terminate none~finalize~11->none~terminate~9 none~init~6->mpi_comm_rank none~init~6->mpi_comm_size at at none~init~6->at connect_to_server connect_to_server none~init~6->connect_to_server none~get_dimensions~2 FileMetadata%get_dimensions none~init~6->none~get_dimensions~2 none~run~12->at none~add_ext_collection~2 ClientThread%add_ext_collection none~run~12->none~add_ext_collection~2 none~done_prefetch~2 ClientThread%done_prefetch none~run~12->none~done_prefetch~2 none~prefetch_data~2 ClientThread%prefetch_data none~run~12->none~prefetch_data~2 interface~mapl_assert MAPL_Assert proc~process_command_line~3->interface~mapl_assert push_back push_back proc~process_command_line~3->push_back none~add_ext_collection~2->interface~mapl_assert none~get_connection BaseThread%get_connection none~add_ext_collection~2->none~get_connection proc~mapl_return MAPL_Return none~add_ext_collection~2->proc~mapl_return proc~mapl_verify MAPL_Verify none~add_ext_collection~2->proc~mapl_verify receive receive none~add_ext_collection~2->receive send send none~add_ext_collection~2->send none~done_prefetch~2->none~get_connection none~done_prefetch~2->proc~mapl_return none~done_prefetch~2->proc~mapl_verify none~done_prefetch~2->send get get none~prefetch_data~2->get none~prefetch_data~2->none~get_connection none~get_unique_request_id ClientThread%get_unique_request_id none~prefetch_data~2->none~get_unique_request_id none~insert_requesthandle BaseThread%insert_RequestHandle none~prefetch_data~2->none~insert_requesthandle none~prefetch_data~2->proc~mapl_return none~prefetch_data~2->proc~mapl_verify none~prefetch_data~2->receive none~prefetch_data~2->send none~terminate~9->none~get_connection none~terminate~9->proc~mapl_return none~terminate~9->proc~mapl_verify none~terminate~9->send

Variables

Type Attributes Name Initial
integer, parameter :: CLIENT_COLOR = 2
integer, parameter :: SERVER_COLOR = 1
integer :: color
integer :: comm
integer :: ierror
integer :: key
integer :: npes
integer :: provided
integer :: rank
integer :: status
class(AbstractDirectoryService), pointer :: d_s => null()
class(BaseServer), allocatable :: s
type(CommandLineOptions) :: options
type(FakeExtData), target :: extData

Source Code

program main
   use mpi
   use pFIO
   use server_demo_CLI
   use FakeExtDataMod_server
   use MAPL_ExceptionHandling
   implicit none

   integer :: rank, npes, ierror, provided
   integer :: status, color, key
   class(BaseServer),allocatable :: s


   type (CommandLineOptions) :: options
   integer, parameter :: SERVER_COLOR = 1
   integer, parameter :: CLIENT_COLOR = 2

   integer :: comm
!C$   integer :: num_threads
   type (FakeExtData), target :: extData
   class(AbstractDirectoryService), pointer :: d_s=>null()

   call MPI_init_thread(MPI_THREAD_MULTIPLE, provided, ierror)
   call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror)
   call MPI_Comm_size(MPI_COMM_WORLD, npes, ierror)

   call process_command_line(options, rc=status)


   if (rank < options%npes_server) then
      color = SERVER_COLOR
   else
      color = CLIENT_COLOR
   end if
   key = 0

   call MPI_Comm_split(MPI_COMM_WORLD, color, key, comm, ierror)

!C$   num_threads = 20
   allocate(d_s, source = DirectoryService(MPI_COMM_WORLD))

   if (color == SERVER_COLOR) then
      if(trim(options%server_type) == 'mpi') then
         allocate(s, source=MpiServer(comm, 'i_server'))
         call d_s%publish(PortInfo('i_server', s),s)
         call d_s%connect_to_client('i_server', s)
         print*, "using MpiServer"
      else if(trim(options%server_type) == 'openmp') then
!C$         call omp_set_num_threads(num_threads)
!C$         allocate(s, source=OpenMPServer(comm,d_s))
!C$         print*, "using OpenMPServer"
      else
         print*, options%server_type // '  not implemented'
         stop
      endif    
      call s%start()
   else ! client
      call extData%init(options, comm, d_s)
      call extData%run(step=1)
      call extData%run(step=2)
      call extData%finalize()

      !print*,"terminate_servers"
      !call global_directory_service%terminate_servers(comm)
   end if

   call MPI_finalize(ierror)

end program main