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

Can I still use STL vector with scalable memory allocator on Intel XEON Phi?

fenglai
Beginner
644 Views

Hello:

I have a computational chemistry code which currently use TBB for multi-threading on CPU. It works very good. Now I am trying to transfer the code to work on Phi coprocessor. My current code is like this:

void TBB_EXRho::operator()(const blocked_range<UInt>& r)
{

   // shell pair data memory allocation
   UInt maxNP2 = infor.getMaxNP2();
   UInt maxNL  = infor.getMaxNL();
   UInt maxNSP = infor.getMaxNSP();
   AtomShellPair sp(maxNSP,maxNP2,maxNL);

   // integral array
   std::vector<double,tbb::scalable_allocator<double> > esp(infor.getMaxNBasisForShell()*infor.getMaxNBasisForShell()*getNGrids());

   //  real work begins
   for( UInt n=r.begin(); n!=r.end(); ++n ) {

       .....................

   }

}

   This function will be running on Phi coprocessor. During the calculation I need vector such as "esp" to hold the temp result. The object AtomShellPair, also contains vectors to hold the data needed by calculation. I used the scalable memory allocator right now, I am not sure whether these code can be simply reused when running on Phi coprocessor?

    Thank you for your advice!!

    fenglai

  

 

0 Kudos
1 Reply
Alexei_K_Intel
Employee
644 Views

Hello,

Intel TBB has full support of Intel Xeon Phi coprocessor. So any functionality (including scalable_allocator) that works fine on usual CPU should work on Intel Xeon Phi coprocessor. If you have some troubles with running Intel TBB based code on Intel Xeon Phi coprocessor, feel free to ask.

Regards, Alex

0 Kudos
Reply