Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <omp.h>
- using namespace std;
- int main()
- {
- // private, shared, first private, last private - next
- #pragma omp parallel
- {
- for (int i = 0; i < 10; i++) {
- int tid = omp_get_thread_num();
- cout << "iteracja: " << i << " nr watku: " << tid << endl;
- }
- }
- /*omp_set_num_threads(1);
- #pragma omp parallel
- {
- #pragma omp sections
- {
- #pragma omp section
- {
- int tid = omp_get_thread_num();
- cout << "Tid: " << tid << endl;
- cout << "Hello World! " << endl;
- }
- #pragma omp section
- {
- int tid = omp_get_thread_num();
- cout << "Tid: " << tid << endl;
- cout << "Hello World! " << endl;
- }
- }
- }*/
- //cout << endl;
- //omp_set_num_threads(5);
- //#pragma omp parallel
- //{
- // int tid = omp_get_thread_num();
- // int threadNum = omp_get_num_threads();
- // if (tid == 0) {
- // cout << "Thread num: " << threadNum << endl;
- // }
- // //cout << "Hello World! " << tid << endl;
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement