Intel IPP and TBB used together

Intel IPP and TBB used together

I'd like to know how you can use TBB instructions to implement the loop in the following piece of code.The code uses an ipp function and I'd like to be able to use the ipp function with TBB.

#include <iostream>
#include <ipp.h>

#include "tbb/task_scheduler_init.h"
#include "tbb/parallel_for.h"
#include "tbb/blocked_range.h"
#include "tbb/tick_count.h"

using namespace tbb;
using namespace std;

#define SIZE 255
#define N 10

int main(int argc, CHAR* argv[])
{
    Ipp8u pSrc[SIZE], pDst[N][SIZE];
    int i;
    for (int i = 0; i<SIZE ; i++){
        pSrc[i] = (Ipp8u) i;
    }
    for (size_t i = 0; i<N; i++){
        ippsCopy_8u(pSrc,pDst[i],SIZE); // This is the loop that needs to be implemented in TBB.
    }
    return 0;
}

I have written the following class to implement the parallel_for. But I still need to know how the structure of the parallel_for would be.

class copyVectors{
    Ipp8u *s;
    Ipp8u *d;
public:
    copyVectors(Ipp8u *pSrc, Ipp8u *pDst){
        s = pSrc;
        d = pDst;
    }

    void operator () (const blocked_range<size_t> &r) const {
        ippsCopy_8u(s, d, SIZE);
    }
}

Any help would be highly appreciated.

http://software.intel.com/en-us/forums/intel-threading-building-blocks/

3 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Hi everybody,

Mohammad, Here are a couple of notes related to integration of IPP with TBB:

1. What IPP version are you using?

2. Take into account that many functions in a Signal Processing domain of IPP library are threaded ( using OpenMP / the same applies to all the rest domains of IPP ) and it doesn't make sence to create another layer of threading

3. Vectors with lengths of 255 unsigned bytes are too small and overhead of creating new threads will affect performance of your processing

4. There is a good thing because IPP team is considering a new release of IPP library ( version 7, or so ) without multithreading. In that case all your efforts will be paid off

5. Many IPP functions in IPP library version 7 are heavily optimized for CPUs with AVX & AVX2 instructions

Also, take a look at a thread:

Forum topic: Using Intel TBB with IPP
Web-link: http://software.intel.com/en-us/forums/topic/277266

Best regards,
Sergey

>>...
>>5. Many IPP functions in IPP library version 7 are heavily optimized for CPUs with AVX & AVX2 instructions

Take a look at article:
.
http://software.intel.com/en-us/articles/haswell-support-in-intel-ipp

and 'ippsCopy_8u' is listed in a 'Signal Processing' section.

Another article to look at is:
.
https://secure-software.intel.com/en-us/articles/intel-integrated-perfor...

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi