Hyluss icon

[OpenMP] Schedule

Hyluss | PRO | 11/29/17 05:15:06 PM UTC | 0 ⭐ | 423 👁️ | Never ⏰ | []
C |

670 B

|

None

|

0 👍

/

0 👎

// 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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎