CDVM_PD (1158342), страница 2
Текст из файла (страница 2)
(long*)a,
DVM1A(n), /*1124*/
/*LowShWidthArray*/ DVM##k##A ls,
/*HiShWidthArray*/ DVM##k##A hs,
/*CornerSignPtr */ DVM1A(corner),
sizeof(a), sizeof(a[0])
)
NOTE. inssh_A is auxiliary interface function to use Lib-DVM's
inssh_ for arrays of DVM-arrays.
1.10Directives SHADOW_START, SHADOW_WAIT
Syntax.
DVM ( SHADOW_START <sgid> );
DVM ( SHADOW_WAIT <sgid> );
Executable. Invoke corresponding RTL function.
Macro DVM_SHADOW_START(sg) with extension
strtsh_(/*ShadowGroupRefPtr*/&sg)
Macro DVM_SHADOW_WAIT(sg) with extension
waitsh_(/*ShadowGroupRefPtr*/&sg)
1.11Directive PARALLEL with subdirectives SHADOW_RENEW, SHADOW_START, SHADOW_WAIT, REDUCTION, REMOTE_ACCESS
Syntax.
DVM ( PARALLEL "[" <var> "]" ... ON <base> "[" [<expr>] "]"...
[<sub-directives>] )
<loop-nest>
Structured. Parallelized loop on every processor performs not all iteration, but only local part of index space. So loop headers should be changed. Moreover not all local iterations will be performed at once: subdirectives SHADOW_START and SHADOW_WAIT request shadow operation to be performed in the midst of loop execution. So loop by parts of local index space should be inserted.
Macro DVM_PARALLEL(n,r) with extension
long DVM_LO##n[r]; // arrays for local loop ranges
long DVM_HI##n[r];
long DVM_ST##n[r];
LoopRef DVM_LP##n; // declare loop header;
DVM_LP##n=crtpl_(/*RankPtr*/r); // create loop
Macro DVM_DO_ON(n,r,vs,ls,hs,ss,base,rb,is,as,bs) with
extension
mappl_(
/*LoopRefPtr */ &DVM_LP##n,
/*PatternRefPtr */ base,
/*AxisArray */ is,
/*CoeffArray */ as,
/*ConstArray */ bs,
/*LoopVarAddrArray*/ vs,
/*InpInitIndexArray*/ ls,
/*InpLastIndexArray*/ hs,
/*InpStepArray */ ss,
/*OutInitIndexArray*/DVM_LO##n,
/*OutLastIndexArray*/DVM_HI##n,
/*OutStepArray */ DVM_ST##n);
DVM_PLOOP(n,r,ls,hs,ss); // trace macroes
DVM_BPLOOP(n);
while(dopl_(/*LoopRefPtr */&DVM_LP##n))
{
Macro DVM_FOR(n,v,k,lh) with extension
// parallel loop header with local range
for(v=DVM_LO##n[k]; v<=DVM_HI##n[k]; v+=DVM_ST##n[k])
Macro DVM_REDBLACK(n,v,k,e,lh) with extension
for(v=DVM_LO##n[k]+(DVM_LO##n[k]+e)%2;
v<=DVM_HI##n[k]; v+=2)
Macro DVM_END_PARALLEL( n,beg) with extension
}
DVM_ENDLOOP(n,beg); // trace macroes
DVM_ELOOP(n,beg);
endpl_(/*LoopRefPtr*/ &DVM_LP##n) // close loop
3.111.1 Subdirective SHADOW_RENEW
Syntax.
SHADOW_RENEW <arrid> [ "[" [<lowwidth> [ : <highwidth>]] "]"]...
Shorthand for CREATE_SHADOW_GROUP+SHADOW_START+SHADOW_WAIT
before the loop.
Macro DVM_SHADOW_RENEW(n,das) with extension
{ShadowGroupRef DVM_SG; // declare implicit group
DVM_SG=crtshg_(/*StaticSignPtr */0); // create
das; // insert arrays to group (DVM_SHADOWS(...))
strtsh_(/*ShadowGroupRefPtr*/&DVM_SG); // start
waitsh_(/*ShadowGroupRefPtr*/&DVM_SG); // wait
delshg_(/*ShadowGroupRefPtr*/&DVM_SG); // delete group
}
3.111.2 Subdirectives SHADOW_START, SHADOW_WAIT
Syntax.
SHADOW_START <sgid>
SHADOW_WAIT <sgid>
Inform RTL that order of iterations should be changed.
Macro DVM_PAR_SHADOW_START(n,sg) with extension
exfrst_(
/*LoopRefPtr */ &DVM_LP##n,
/*ShadowGroupRefPtr*/&sg)
Macro DVM_PAR_SHADOW_WAIT(n,sg) with extension
imlast_(
/*LoopRefPtr */ &DVM_LP##n,
/*ShadowGroupRefPtr*/&sg)
3.111.3 Subdirective REDUCTION
Syntax.
REDUCTION <red_function> ( <var> [,<loc data>] ) ...
Shorthand for CREATE_REDUCTION_GROUP before the loop and
REDUCTION_START+REDUCTION_WAIT after the loop.
Macro DVM_REDUCTION(rvn,rvs) with extension
{RedGroupRef DVM_RG; // implicit group
DVM_RG=crtrg_( // create
/*StaticSignPtr */ 1,
/*DelRVSignPtr */ 1);
(void)rvs; // insert variables
saverv_(/*RedGroupRefPtr*/ &DVM_RG) // save initial values
Macro DVM_END_REDUCTION() with extension
strtrd_(/*RedGroupRefPtr*/ &DVM_RG);
waitrd_(/*RedGroupRefPtr*/ &DVM_RG);
delrg_(/*RedGroupRefPtr*/ &DVM_RG);} /*;*/
1.12 Directive REDUCTION_GROUP
Syntax.
DVM ( REDUCTION_GROUP ) void * <rgid>;
Declarative. Mark variable as reduction group handler and replace declaration 'void * <rg>;' by 'ReductionGroupRef <rg>;'.
1.13Directive CREATE_REDUCTION_GROUP
Syntax.
DVM ( CREATE_REDUCTION_GROUP <rgid> :
<red_function> ( <var> [,<loc data>] )
... );
Executable. Fill the group by descriptions of listed reduction
functions.
Macro DVM_CREATE_REDUCTION_GROUP(rg,rvn,rvars) with extension
{RedGroupRef DVM_RG; // declare temporary group
DVM_RG=crtrg_( // create
/*StaticSignPtr */ 1,
/*DelRVSignPtr */ 1);
(void)rvars; // insert variables (macroes RVAR)
saverv_(/*RedGroupRefPtr*/ &DVM_RG); // save initial values
rg=DVM_RG;
}
Macro DVM_RVAR(f,v,t,l) with extension
insred_(
/*RedGroupRefPtr*/ &DVM_RG,
/*RedVarRefPtr */ (
(long)crtred_(
/*RedFuncNumbPtr*/ f,
/*RedArrayPtr */ &(v),
/*RedArrayTypePtr*/ t,
/*RedArrayLength...Ptr?*/ l,
/*LocArrayPtr */ 0,
/*LocElmLengthPtr*/ 0,
/*StaticSignPtr */ 1))
)
Macro DVM_RLOC(f,v,t,l,loc) with extension
insred_(
/*RedGroupRefPtr*/ &DVM_RG,
/*RedVarRefPtr */ (
(long)crtred_(
/*RedFuncNumbPtr*/ f,
/*RedArrayPtr */ &(v),
/*RedArrayTypePtr*/ t,
/*RedArrayLength...Ptr?*/ l,
/*LocArrayPtr */ &(loc),
/*LocElmLengthPtr*/ sizeof(loc),
/*StaticSignPtr */ 1))
)
1.14Directive REDUCTION_START, REDUCTION_WAIT
Syntax.
DVM ( REDUCTION_START <rgid> );
DVM ( REDUCTION_WAIT <rgid> );
Executable. Invoke corresponding RTL function.
Macro DVM_REDUCTION_START(rg) with extension
strtrd_(&rg)
Macro DVM_REDUCTION_WAIT(rg) with extension
waitrd_(&rg);
delrg_(&rg)
1.15Directive REMOTE_ACCESS
Syntax.
DVM ( REMOTE_ACCESS <id> "[" [<expr>] "]"... ... ) <operator>
Structured. Before operator, marked with the directive, insert operators to create buffers of appropriate shape and to copy requested remote data. In the operator accesses to remote data should be replaced by accesses to the buffer(s). After the operator the buffer(s) should be deleted.
1.16Directive INTERVAL
Syntax.
DVM ( INTERVAL [<expr>] ) <operator>
Structured. Before and after marked operator invoke corresponding performance analyzer function.
1.17Other the analyzer means
Implicit. Mark parallel and sequential loops.
Macro DVM_BPLOOP(n) with extension
bploop_(n);
Macro DVM_ELOOP(n,beg) with extension
eloop_(n,beg);
Macro DVM_BSLOOP(n) with extension
bsloop_(n);
1.18The tracer means
Trace access to variable, assignment to variable and register stored (initialized) variable. Mark start and end of loop execution and fix every iteration.
Macro DVM_LDV(type,rt,var,base) with extension
*(type*)(dldv_(rt,var,base,#var,-1) )
Macro DVM_STVA(type,rt,var,base,rhs) with extension
(dprstv_(rt, var, base, #var, -1), var = rhs, dstv_())
Macro DVM_STV(type,rt,var,base) with extension
(dprstv_(rt, var, base, #var, -1), dstv_())
Macro DVM_PLOOP(n,r,ls,hs,ss) with extension
dbegpl_(r,n,ls,hs,ss);
Macro DVM_SLOOP(n) with extension
dbegsl_(n);
Macro DVM_ENDLOOP(n,beg) with extension
dendl_(n,beg);
Macro DVM_ITER(r,vars) with extension
diter_(vars);
1.19Input/Output Statements
Compilation of input-output functions may be reduced to renaming of <ffff> to its RTL analog dvm_<ffff>. Distributed arrays allowed to be used only in functions fread() and fwrite(). In this case array is read or written as a whole, i.e. size parameter of function is ignored.
1.20Start/end program execution
Implicit. Initialize and finalize RTL.
Macro DVM_INIT(argn,args) with extension
rtl_init(0L,argn,args);
Macro DVM_RETURN(r) with extension
lexit_(r);
Macro DVM_EXIT(r) with extension
lexit_(r);















