@@ -175,7 +175,11 @@ def streaming_shuffle(
175175 consumer_thread .join (timeout = wait_timeout )
176176
177177
178- def ucxx_mpi_setup (options : Options , progress_thread : ProgressThread ) -> Communicator :
178+ def ucxx_mpi_setup (
179+ options : Options ,
180+ progress_thread : ProgressThread ,
181+ statistics : Statistics | None = None ,
182+ ) -> Communicator :
179183 """
180184 Bootstrap UCXX cluster using MPI.
181185
@@ -185,6 +189,9 @@ def ucxx_mpi_setup(options: Options, progress_thread: ProgressThread) -> Communi
185189 Configuration options.
186190 progress_thread
187191 Progress thread for the communicator.
192+ statistics
193+ Statistics object for recording communication metrics. If ``None``
194+ (the default), statistics tracking is disabled.
188195
189196 Returns
190197 -------
@@ -201,7 +208,7 @@ def ucxx_mpi_setup(options: Options, progress_thread: ProgressThread) -> Communi
201208
202209 if MPI .COMM_WORLD .Get_rank () == 0 :
203210 comm = new_communicator (
204- MPI .COMM_WORLD .size , None , None , options , progress_thread
211+ MPI .COMM_WORLD .size , None , None , options , progress_thread , statistics
205212 )
206213 root_address_str = get_root_ucxx_address (comm )
207214 else :
@@ -212,7 +219,12 @@ def ucxx_mpi_setup(options: Options, progress_thread: ProgressThread) -> Communi
212219 if MPI .COMM_WORLD .Get_rank () != 0 :
213220 root_address = ucx_api .UCXAddress .create_from_buffer (root_address_str )
214221 comm = new_communicator (
215- MPI .COMM_WORLD .size , None , root_address , options , progress_thread
222+ MPI .COMM_WORLD .size ,
223+ None ,
224+ root_address ,
225+ options ,
226+ progress_thread ,
227+ statistics ,
216228 )
217229
218230 assert comm .nranks == MPI .COMM_WORLD .size
@@ -245,15 +257,15 @@ def setup_and_run(args: argparse.Namespace) -> None:
245257 progress_thread = ProgressThread (stats )
246258 if args .comm == "mpi" :
247259 comm = rapidsmpf .communicator .mpi .new_communicator (
248- MPI .COMM_WORLD , options , progress_thread
260+ MPI .COMM_WORLD , options , progress_thread , stats
249261 )
250262 elif args .comm == "ucxx" :
251263 if rapidsmpf .bootstrap .is_running_with_rrun ():
252264 raise ValueError (
253265 "UCXX communicator is not supported with rrun yet, due to missing allreduce support"
254266 )
255267 else :
256- comm = ucxx_mpi_setup (options , progress_thread )
268+ comm = ucxx_mpi_setup (options , progress_thread , stats )
257269
258270 # Create a buffer resource that limits device memory if `--spill-device`
259271 # is not None.
0 commit comments