Skip to content

Commit

Permalink
i-Pi: Added initialization step
Browse files Browse the repository at this point in the history
  • Loading branch information
FurstPlattner authored and oschuett committed Oct 25, 2024
1 parent ffaae80 commit 8587bbb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ipi_server.F
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ SUBROUTINE start_server(driver_section, para_env, ipi_env)
CHARACTER(len=default_path_length) :: c_hostname, drv_hostname
INTEGER :: drv_port, handle, i_drv_unix, &
output_unit, socket, comm_socket
CHARACTER(len=msglength) :: msgbuffer
CHARACTER(len=msglength), PARAMETER :: initmsg = "INIT"
LOGICAL :: drv_unix, ionode

CALL timeset(routineN, handle)
Expand Down Expand Up @@ -123,6 +125,17 @@ SUBROUTINE start_server(driver_section, para_env, ipi_env)
CALL ipi_env_set(ipi_env=ipi_env, sockfd=comm_socket)
END IF

! Check if the client needs initialization
! We only send a meaningless message since we have no general way of
! knowing what the client is expecting
CALL ask_status(comm_socket, msgbuffer)
IF (TRIM(msgbuffer) == "NEEDINIT") THEN
CALL writebuffer(comm_socket, initmsg, msglength)
CALL writebuffer(comm_socket, 1) ! Bead index - just send 1
CALL writebuffer(comm_socket, 12) ! Bits in the following message
CALL writebuffer(comm_socket, "Initializing", 12)
END IF

#endif

CALL timestop(handle)
Expand Down

0 comments on commit 8587bbb

Please sign in to comment.