开发者

Simple Question on OpenMP

开发者 https://www.devze.com 2023-01-27 09:10 出处:网络
Say we have a serial application that stops normally for a while \'till a completely independent function is computed. How can one use OpenMP to spawn that function only to a thread and only开发者_如何

Say we have a serial application that stops normally for a while 'till a completely independent function is computed. How can one use OpenMP to spawn that function only to a thread and only开发者_如何学Go printf its result when it ends? [without stopping the main application]

EDIT: Can it be done if the independent function is run inside the main app?


You can use parallel sections.

#pragma omp parallel sections
{
   #pragma omp section
   YourMainApp ();

   #pragma omp section
   YourIndepFunction ();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消