Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

general question about the algorithm


In my program, I use the Boost-Spirit-Qi to parse large data sets. Input data are sequential records . I am trying to use the TBB to increase the efficiency of parsing. The procedure for parallel processing of text data is as follows:

typedef map<string, data_struct_t> mdata_t;
vector<string> text; 
mdata_t  data;

parallel_for(blocked_range<size_t>(0, input.size(), gs),
                     [&]  (blocked_range<size_t>& r) {
        data_struct_t cs;
        mdata_t cr;
        string s;
        for(size_t i=r.begin(); i<r.end(); i++) {
           s = text;         
           Parser::task1(s, cs); 
           Parser::task2(s, cs); 
           Parser::task3(s, cs);
           Parser::task8(s, cs);   
           cr.insert(std::make_pair(cs.title, cs));
        data.insert(cr.begin(), cr.end());  
 }, ap);

My program uses only 10% of the CPU (2 CPU, 16 cores) and works on 8 cores. I do not understand why the remaining 8 cores are not used (single processor).
I would be grateful for pointing me to the correct algorithm parallelization this task.

Thanks for the advice.


0 Kudos
0 Replies