Streams and OpenMP

Dear All

What the best policy, see bellow? In both is created 16 streams. Are the two approachs valid? If so which is the best?

Thanks

Luis Gonçalves


creat 16 streams
#omp parallel num_threads(16)
{
z5=omp_thread_num();

use stream z5
}

destroy 16 streams

***************************** or:

#omp parallel num_threads(16)
{
z5=omp_thread_num();
creat stream

use stream

destroy stream

}

i see little difference; except, i would caution against destroying streams before all work in them are known to be completed

i would also caution against redundant streams

you already use openMP, which implies different cuda contexts, i would think, which in turn implies different (default) streams

and your profiling output seems to support this point

only if it is clear that the tasks issued by openMP threads run in the same stream, or if you can concurrently run tasks issued by individual openMP threads, may you possibly benefit from streams