Note that there are some explanatory texts on larger screens.

plurals
  1. POparallel task in tbb
    primarykey
    data
    text
    <p>I have the following function that I want to run as parallel tasks:</p> <pre><code>void WuManberFinder::find() </code></pre> <p>so I wrote the following:</p> <pre><code>void WuManberFinder::Parallel_find() { tbb::task_group g; for(auto i = 0; i != tbb::tbb_thread::hardware_concurrency(); ++i) { g.run(find); } g.wait(); } </code></pre> <p>but it gives me the following errors:</p> <pre><code>wumanber.cc:139:17: error: no matching function for call to ‘tbb::task_group::run(&lt;unresolved overloaded function type&gt;)’ wumanber.cc:139:17: note: candidates are: /usr/include/tbb/task_group.h:209:10: note: void tbb::task_group::run(const F&amp;) [with F = void (thru::matching::WuManberFinder::*)()] /usr/include/tbb/task_group.h:209:10: note: no known conversion for argument 1 from ‘&lt;unresolved overloaded function type&gt;’ to ‘void (thru::matching::WuManberFinder::* const&amp;)()’ /usr/include/tbb/task_group.h:151:10: note: template&lt;class F&gt; void tbb::internal::task_group_base::run(tbb::task_handle&lt;F&gt;&amp;) </code></pre> <p>Here is the serial code (not complete yet):</p> <pre><code> void WuManberFinder::find() { while(m_pos &lt;= 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-&gt;second == 0) { vector&lt;size_t&gt;&amp; list = m_hash[bgram]; // Verify all patterns in list against the text. //shared variable lock ++m_pos; //unlock for (size_t j = 0; j &lt; list.size(); ++j) { string const&amp; str = m_patterns[list[j]]; m_find_pos = m_pos - str.size() - 1; size_t k = 0; for (; k &lt; str.size(); ++k) if (str[k] != m_text2[m_find_pos + k]) break; if (k == str.size()) { m_find_pattern_index = list[j]; // cout &lt;&lt; "***" &lt;&lt; m_patterns[m_find_pattern_index] &lt;&lt;endl; // return true // shared variable lock m_intrusions++; // unlock } } } else { // access m_pos shared critical section m_pos += i-&gt;second; } // access m_pos shared critical section } } // return false; nothing found } </code></pre> <p>I know this might seem weird, but the main idea is I want multiple tasks of this type to traverse a string. The shared variable is <code>pos</code>. Could you give me a hint?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload