The #pragma _KAP concurrent call
assertion tells KAP
that the function calls in the immediately following loop can
execute in parallel. KAP ignores all potential data dependences
due to function arguments.
This assertion does not apply to any nested or surrounding loops.
Place the concurrent call
assertion before each loop
with function references that can execute in parallel, as shown in
the following example:
main() { double x[800][5000]; int row,col; float time1,time2; csettime_(1000); time1 = ctimec_(); #pragma _KAP concurrent call for(row=0; row<800; row++){ for(col=0; col <5000; col++){ x[row][col]=sin(-(double)(row)) + sin(-(double)(row)); } } time2 = ctimec_(); printf("time: %f\n",time1-time2); }
Using the #pragma _KAP concurrent call
assertion and
processing with the /unroll=1
and /conc
qualifiers causes KAP to generate the following code:
int main( ) { double x[800][5000]; int row; int col; float time1; float time2; int _Kii1; int _Kii2; void PKmain0( ); csettime_( 1000 ); time1 = ctimec_( ); mppfrk_( PKmain0, 1, x ); time2 = ctimec_( ); printf( "time: %f\n", time1 - time2 ); mppend_( ); } void PKmain0( _mppid_, _mppnpr_, _Kaa1 ) long _mppid_; long _mppnpr_; double _Kaa1[800][5000]; { int _Kii1; int _Kii2; long _Kii3; long _Kii4; long _Kii5; _Kii5 = 799 / _mppnpr_ + 1; _Kii3 = _mppid_ * _Kii5; _Kii4 = ((799)<(_Kii3 + _Kii5 - 1) ? (799) : (_Kii3 + _Kii5 - 1)); for ( _Kii1 = _Kii3; _Kii1<=_Kii4; _Kii1++ ) { for ( _Kii2 = 0; _Kii2<=4999; _Kii2++ ) { _Kaa1[_Kii1][_Kii2] = sin( -(double )(_Kii1) ) + sin( -(double )(_Kii1) ); } } }
KAP does not generate parallel code if you use the
/noconcurrentize
command-line qualifier.