diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 22 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_impl.hpp | 3 |
2 files changed, 18 insertions, 7 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 116e1e6eb..13d1d6adc 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -430,15 +430,23 @@ x300_impl::x300_impl(const uhd::device_addr_t &dev_addr) uhd::msg::handler_t current_handler = uhd::msg::get_handler(); uhd::msg::register_handler(&thread_msg_handler); - // Thread the initialization process - boost::thread_group setup_threads; - for (size_t i = 0; i < device_args.size(); i++) + // Initialize groups of USRPs in parallel + size_t total_usrps = device_args.size(); + size_t num_usrps = 0; + while (num_usrps < total_usrps) { - setup_threads.create_thread( - boost::bind(&x300_impl::setup_mb, this, i, device_args[i]) - ); + size_t init_usrps = std::min(total_usrps - num_usrps, X300_MAX_INIT_THREADS); + boost::thread_group setup_threads; + for (size_t i = 0; i < init_usrps; i++) + { + size_t index = num_usrps + i; + setup_threads.create_thread( + boost::bind(&x300_impl::setup_mb, this, index, device_args[index]) + ); + } + setup_threads.join_all(); + num_usrps += init_usrps; } - setup_threads.join_all(); // restore the original message handler UHD_MSG(status) << thread_final_msg; diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index d082ab76a..bfe98e7a3 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -73,6 +73,9 @@ static const size_t X300_ETH_MSG_NUM_FRAMES = 64; static const size_t X300_ETH_DATA_NUM_FRAMES = 32; static const double X300_DEFAULT_SYSREF_RATE = 10e6; +// Limit the number of initialization threads +static const size_t X300_MAX_INIT_THREADS = 10; + static const size_t X300_MAX_RATE_PCIE = 800000000; // bytes/s static const size_t X300_MAX_RATE_10GIGE = (size_t)( // bytes/s 10e9 / 8 * // wire speed multiplied by percentage of packets that is sample data |