параллельная задача в tbb

У меня есть следующая функция, которую я хочу запускать как параллельные задачи :

void WuManberFinder::find() 

, поэтому я написал следующее :

void WuManberFinder::Parallel_find()
{

 tbb::task_group g;

 for(auto i = 0; i != tbb::tbb_thread::hardware_concurrency(); ++i) 
 {
  g.run(find);
 }

   g.wait();

 }

, но это дает мне следующие ошибки:

wumanber.cc:139:17: error: no matching function for call to ‘tbb::task_group::run(<unresolved overloaded function type>)’
wumanber.cc:139:17: note: candidates are:
/usr/include/tbb/task_group.h:209:10: note: void tbb::task_group::run(const F&) [with F = void (thru::matching::WuManberFinder::*)()]
/usr/include/tbb/task_group.h:209:10: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘void (thru::matching::WuManberFinder::* const&)()’
/usr/include/tbb/task_group.h:151:10: note: template<class F> void tbb::internal::task_group_base::run(tbb::task_handle<F>&)

Вот серийный код (еще не завершен):

 void WuManberFinder::find() {    
    while(m_pos <= m_text2.size()) {        
        string bgram = m_text2.substr(m_pos - m_B, m_B);
        shift_type::iterator i = m_shift.find(bgram);           
    if (i == m_shift.end())
        {// shared variable lock
        m_pos += m_lmin - m_B + 1;
        }// unlock
    else {

        if (i->second == 0) {

            vector<size_t>& list = m_hash[bgram];
            // Verify all patterns in list against the text.

            //shared variable lock
            ++m_pos;
            //unlock         

            for (size_t j = 0; j < list.size(); ++j) {
                string const& str = m_patterns[list[j]];
                m_find_pos = m_pos - str.size() - 1;
                size_t k = 0;

                for (; k < str.size(); ++k)
                    if (str[k] != m_text2[m_find_pos + k])
                        break;

                if (k == str.size()) {
                    m_find_pattern_index = list[j];
                 //  cout << "***" << m_patterns[m_find_pattern_index] <<endl;
                   // return true
                   // shared variable lock
                   m_intrusions++;
                   // unlock
                }
            }
        }
        else
           { // access m_pos shared critical section
            m_pos += i->second;
           } // access m_pos shared critical section
    }
    }

   // return false;  nothing found
     }

Я знаю, что это может показаться странным, но основная идея в том, что я хочу, чтобы несколько задач этого типа проходили по строке. Общая переменная — pos. Не могли бы вы дать мне подсказку?

0
задан Rafał Rawicki 9 April 2012 в 19:34
поделиться