Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <omp.h>
- using namespace std;
- void A()
- {
- printf("A\n");
- }
- void B()
- {
- printf("B\n");
- }
- void C()
- {
- printf("C\n");
- }
- void D()
- {
- printf("D\n");
- }
- void E()
- {
- printf("E\n");
- }
- int main(void)
- {
- #pragma omp parallel num_threads(10)
- {
- int id_thr = omp_get_thread_num();
- if (id_thr == 0)
- {
- A();
- }
- else if (id_thr == 1)
- {
- B();
- }
- else if (id_thr == 2)
- {
- C();
- }
- #pragma omp barrier
- { if (id_thr == 4)
- {
- D();
- }
- #pragma omp barrier
- if (id_thr == 5)
- {
- E();
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement