// prir lab2iPol.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
int _tmain(int argc, _TCHAR* argv[])
{
int i, n, id, chunk_size;
n = 10; chunk_size = 5;
#pragma omp parallel default(none) private(i, id) shared(n, chunk_size)
{
#pragma omp single
{
printf("Program jest wykonywany na %d watkach.\n", omp_get_num_threads());
}
#pragma omp for schedule(static, chunk_size)
for (i = 0; i < n; i++)
{
id = omp_get_thread_num();
printf("Iteracja %d wykonana przez watek nr. %d.\n", i, id);
}
}
return 0;
}
Comments
0 B
|👍
/👎