Skip to content

Commit 75cca01

Browse files
committed
Document how the GASNet parcelport sends and receives parcels
Describe the hybrid send path, the dispatch of received parcels after the source is released, the startup I/O thread, and when to prefer I/O threads over worker progress. Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
1 parent c6bc1a9 commit 75cca01

1 file changed

Lines changed: 70 additions & 4 deletions

File tree

‎docs/sphinx/manual/using_the_gasnet_parcelport.rst‎

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,59 @@ Launch one locality per GASNet process: the parcelport does not support more
166166
than one |hpx| locality in a process. The number of worker threads of a
167167
locality is set as usual with ``--hpx:threads``.
168168

169+
A launcher that binds each process to a single core makes all worker threads of
170+
a locality share that core. Open MPI's ``mpiexec`` does that by default for
171+
small numbers of processes; pass ``--bind-to none`` to it (``hpxrun.py`` does
172+
this for ``-r gasnet``) and let |hpx| bind the worker threads.
173+
174+
How parcels are sent
175+
--------------------
176+
177+
The worker threads of a locality drive the network from their background work:
178+
they send queued messages, check for pages that arrived, and decode received
179+
messages. The parcelport starts no threads of its own for this unless
180+
``hpx.parcel.gasnet.worker_progress`` is ``0``.
181+
182+
Each pair of localities has a ring of pages for each direction, and only one
183+
message is in flight to a destination at a time. A parcel to a destination
184+
that nothing is being sent to goes out immediately as a message of its own.
185+
While a message to a destination is in flight, further parcels to it are
186+
queued, and once the destination is free, all queued parcels are encoded into
187+
one message and sent together. Isolated parcels so get the lowest latency, and
188+
many parcels to one destination are sent in few messages.
189+
``hpx.parcel.gasnet.sendimm=0`` queues every parcel instead, as the other
190+
parcelports do by default.
191+
192+
How parcels are received
193+
------------------------
194+
195+
A worker thread that finds a complete message from a source decodes it and
196+
runs the actions of its parcels on the same thread. Before it does that, it
197+
releases the source, so that the next message from that source can be received
198+
while the actions run. An action may suspend or wait for further messages
199+
without stopping the network.
200+
201+
While the runtime starts up, the worker threads don't run yet. A thread of the
202+
parcelport drives the network until the runtime tells the parcelport that its
203+
bootstrap is complete, and the worker threads take over from then on.
204+
205+
Worker threads or I/O threads
206+
-----------------------------
207+
208+
Worker progress gives the lowest latency, since no thread hands the messages
209+
over to another one. Between two localities on one node, a round trip took about
210+
19 microseconds with worker progress, 33 to 42 microseconds with I/O threads,
211+
and 41 to 51 microseconds with the TCP parcelport. With worker progress the
212+
network makes progress only while worker threads run their background work,
213+
between two tasks or while they are idle. A worker thread that runs a long task
214+
without suspending does not drive the network in the meantime. Applications with
215+
such tasks should run enough worker threads, or use I/O threads
216+
(``hpx.parcel.gasnet.worker_progress=0``), each of which needs a core of its
217+
own.
218+
219+
Runtime settings
220+
----------------
221+
169222
The following settings configure the parcelport at runtime. ``mtu``, ``slots``
170223
and ``checksum`` are part of the wire protocol and must be the same on all
171224
localities; at startup the parcelport compares them across all localities
@@ -200,10 +253,23 @@ unless ``hpx.parcel.gasnet.uniform_check`` is ``0``.
200253

201254
.. option:: --hpx:ini=hpx.parcel.gasnet.worker_progress=<n>
202255

203-
Which threads make progress on the network: ``0`` (the default) only the
204-
parcelport's I/O threads, ``1`` all worker threads, ``n`` > 1 the worker
205-
threads ``0`` to ``n-1``. Progress from worker threads is known to hang some
206-
runs with several threads per locality.
256+
Which threads make progress on the network: ``1`` (the default) all worker
257+
threads, ``n`` > 1 the worker threads ``0`` to ``n-1``, ``0`` dedicated I/O
258+
threads of the parcelport instead of the worker threads. The I/O threads
259+
poll the network continuously, each on its own core.
260+
261+
.. option:: --hpx:ini=hpx.parcel.gasnet.io_pool_size=<n>
262+
263+
Number of I/O threads with ``worker_progress=0``; each of them serves a part
264+
of the source localities. The default value is ``2``. Without I/O threads
265+
(``worker_progress`` not ``0``) the setting has no effect.
266+
267+
.. option:: --hpx:ini=hpx.parcel.gasnet.sendimm=<0|1>
268+
269+
``1`` (the default) sends a parcel immediately if nothing is being sent to
270+
its destination, and queues it otherwise; the queued parcels to a
271+
destination are sent together in one message once it is free (see
272+
:ref:`run_gasnet_pp`). ``0`` queues all parcels.
207273

208274
.. option:: --hpx:ini=hpx.parcel.gasnet.progress_interval=<n>
209275

0 commit comments

Comments
 (0)