OpenMP: Difference between parallel & workshare constructs

This is a discussion on OpenMP: Difference between parallel & workshare constructs within the Tech Board forums, part of the Community Boards category; Hi, Wrt the openmp constructs parallel and work-share, how the following constructs work: 1) #pragma omp for 2) #pragma omp ...

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    18

    OpenMP: Difference between parallel & workshare constructs

    Hi,

    Wrt the openmp constructs parallel and work-share, how the following constructs work:



    1) #pragma omp for

    2) #pragma omp parallel for



    Are these both statements have same effect? or different?

    For example:

    Code:
         for ( i=1; i<=20; i++)
         {
          lines of code here;
         }
    If this loop is executed under the construct (1), it will divide the loop iterations to chunks but will not execute in parallel.

    But with construct (2), the loop iterations are divided as well as executed in parallel & simultaneously.

    Is this my understanding correct?

    Thanks

  2. #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. openmp
    By l2u in forum Tech Board
    Replies: 0
    Last Post: 04-12-2007, 06:40 PM
  2. C++ constructs
    By tsubasa in forum C++ Programming
    Replies: 3
    Last Post: 05-27-2006, 01:54 PM
  3. OpenMP parallel threads for matrix multiplier
    By collymitch in forum C Programming
    Replies: 0
    Last Post: 04-07-2005, 05:38 PM
  4. undefined and implementation specific constructs
    By curlious in forum C++ Programming
    Replies: 1
    Last Post: 12-18-2003, 05:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21