[Omp] CTOR/DTOR invocation for variables in emptyparalleldirectives?

Hoeflinger, Jay P jay.p.hoeflinger at intel.com
Thu Nov 3 08:17:36 PST 2005


The OpenMP 2.5 specification states that a program must not depend on
the side effects of the evaluation of any clauses (page 28, second
restriction on the parallel construct).  Therefore, it appears that it
would not be conforming for a constructor or destructor of a private
variable to produce a side effect that the program depends on. Likewise,
none of the other clauses are permitted to produce a side effect that
the program depends on. 

Because of this, I believe that the compiler is free to dead-code any
empty parallel region.

Jay

-----Original Message-----
From: Omp-bounces at openmp.org [mailto:Omp-bounces at openmp.org] On Behalf
Of Diego Novillo
Sent: Tuesday, November 01, 2005 4:27 PM
To: Tian, Xinmin
Cc: omp at openmp.org
Subject: Re: [Omp] CTOR/DTOR invocation for variables in
emptyparalleldirectives?

On Tuesday 01 November 2005 17:15, Tian, Xinmin wrote:

> If users have this type of code, the performance may not be a big
> concern for users. In general, users can always use lower optimization
> (O0 or Od), so the compiler can still generate threaded code for empty
> parallel region by not being smart to remove it.
>
Thanks.  Though what I really need to clarify is whether the compiler is

*allowed* to elide that construct.

With our current implementation, GCC will remove the whole parallel 
directive regardless of optimization level.  No threaded code will be 
generated with

	#pragma omp parallel private (a)
	  {
	  }

Would the compiler be standard conforming if it converted the above into
a 
NOP?


Thanks.

_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp_openmp.org




More information about the Omp mailing list