14#include "arcane/impl/internal/ThreadBindingMng.h"
16#include "arcane/utils/ITraceMng.h"
18#include "arcane/utils/PlatformUtils.h"
19#include "arcane/utils/IProcessorAffinityService.h"
30void ThreadBindingMng::
31initialize(ITraceMng* tm,
const String& strategy)
34 m_bind_strategy = strategy;
37 if (!m_bind_strategy.
null()){
38 if (m_bind_strategy!=
"Simple")
39 ARCANE_FATAL(
"Invalid strategy '{0}'. Valid values are : 'Simple'",m_bind_strategy);
42 tm->info() <<
"Thread binding strategy is '" << m_bind_strategy <<
"'";
43 m_observer_pool.
addObserver(
this,&ThreadBindingMng::_createThreadCallback,
51void ThreadBindingMng::
52_createThreadCallback()
56 ITraceMng* tm = m_trace_mng;
57 Int32 thread_index = m_current_thread_index;
58 ++m_current_thread_index;
63 tm->info() <<
"WARNING: Can not bind thread because there is no 'IProcessorAffinityService'";
68 if (thread_index<m_max_thread){
69 pas->bindThread(thread_index);
70 tm->info() <<
"Binding thread index=" << thread_index <<
" cpuset=" << pas->cpuSetString();
73 tm->
info() <<
"WARNING: thread index is greater than maximum number of allowed thread. No binding done";
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Classes, Types et macros pour gérer la concurrence.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
void addObserver(T *obj, void(T::*func)(const IObservable &), IObservable *oba)
Ajoute un observateur.
static Int32 nbAllowedThread()
Nombre de threads utilisés au maximum pour gérer les tâches.
static IObservable * createThreadObservable()
Observable appelé lors de la création d'un thread pour une tâche.
bool null() const
Retourne true si la chaîne est nulle.
TraceMessage info() const
Flot pour un message d'information.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-