[Omp] Subroutines inside parallel block
eric duncan
Eric.Duncan at sun.com
Thu Apr 14 06:26:27 PDT 2005
The parallel region in main creates a team of threads.
Each thread then executes the the region - in this case
the call to rank. In the subroutine, the master thread
executes the master region and all threads wait at the
barrier. All threads execute the sequential for and then
the threads do there respective chunks of the workshare
for. This continues through the subroutine and they return
to main where the threads join at the end of the parallel
region.
Sequential execution occurs in main until it reaches the
next parallel region, where a team of threads is again
"created". This region contains a for loop and each thread
executes this loop - calling rank where the same execution
process as before occurs.
If you put in some printf statements in the subroutine
printing out the thread number at various points and then
run the program, it might help you understand what is
going on.
Patricia Bittencourt Sampaio wrote:
> Hi Eric,
>
> Actually I wanted to know how the code is
> executed . I had some troubles with the Omni Compiler
> that I were using so I didn't have an opportunity to
> check this.
> I couldn't understand the main loop inside main
> routine. This loop is parallelized with a parallel
> directive. But no work sharing is used. And inside
> this loop there is a call to rank routine. It means
> that each tread calls rank MAX_ITERATIVES times,
> correct?
> I wonder what happens inside rank(). There are
> barrier and master directives, altough no parallel
> region or a for directive is used to comprise barrier
> and master directives. My question is what group of
> treads execute the rank in parallel, if no parallel
> region or for directive is defined.
>
> thanks,
>
> Patricia B. Sampaio
> ----------------------------
> University of Rio de Janeiro
>
>
> --- eric duncan <Eric.Duncan at sun.com> wrote:
>
>>Okay - this seems like a different question than
>>what I saw you post
>>before. In any case, what you sent was right from
>>the IS benchmark and
>>is correct. Now what exactly are you trying to do
>>with this code (i.e.,
>>what modifications are you trying to make)??
>>
>>Patricia Bittencourt Sampaio wrote:
>>
>>>
>>> Hi,
>>>
>>>--- eric duncan <Eric.Duncan at sun.com> wrote:
>>>
>>>
>>>
>>>>Now in your second note, you indicate that the
>>>>subroutine
>>>>has a master, barrier, and workshare for. These
>>>>can't be
>>>>contained within a workshare for.
>>>
>>>
>>> These clauses are defined in a parallel block.
>>>
>>> The code that I'm using is part of the NAS
>>
>>Parallel
>>
>>>Benchmarks version NPB2.3. It is the Integer Sort.
>>
>>I
>>
>>>have no idea about the restrictions of the source
>>
>>code
>>
>>>so I'm sending just the routines (Rand and Main)
>>
>>that
>>
>>>interest in this matter.
>>>
>>> I'd appreciate if someone were able to take a
>>
>>look.
>>
>>>
>>>Patricia B. Sampaio
>>>------------------------------------
>>>Federal University of Rio de Janeiro
>>>
>>>__________________________________________________
>>>Converse com seus amigos em tempo real com o
>>
>>Yahoo! Messenger
>>
>>>http://br.download.yahoo.com/messenger/
>>>
>>>
>>>
>>
> ------------------------------------------------------------------------
>
>>>_______________________________________________
>>>Omp mailing list
>>>Omp at openmp.org
>>>http://openmp.org/mailman/listinfo/omp_openmp.org
>>
>>
>
>
>
>
>
> Yahoo! Acesso Grátis - Internet rápida e grátis.
> Instale o discador agora! http://br.acesso.yahoo.com/
>
> _______________________________________________
> Omp mailing list
> Omp at openmp.org
> http://openmp.org/mailman/listinfo/omp_openmp.org
More information about the Omp
mailing list