Open MP inside Cilk++

Open MP inside Cilk++

Ritratto di pkroy

Hi,

Is it possible to use an external code written in Open MP inside a cilk++ program ? Does cilk provide this
flexibility ?

Thanks!
pkroy

6 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Stephen Lewin-berlin (Intel)
Quoting - pkroy Hi,

Is it possible to use an external code written in Open MP inside a cilk++ program ? Does cilk provide this
flexibility ?

Thanks!
pkroy

pkroy,

When you say "external code" I presume that you want to call a library that uses OpenMP? There is no reason in principle why this should not work (though we haven't explicitly tried it). However, note that there is no coordination between Cilk++ and OpenMP, so if, for example, you call code that uses OpenMP in parallel (for example, in the body of a cilk_for loop) you could end up with quite a few threads.

Please let us know if it works. What compiler are you using?

regards,

steve

Ritratto di pkroy
Quoting - Stephen Lewin-berlin (Intel)

pkroy,

When you say "external code" I presume that you want to call a library that uses OpenMP? There is no reason in principle why this should not work (though we haven't explicitly tried it). However, note that there is no coordination between Cilk++ and OpenMP, so if, for example, you call code that uses OpenMP in parallel (for example, in the body of a cilk_for loop) you could end up with quite a few threads.

Please let us know if it works. What compiler are you using?

regards,

steve

steve,

Thanks for the response. The program that I am working on has a DAG similar to a binary tree. It seems that cilk++ works well on those recursive type problems where it handles the flow almost automatically. I do need to perform some task using existing multithreaded libray especially at the lowermost nodes of the tree. Also, I am thinking of using some multithreaded library (for eg ATLAS) for basic matrix-vector operations. I can explain you with a simple example. Suppose, I have a DAG which looks like the following :

2
/
0 1

Given that I have 4 cores, 0 and 1 will receive 2 cores each (0 and 1 have same amont of computations!)
and with 2 cores each I would like to call a Multithreaded library for each of the nodes 0 and 1. If I have understood you correctly, cilk will provide 2 cores each for nodes 0 and 1 to the library ?

I am planning to use Cilk++ and OpenMP for compilation. Is it possible for a program written in OpenMP or TBB to call a subroutine written in cilk++ ?

Thanks for your time!
Have a nice day!
pkroy

Ritratto di Stephen Lewin-berlin (Intel)
Quoting - pkroy steve,

Thanks for the response. The program that I am working on has a DAG similar to a binary tree. It seems that cilk++ works well on those recursive type problems where it handles the flow almost automatically. I do need to perform some task using existing multithreaded libray especially at the lowermost nodes of the tree. Also, I am thinking of using some multithreaded library (for eg ATLAS) for basic matrix-vector operations. I can explain you with a simple example. Suppose, I have a DAG which looks like the following :

2
/
0 1

Given that I have 4 cores, 0 and 1 will receive 2 cores each (0 and 1 have same amont of computations!)
and with 2 cores each I would like to call a Multithreaded library for each of the nodes 0 and 1. If I have understood you correctly, cilk will provide 2 cores each for nodes 0 and 1 to the library ?

I am planning to use Cilk++ and OpenMP for compilation. Is it possible for a program written in OpenMP or TBB to call a subroutine written in cilk++ ?

Thanks for your time!
Have a nice day!
pkroy

pkroy, Cilk is not aware of what is happening in the library. If your Cilk code looks like this: spawn work(node0); work(node1); then the work routines can run independently. If each call into OpenMP, each will have 4 cores available and there can be resource contention. steve
Ritratto di ninhngt
Quoting - Stephen Lewin-berlin (Intel)

pkroy, Cilk is not aware of what is happening in the library. If your Cilk code looks like this: spawn work(node0); work(node1); then the work routines can run independently. If each call into OpenMP, each will have 4 cores available and there can be resource contention. steve

With OpenMP, TBB, Cilk++ all around, the possibility of combining libraries using different technologies is quite low. Can this be solved in the future?

Ritratto di Stephen Lewin-berlin (Intel)
Quoting - ninhngt

With OpenMP, TBB, Cilk++ all around, the possibility of combining libraries using different technologies is quite low. Can this be solved in the future?

Yes! Future releases of these technologies should inter-operate better.

Accedere per lasciare un commento.