Examples of CubePL expressions

# Simple Examples

1. Calculation of an arithmetical expression
123.4 + 234 -( 23)^2
2. Calculation of an arithmetical expression with different functions
sin(23 + ln(12))

# Complex Examples

## Different made-up expressions

1. Definition of a constant function
{ return 24; }
2. Definition of a more complex function
{ return sin ({ return 1; }); }
3. Definition of a function with an access to one variable
{\${a}=123; return \${a}; }
4. Definition of a function with a control structure
{
\${a}=metric::visits();
\${b}=0;
if (\${a}>100)
{ \${b}=metric::time(); };
return \${b};
}
5. Definition of a function with a loop structure
{
\${a}=0; \${b}=0;
while (\${a}<123)
{
\${b}=\${b}+metric::time();
\${a}=\${a}+1;
};
return \${b};
}
6. Definition of a function with a access to predefined variable
{
\${a}=0;
if (\${calculation::region::name}[\${calculation::callpath::id}] =~ /^MPI_/)
{
\${a}=metric::time();
};
return \${a};
}

## Special metrics of Scalasca

1. Calculation of an average runtime of a call path (Kenobi metric, postderived)
metric::time(i)/metric::visits(e)
2. Calculation of the time, spend in MPI synchronization calls
1. (initialization )
{
global(mpi_synchronization);
\${i}=0;
while( \${i} < \${cube::#callpaths} )
{
\${mpi_synchronization}[\${i}] = 0;
\${regionid} = \${cube::callpath::calleeid}[\${i}] ;
if (
(\${cube::region::paradigm}[ \${regionid} ] seq "mpi")
and
(
(\${cube::region::name}[\${regionid} ] seq "mpi_barrier" )
or
(\${cube::region::name}[\${regionid} ] seq "mpi_win_post" )
or
(\${cube::region::name}[\${regionid} ] seq "mpi_win_wait" )
or
(\${cube::region::name}[\${regionid} ] seq "mpi_win_start" )
or
(\${cube::region::name}[\${regionid} ] seq "mpi_win_complete" )
or
(\${cube::region::name}[\${regionid} ] seq "mpi_win_fence" )
or
(\${cube::region::name}[\${regionid} ] seq "mpi_win_lock" )
or
(\${cube::region::name}[\${regionid} ] seq "mpi_win_unlock" )
)
)
{
\${mpi_synchronization}[\${i}] = 1;
};
\${i} = \${i} + 1;
};
return 0;
}
2. (actual calculation )
{
\${a}=0;
if ( \${mpi_synchronization}[\${calculation::callpath::id} ]== 1 )
{
\${a} = metric::time(*,*)-metric::omp_idle_threads(*,*);
};
return \${a};
}
3. Calculation of thecComputational load imbalance (single participant)

– NO EXAMPLE YET –

 Copyright © 1998–2015 Forschungszentrum Jülich, Jülich Supercomputing Centre