openmp transformed code

openmp transformed code

Is there a option in icc to get omp transformed code (with runtime functions calls) generated by the compiler for any input omp code, Like the following example in the intel openmp runtime documentation. 

extern float foo( void );
int main () {
int i;
float r = 0.0;
#pragma omp parallel for schedule(dynamic) reduction(+:r)
for ( i = 0; i < 10; i ++ ) {
     r += foo();
  }
}

Transformed code

extern float foo( void );
int main () {
	static int zero = 0;
	auto int gtid;
	auto float r = 0.0;
	__kmpc_begin( & loc3, 0 );
	// The gtid is not actually required in this example so could be omitted;
	// We show its initialization here because it is often required for calls into
	// the runtime and should be locally cached like this.
	gtid = __kmpc_global thread num( & loc3 );
	__kmpc_fork call( & loc7, 1, main_7_parallel_3, & r );
	__kmpc_end( & loc0 );
	return 0;
}
struct main_10_reduction_t_5 { float r_10_rpr; };
static kmp_critical_name lck = { 0 };
static ident_t loc10; // loc10.flags should contain KMP_IDENT_ATOMIC_REDUCE bit set
// if compiler has generated an atomic reduction.
void main_7_parallel_3( int *gtid, int *btid, float *r_7_shp ) {
	auto int i_7_pr;
	auto int lower, upper, liter, incr;
	auto struct main_10_reduction_t_5 reduce;
	reduce.r_10_rpr = 0.F;
	liter = 0;
	__kmpc_dispatch_init_4( & loc7,*gtid, 35, 0, 9, 1, 1 );
	while ( __kmpc_dispatch_next_4( & loc7, *gtid, & liter, & lower, & upper, & incr
	) ) {
		for( i_7_pr = lower; upper >= i_7_pr; i_7_pr ++ )
			reduce.r_10_rpr += foo();
	}
	switch( __kmpc_reduce_nowait( & loc10, *gtid, 1, 4, & reduce, main_10_reduce_5, &
			lck ) ) {
	case 1:
		*r_7_shp += reduce.r_10_rpr;
		__kmpc_end_reduce_nowait( & loc10, *gtid, & lck );
		break;
	case 2:
		__kmpc_atomic_float4_add( & loc10, *gtid, r_7_shp, reduce.r_10_rpr );
		break;
	default:;
	}
}

void main_10_reduce_5( struct main_10_reduction_t_5 *reduce_lhs,
		struct main_10_reduction_t_5 *reduce_rhs )
{
	reduce_lhs->r_10_rpr += reduce_rhs->r_10_rpr;
}

 

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Same question was answered in earlier forum post, see https://software.intel.com/en-us/forums/topic/506395.

Regards,
Andrey

Leave a Comment

Please sign in to add a comment. Not a member? Join today