Thread: OpenMP: Difference between parallel & workshare constructs

  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, 05:40 PM
  2. C++ constructs
    By tsubasa in forum C++ Programming
    Replies: 3
    Last Post: 05-27-2006, 12:54 PM
  3. OpenMP parallel threads for matrix multiplier
    By collymitch in forum C Programming
    Replies: 0
    Last Post: 04-07-2005, 04:38 PM
  4. undefined and implementation specific constructs
    By curlious in forum C++ Programming
    Replies: 1
    Last Post: 12-18-2003, 05:52 PM