From c5ad8d027968d91b81f831e49733a0c7dadfb8de Mon Sep 17 00:00:00 2001 From: Jiakun Yan Date: Wed, 13 Sep 2023 21:15:31 -0500 Subject: [PATCH] continue to fix the cases where ncomps > 1 and progress_type == worker --- libs/full/parcelport_lci/src/parcelport_lci.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/full/parcelport_lci/src/parcelport_lci.cpp b/libs/full/parcelport_lci/src/parcelport_lci.cpp index c892940b335c..1110c80838ce 100644 --- a/libs/full/parcelport_lci/src/parcelport_lci.cpp +++ b/libs/full/parcelport_lci/src/parcelport_lci.cpp @@ -281,7 +281,9 @@ namespace hpx::parcelset::policies::lci { while (prg_thread_flag) { for (auto& device : devices) + { util::lci_environment::do_progress(device.device); + } } } @@ -455,11 +457,11 @@ namespace hpx::parcelset::policies::lci { if (HPX_UNLIKELY(!is_initialized || hpx::threads::get_self_id() == hpx::threads::invalid_thread_id)) { - static thread_local std::size_t tls_rr_device_idx = 0; + static thread_local unsigned int tls_rand_seed = rand(); util::lci_environment::log( util::lci_environment::log_level_t::debug, "device", "Rank %d unusual phase\n", LCI_RANK); - return devices[tls_rr_device_idx++ % devices.size()]; + return devices[rand_r(&tls_rand_seed) % devices.size()]; } if (tls_device_idx == std::size_t(-1)) {