Commit e5343f02 authored by Victor Lopez's avatar Victor Lopez

Fix the upper limit of thread creation

The runtime should be able to create as many threads as
available CPUs, or as requested by the user if CPUs are
parent d5daef8b
......@@ -1079,6 +1079,12 @@ nanos::PE * smpProcessorFactory ( int id, int uid )
void SMPPlugin::createWorker( ext::SMPProcessor *target, std::map<unsigned int, BaseThread *> &workers )
/* Max threads will be either the max number of PEs
* or the requested --smp-threads in case of oversubscription */
int max_threads = std::max( _requestedWorkers, _availableCPUs );
fatal_cond( workers.size() >= static_cast<unsigned int>(max_threads),
"Thread limit reached at " << max_threads << " threads" );
NANOS_INSTRUMENT( sys.getInstrumentation()->incrementMaxThreads(); )
if ( !target->isActive() ) {
......@@ -1293,10 +1293,9 @@ ThreadTeam * System::createTeam ( unsigned nthreads, void *constraints, bool reu
//! \note Getting rest of the members
while ( remaining_threads > 0 ) {
BaseThread *thread = getUnassignedWorker();
// Check if we don't have a worker because it needs to be created
if ( !thread && _workers.size() < nthreads ) {
if ( !thread ) {
_smpPlugin->createWorker( _workers );
  • @vlopez This limit makes sense when we have devices which use multiworkers? Have you think about that?

  • Probably not. The condition at system.cpp:1299 was wrong because the runtime was assuming that all threads created until now would be team candidates, which they are not if the process mask changes.

    But the strong restriction at createWorker may have other consequences that I have not think of. Do multiworkers use the same SMPPlugin? If so, this restriction should be removed.

  • I will merge the master changes in the OmpSs-at-FPGA/Nanox and test them. But probably, there will be no problem as I realized now that MultiWorker goes directly to the SMP PE and not the SMP Plugin (as you state).

  • mentioned in commit dbf4d743

    Toggle commit list
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment