10
Non-Blocking I/O CS550 Operating Systems

Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Embed Size (px)

Citation preview

Page 1: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Non-Blocking I/O

CS550Operating Systems

Page 2: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Outline

• Continued discussion of semaphores from the previous lecture notes, as necessary.

• MPI Types• What is non-blocking I/O?• Review of MPI_Irecv and MPI_Isend• Example Code

Page 3: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

MPI Types

MPI_CHAR MPI_LONGMPI_SHORT MPI_FLOATMPI_INT MPI_DOUBLE

• Many other types exist• These types are analogous to C primitive types• See the MPI Reference Manual for more

examples

Page 4: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Blocking I/O

• In blocking I/O, when a message is sent, a process waits until it has acknowledgement that the message has been received before it can continue processing.

• Similarly, when a message is requested (a receive method/function is called) the program waits until the message has been received before continuing processing.

Page 5: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Blocking I/O Example

Process1 Process2+------------+ 1.send msg +------------+|MPI_Send | --------> |MPI_Recv ||wait for ack| |wait for msg||ack received| <-------- |ack receipt ||3b.continue | 2.send ack |3a.continue |+------------+ +------------+

Page 6: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Non-Blocking I/O

• Non-blocking I/O allows for messages to be sent or requested for receipt without waiting for an acknowledgement that the message has been received.

• This means that programs may continue processing immediately after sending a message or after requesting that a message be received.

Page 7: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Non-Blocking I/O Example

Process1 Process2+------------+ 1.send msg +-------------+|MPI_Isend | --------> |MPI_Irecv ||2a.continue | |2b.continue || | |3. Do WORK || | |MPI_Wait || | |4.wait on msg|| | |5.work on msg|+------------+ +-------------+

Page 8: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Non-Blocking I/O Example 2

Process1 Process2+------------+ +-------------+| | |MPI_Irecv ||1a.Do WORK | |1b.continue || | |2. Do WORK || | |MPI_Wait || MPI_Isend | 5.send msg |4.wait on msg|| | --------> |6.work on msg|+------------+ +-------------+

Page 9: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

MPI Non-blocking I/O Functions

• MPI_Get_count – used to determine the length of a received message

• MPI_Irecv – non-blocking receive• MPI_Isend – non-blocking send• MPI_Wait – waits for one message to be received after

performing a non-blocking send.• MPI_Waitall – waits for all specified messages (e.g. a

list of messages) to be received.• MPI_Wait_some – waits for at least one message out of

a list of messages to be received, then continues processing

Page 10: Non-Blocking I/O CS550 Operating Systems. Outline Continued discussion of semaphores from the previous lecture notes, as necessary. MPI Types What is

Example Code

• See the non-blocking I/O examples from the course webpage