最終更新: mikk_ni3_92 2008年05月23日(金) 15:10:38履歴
現在地 >> メニュー >> OpenMP >> OMP::sections構文
#include <omp.h>
#include <cstdio>
int main()
{
#pragma omp parallel sections num_threads(4)
{
/** タスクA **/
#pragma omp section
{
printf("HELLO, from %d of %d\n",omp_get_thread_num(), omp_get_num_threads());
}
/** タスクB **/
#pragma omp section
{
printf("WORLD,from %d of %d\n",omp_get_thread_num(), omp_get_num_threads());
}
/** タスクC **/
#pragma omp section
{
printf("OPEN_MP,from %d of %d\n",omp_get_thread_num(), omp_get_num_threads());
}
}
return 0;
}
#include <omp.h>
#include <cstdio>
int main()
{
#pragma omp parallel sections num_threads(4)
{
/** タスクA **/
#pragma omp section
{
printf("HELLO, from %d of %d\n",omp_get_thread_num(), omp_get_num_threads());
}
/** タスクB **/
#pragma omp section
{
printf("WORLD,from %d of %d\n",omp_get_thread_num(), omp_get_num_threads());
}
/** タスクC **/
#pragma omp section
{
printf("OPEN_MP,from %d of %d\n",omp_get_thread_num(), omp_get_num_threads());
}
}
return 0;
}