main Program

Uses

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

Calls

program~~main~14~~CallsGraph program~main~14 main connect_to_client connect_to_client program~main~14->connect_to_client mpi_comm_rank mpi_comm_rank program~main~14->mpi_comm_rank mpi_comm_size mpi_comm_size program~main~14->mpi_comm_size mpi_comm_split mpi_comm_split program~main~14->mpi_comm_split mpi_finalize mpi_finalize program~main~14->mpi_finalize mpi_init_thread mpi_init_thread program~main~14->mpi_init_thread none~finalize~12 FakeExtData%finalize program~main~14->none~finalize~12 none~init~8 FakeExtData%init program~main~14->none~init~8 none~run~15 FakeExtData%run program~main~14->none~run~15 proc~mapl_abort MAPL_abort program~main~14->proc~mapl_abort proc~mapl_verify MAPL_Verify program~main~14->proc~mapl_verify proc~process_command_line~4 process_command_line program~main~14->proc~process_command_line~4 publish publish program~main~14->publish start start program~main~14->start none~terminate~6 ClientThread%terminate none~finalize~12->none~terminate~6 none~init~8->mpi_comm_rank none~init~8->mpi_comm_size none~init~8->proc~mapl_verify at at none~init~8->at connect_to_server connect_to_server none~init~8->connect_to_server none~get_dimensions~2 FileMetadata%get_dimensions none~init~8->none~get_dimensions~2 none~run~15->at none~add_data_collection~2 ClientThread%add_data_collection none~run~15->none~add_data_collection~2 none~done_prefetch~2 ClientThread%done_prefetch none~run~15->none~done_prefetch~2 none~prefetch_data~2 ClientThread%prefetch_data none~run~15->none~prefetch_data~2 mpi_abort mpi_abort proc~mapl_abort->mpi_abort proc~mapl_throw_exception MAPL_throw_exception proc~mapl_verify->proc~mapl_throw_exception interface~mapl_assert MAPL_Assert proc~process_command_line~4->interface~mapl_assert push_back push_back proc~process_command_line~4->push_back

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 :: rc
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, rc
   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)
   _VERIFY(ierror)
   call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror)
   _VERIFY(ierror)
   call MPI_Comm_size(MPI_COMM_WORLD, npes, ierror)
   _VERIFY(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)
   _VERIFY(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