main Program

Uses

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

Calls

program~~main~17~~CallsGraph program~main~17 main connect_to_client connect_to_client program~main~17->connect_to_client mpi_comm_rank mpi_comm_rank program~main~17->mpi_comm_rank mpi_comm_size mpi_comm_size program~main~17->mpi_comm_size mpi_comm_split mpi_comm_split program~main~17->mpi_comm_split mpi_finalize mpi_finalize program~main~17->mpi_finalize mpi_init_thread mpi_init_thread program~main~17->mpi_init_thread none~finalize~12 FakeExtData%finalize program~main~17->none~finalize~12 none~init~7 FakeExtData%init program~main~17->none~init~7 none~run~17 FakeExtData%run program~main~17->none~run~17 proc~mapl_abort MAPL_abort program~main~17->proc~mapl_abort proc~mapl_verify MAPL_Verify program~main~17->proc~mapl_verify proc~process_command_line~5 process_command_line program~main~17->proc~process_command_line~5 publish publish program~main~17->publish start start program~main~17->start none~terminate~4 ClientThread%terminate none~finalize~12->none~terminate~4 none~init~7->mpi_comm_rank none~init~7->mpi_comm_size none~init~7->proc~mapl_verify at at none~init~7->at connect_to_server connect_to_server none~init~7->connect_to_server none~get_dimensions~2 FileMetadata%get_dimensions none~init~7->none~get_dimensions~2 none~run~17->at none~add_ext_collection ClientThread%add_ext_collection none~run~17->none~add_ext_collection none~done_prefetch ClientThread%done_prefetch none~run~17->none~done_prefetch none~prefetch_data ClientThread%prefetch_data none~run~17->none~prefetch_data 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~5->interface~mapl_assert push_back push_back proc~process_command_line~5->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