DVM debugger - contents | Part 1 (1 - 4) | Part 2 (5 - 6.4) | Part 3 (6.5) | Part 4 (7) |
document data: March 2000 | - last edited 22.05.01 - |
6.5 Realization of comparing execution results
6.5.1 Base structures of comparing execution results module
The structure of tracing is divided into two parts. The first part represents a hierarchy exposition of program structures. It maps an enclosure of structures, parameters of trace gathering for the each structure and other information. The structures hierarchy and their parameters are read from the trace configuration file when tracing is initialized. If the given file is not specified or its structure is broken, the structure description hierarchy is formed during trace gathering. Note that in the trace-comparing mode, the given file is not read and the structure parameters are taken from the standard trace file.
The array of trace records represents the second part of tracing. This array uses TABLE structure. During trace accumulation, the coherence of trace records and structure hierarchy is supported. When a new event of structure beginning occurs, the pointer to the corresponding structure description is stored with the new trace record. If the structure description is absent, a new structure description with defaults is dynamically created.
The each trace record of the structure beginning keeps trace record numbers of the all iteration or tasks of the structure. The hash-table is used for keeping these numbers.
Figure 4. Trace structure
The subsystem of comparing execution results consists of the following base modules: trace reading module, trace writing module, trace accumulation module, trace comparing module, and reduction processing module. Each of this modules is accessing dependently on parameters and modes of comparing execution results subsystem.
The trace accumulation functions forms records in the trace array. If the mode of direct writing to a file is specified then trace records arent created in the memory and are written to a trace-file right away by using trace writing module. In the trace comparing mode the trace reading module uses trace accumulation functions for forming trace in the memory.
The structures of comparing execution results subsystem are shown below.
Program structure description:
typedef struct tag_STRUCT_INFO |
{ |
long | No; | |||||
char | File[MaxSourceFile]; | |||||
unsigned long | Line; | |||||
enum_TraceLevel | TraceLevel; | |||||
enum_TraceLevel | RealLevel; | |||||
byte | bSkipExecution; | |||||
s_COLLECTION | cChildren; | |||||
byte | Type; | |||||
byte | Rank; | |||||
s_REGULARSET | Limit[MAXARRAYDIM]; | |||||
s_REGULARSET | Current[MAXARRAYDIM]; | |||||
s_REGULARSET | Common[MAXARRAYDIM]; | |||||
long | CurIter[MAXARRAYDIM]; | |||||
struct tag_ STRUCT _INFO* | pParent; | |||||
unsigned long | Bytes; | |||||
unsigned long | StrCount; | |||||
unsigned long | Iters; | |||||
} | STRUCT_INFO; |
No | | unique structure number. | ||||
File | | the file name where the program structure is located. | ||||
Line | | line number of beginning the structure. | ||||
TraceLevel | | the trace level of the structure (full, only variable modifications, minimal or disabled). | ||||
RealLevel | | the trace level that is actually used for the structure. | ||||
bSkipExecution | | this flag determines the tracing mode of the structure dependently on traced iteration range of parent structure. | ||||
cChildren | | the collection of descriptions of inner structures. | ||||
Type | | structure type (parallel or sequential loop, task region). | ||||
Rank | | structure rank (defines the rank of parallel loop). | ||||
Limit | | iteration limitations of structure tracing. | ||||
Current | | current ranges of structure iterations. | ||||
Common | | the most common limits of structure iterations. | ||||
CurIter | | the current values of iteration variables. | ||||
pParent | | refer to the parent structure description. | ||||
Bytes | | size of full trace of the structure. | ||||
StrCount | | the string count of trace of the structure. | ||||
Iters | | the number of executed structure iterations. |
The following structures describe the records for different trace types.
The record type of completion self-calculation block in the sequential part of a program:
typedef struct tag_SKIP |
{ | ||||||
byte | RecordType; | |||||
char | File[MaxSourceFile]; | |||||
unsigned long | Line; | |||||
} | SKIP; |
RecordType | | record type; | ||||
File | | the source file name of DVM-program; | ||||
Line | | the line number of DVM-program. |
The record type of program structure beginning:
typedef struct tag_STRUCT_BEGIN |
{ |
byte | RecordType; | |||
char | File[MaxSourceFile]; | |||
unsigned long | Line; | |||
long | Parent; | |||
long | LastRec; | |||
struct tag_STRUCT_INFO * | pCnfgInfo; | |||
HASH_TABLE | hIters; | |||
} | STRUCT_BEGIN; |
RecordType | | record type; | ||
File | | the source file name of DVM-program; | ||
Line | | the line number of DVM-program; | ||
Parent | | the number of parental trace record; | ||
LastRec | | the number of trace record of the structure completion; | ||
pCnfgInfo | | pointer to the structure description; | ||
hIters | | hash-table that keeps numbers of records of iteration beginning. |
The record type of program structure completion:
typedef struct tag_STRUCT_END |
{ | ||||||
byte | RecordType; | |||||
char | File[MaxSourceFile]; | |||||
unsigned long | Line; | |||||
long | Parent; | |||||
struct tag_STRUCT_INFO* | pCnfgInfo; | |||||
} | STRUCT_END; |
RecordType | | record type; | ||||
File | | the source file name of DVM-program; | ||||
Line | | the line number of DVM-program; | ||||
Parent | | the number of parental trace record; | ||||
pCnfgInfo | | pointer to the structure description. |
The record type of loop iteration or parallel task beginning:
typedef struct tag_ITERATION |
{ | ||||||
byte | RecordType; | |||||
long | Index[MAXARRAYDIM]; | |||||
long | LI; | |||||
char | Checked; | |||||
long | Parent; | |||||
byte | Rank; | |||||
} | ITERATION; |
RecordType | | record type. | ||||
Index | | values of iteration variables. | ||||
LI | | absolute iteration index. | ||||
Checked | | it is equal to one if the iteration has been performed. This flag is used to check repeated execution of iterations. | ||||
Parent | | the number of parental trace record. | ||||
Rank | | iteration rank. It is equal to owner structure rank. |
The record type of variable accessing or reduction results:
typedef struct tag_VARIABLE |
{ | ||||||
byte | RecordType; | |||||
long | vType; | |||||
char | Operand[MaxOperand]; | |||||
char | File[MaxSourceFile]; | |||||
unsigned long | Line; | |||||
byte | Reduct; | |||||
VALUE | val; | |||||
} | VARIABLE; |
RecordType | | record type. | ||||
vType | | variable type. The program tracing supports the following four types: int, long, float and double. | ||||
Operand | | variable name. | ||||
File | | the source file name of DVM-program. | ||||
Line | | the line number of DVM-program. | ||||
Reduct | | it is equal to 1, if the reduction variable is used. | ||||
val | | variable value. |
The TRACE type describes common trace structure. The system contains only one global variable Trace of this type:
typedef struct tag_TRACE |
{ | ||||||
TABLE | tTrace; | |||||
s_COLLECTION | cStructs; | |||||
TABLE | tBegStructs; | |||||
long | CurIter; | |||||
long | CurStruct; | |||||
long | CurTraceRecord; | |||||
long | CurPreWriteRecord; | |||||
byte | IterFlash; | |||||
byte | ReductExprType; | |||||
STRUCT_INFO* | pCurCnfgInfo; | |||||
int | ErrCode; | |||||
int | Level; | |||||
unsigned long | Bytes; | |||||
unsigned long | StrCount; | |||||
unsigned long | Iters; | |||||
FILE * | TrcFileHandle; | |||||
unsigned long | TraceRecordBase; | |||||
unsigned | FloatPrecision; | |||||
} | TRACE; | |||||
tTrace | | table of trace records. | ||||
cStructs | | a set of the of root structure descriptions. | ||||
tBegStructs | | the table that contains trace numbers of all loop beginning records. | ||||
CurIter | | the trace number of current executed iteration. | ||||
CurStruct | | the trace number of current executed structure. | ||||
CurTraceRecord | | the trace number of current processed trace record. | ||||
CurPreWriteRecord | | the trace number of beginning current executed term. | ||||
IterFlash | | the postponed iteration recording flag. | ||||
ReductExprType | | the type of reduction variable accessing. | ||||
pCurCnfgInfo | | pointer to the current structure description. | ||||
ErrCode | | the code of the last detected error. | ||||
Level | | trace level of the program. | ||||
Bytes | | size of the full trace of the sequential program part. | ||||
StrCount | | the string count of trace of the sequential program part. | ||||
Iters | | the summary number of all executed loop iterations and parallel tasks. It is used for calculating memory volume. | ||||
TrcFileHandle | | the trace file handle. | ||||
TraceRecordBase | | the line number of the trace file from which the trace records are written. This field is used for diagnostic messages. | ||||
FloatPrecision | | the number of digits after the decimal point. This field is calculated from the TraceOptions.Exp parameter. |
The following functions are intended for work with comparing execution results module. These functions use functions of trace writing, reading, accumulation and comparing modules dependently from the current assigned parameters and current trace mode.
void cmptrace_Init(void) |
The function initializes the structures of comparing execution results module. If the trace comparing mode is selected then the function reads standard trace file and loads it into the memory. If the trace-accumulation mode is selected then the function reads trace configuration file and parameters of program structures.
void cmptrace_ReInit(void) |
The function prepares internal structures to begin comparing execution trace with reference trace after reading standard trace from a file.
void cmptrace_Done(void) |
The function uninitializes structures of comparing execution results module. It frees all allocated memory and forms standard trace file and loop description file if corresponding trace modes are turned on.
void cmptrace_Read(void) |
The function reads the standard trace file or/and the trace configuration file according to the current trace mode.
void cmptrace_Write(void) |
The function forms the standard trace file or trace configuration file according to the current trace mode.
The following functions call functions of the accumulation or comparing modules according to the current trace mode:
void cmptrace_BeginSeqLoop( char *File, unsigned long Line, long No ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
No | | unique structure number. |
The function generates a trace event of the sequential loop beginning.
void cmptrace_BeginParLoop( char *File, unsigned long Line, long No, byte Rank, long *Init, long *Last, long *Step ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
No | | unique structure number; |
Rank | | loop rank; |
Init | | the array of initial values of iteration variables; |
Last | | the array of end values of iteration variables; |
Step | | the array of iteration variables steps. |
The function generates a trace event of the parallel loop beginning.
void cmptrace_BeginTaskRegion( char *File, unsigned long Line, long No ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
No | | unique structure number. |
The function generates a trace event of the task region beginning.
void cmptrace_EndStruct(
char *File, unsigned long Line, long No, unsigned long BegLine ) |
||||
File | | the source file name of DVM-program; | ||
Line | | the line number of DVM-program; | ||
No | | unique structure number; | ||
BegLine | | line number of the structure beginning. |
The function generates a trace event of the finishing of a loop or task region.
void cmptrace_Iter( AddrType *index ) | ||||
index | | array of pointers to iteration variables. |
The function generates a trace event of the new iteration or parallel task beginning.
void
cmptrace_PreStoreVar( char *File, unsigned long Line,
char *Operand, long Type, byte Reduct ) |
||||
File | | the source file name of DVM-program; | ||
Line | | the line number of DVM-program; | ||
Operand | | variable name; | ||
Type | | variable type; | ||
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function enervates a trace event of the beginning of an expression calculation.
void
cmptrace_PostStoreVar( char* File, unsigned long Line,
char* Operand, long Type, void* Value, byte Reduct ) |
||||
File | | the source file name of DVM-program. | ||
Line | | the line number of DVM-program. | ||
Operand | | variable name. | ||
Type | | variable type. | ||
Value | | variable address. | ||
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function generates a trace event of the finishing of an expression calculation and storing the expression result into a variable.
void cmptrace_LoadVar(
char* File, unsigned long Line, char* Operand, long Type, void* Value, byte Reduct ) |
||
File | | the source file name of DVM-program. |
Line | | the line number of DVM-program. |
Operand | | variable name. |
Type | | variable type. |
Value | | variable address. |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function generates a trace event of the reading from a variable.
void cmptrace_ReductVar(
char *File, unsigned long Line, long Type, void *Value, byte Wait ) |
||
File | | the source file name of DVM-program. |
Line | | the line number of DVM-program. |
Operand | | variable name. |
Type | | variable type. |
Value | | variable address. |
Wait | | wait reduction flag. It is equal to one if reduction result will be stored in the trace only after a current loop finishing. |
The function generates a trace event of the completion reduction calculation.
void cmptrace_SkipBlock( char *File, unsigned long Line ) | ||||
File | | the source file name of DVM-program; | ||
Line | | the line number of DVM-program. |
The function generates a trace event of finishing the self-calculation block in the sequential program part.
The following functions are intended for work with descriptions of program structures.
STRUCT_INFO* trc_InfoNew(STRUCT_INFO* pParent) | ||
pParent | | pointer to the description of enclosing program structure. |
The function allocates and initializes a new structure description. The function returns a pointer to the new structure.
void trc_InfoDone(STRUCT_INFO* pInfo) | ||
pInfo | | pointer to the description of program structure. |
Destructor of the description of program structure.
int trc_InfoCanTrace(STRUCT_INFO* pInfo, int nRecType) | |||
pInfo | | pointer to the description of current executed program structure; | |
nRecType | | type of the trace event. |
The function checks the structure trace level and entrance of the current structure iteration in a range of traced iterations. It returns non zero value if the specified trace event can be traced.
void trc_InfoSetup(STRUCT_INFO* pInfo, long *Init, long *Last, long *Step) | ||
pInfo | | pointer to the description of program structure; |
Init | | the array of initial values of iteration variables; |
Last | | the array of end values of iteration variables; |
Step | | the array of iteration variables steps. |
The function prepares the structure description for beginning the structure execution.
STRUCT_INFO*
trc_InfoFindForCurrentLevel(long No, byte Type, byte
Rank, unsigned long Line) |
||
No | | unique structure number; |
Type | | structure type (parallel or sequential loop, task region); |
Rank | | structure rank; |
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program. |
The function searches a structure description in the current level by the specified parameters.
STRUCT_INFO* trc_InfoFindByNo(long No, s_COLLECTION *pColl) | |||
No | | unique structure number; | |
pColl | | collection of descriptions of program structures. |
The function recursively searches a structure description by the structure number.
The functions of trace writing module are intended for forming trace file and trace configuration file. The functions have the following prototypes:
void trc_wrt_header(
s_COLLECTION* pStructs, int Level, FILE *hf, int nWriteInfo ) |
||
pStructs | | a set of structure descriptions of the top level. |
Level | | current processed level. This parameter is used for the recursive calls. |
hf | | opened file handle. |
nWriteInfo | | it is equal to 1, if an additional trace information should be written in to the loop description file. |
The function forms the trace configuration file. It recursively calls itself with Level+1 and set of inner structures of each structure from the pStructs.
void trc_wrt_trace( FILE *hf ) | |||
hf | | open file handle. |
The function forms standard trace file.
size_t trc_wrt_beginstruct( FILE *hf, STRUCT_BEGIN *pStruct) | ||
hf | | open file handle; |
pStruct | | pointer to the trace record of the structure beginning. |
The function writes the record of structure beginning into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_enstruct( FILE *hf, STRUCT_END* pStruct) | ||
hf | | open file handle; |
pStruct | | pointer to the trace record of the structure finishing. |
The function writes the record of structure finishing into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_iter( FILE *hf, ITERATION *Iter ) | ||
hf | | open file handle; |
Iter | | pointer to the trace record of the iteration or task beginning. |
The function writes the record of iteration or task beginning into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_readvar( FILE *hf, VARIABLE *Var ) | ||
hf | | open file handle; |
Var | | pointer to the trace record of the variable usage. |
The function writes the record of variable reading into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_prewritevar( FILE *hf, VARIABLE *Var ) | ||
hf | | open file handle; |
Var | | pointer to the trace record of the variable usage. |
The function writes the record of beginning expression calculation into the standard trace file and returns the size of the written record in bytes.
size_t trc_wrt_postwritevar( FILE *hf, VARIABLE *Var ) | ||
hf | | open file handle; |
Var | | pointer to the trace record of the variable usage. |
The function writes the record of finishing expression calculation into the standard trace file and returns the size of the written record in bytes.
size_t trc_wrt_reductvar( FILE *hf, VARIABLE *Var ) | ||
hf | | open file handle; |
Var | | pointer to the trace record of the variable usage. |
The function writes the record of completion reduction calculation into the standard trace file. The size of the written record in bytes is returned.
size_t trc_wrt_variable( FILE *hf, VARIABLE *Var, int iType ) | ||
hf | | open file handle |
Var | | pointer to the trace record of the variable usage |
iType | | trace record type |
The common function of writing a variable usage record into the standard trace file. The size of the written record in bytes is returned.
size_t trc_wrt_skip( FILE *hf, SKIP *Skip ) | ||
hf | | open file handle |
Skip | | pointer to the record of finishing self-calculation block |
The function writes the record of finishing self-calculation block in a sequential branch of the program. The size of the written record in bytes is returned.
void trc_wrt_calctraceinfo(void) |
The function calculates the trace size for the each program structure and common trace size.
void trc_wrt_calcinfo(STRUCT_INFO* pInfo) | ||||
pInfo | | pointer to the description of program structure |
The function calculates the trace size for the specified structure.
6.5.3 Trace accumulation module
Trace accumulation functions form trace records in the global trace table. If the cross-passage mode of writing is specified then these functions do not form trace records in the memory but write them to the file using trace writing module functions.
If the trace-comparing mode is specified then these functions are used by trace reading module for reading trace file and forming trace structure in the memory.
void trc_put_beginstruct(
char *File, unsigned long Line, long No, byte Type, byte Rank, long *Init, long *Last, long *Step ) |
||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
No | | unique structure number; |
Type | | structure type (parallel or sequential loop, task region); |
Rank | | structure rank; |
Init | | the array of initial values of iteration variables; |
Last | | the array of end values of iteration variables; |
Step | | the array of iteration variables steps. |
The function puts the record of the structure beginning into the trace table.
void
trc_put_endstruct(char *File, unsigned long Line, long
No, unsigned long BegLine) |
||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
No | | unique structure number; |
BegLine | | line number of the structure beginning. |
The function puts the record of the structure finishing into the trace table.
void trc_put_iteration( AddrType *index ) | ||
index | | array of pointers to iteration variables. |
The function puts the record of an iteration or task beginning into the trace table. If the mode of writing empty iterations is not specified then the record really will be put into the trace table only after beginning an inner structure or variable accessing inside this iteration.
void trc_put_iteration_flash_par( byte Rank, long *Index, long LI ) | ||
Rank | | iteration rank; |
Index | | array of pointers to iteration variables; |
LI | | absolute iteration index. |
The function unconditionally puts the record of the iteration or task beginning into the trace table.
void trc_put_iteration_flash(void) |
The function put the current postponed record of the iteration beginning into the trace table. This function is called from functions trc_put_beginstruct() and trc_put_variable().
void trc_put_readvar( char *File, unsigned long Line, char *Operand, long Type, void *Value, byte Reduct ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
Type | | variable type; |
Value | | variable address; |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function puts the record of the variable reading into the trace table.
void trc_put_prewritevar( char *File, unsigned long Line, char *Operand, long Type, byte Reduct ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
Type | | variable type; |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function puts the record of the beginning of an expression calculation into the trace table.
void trc_put_postwritevar( char *File, unsigned long Line, char *Operand, long Type, void *Value, byte Reduct ) | ||
File | | the source file name of DVM-program. |
Line | | the line number of DVM-program. |
Operand | | variable name. |
Type | | variable type. |
Value | | variable address. |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function puts the record of the completion of an expression calculation into the trace table.
void trc_put_reductvar( char *File, unsigned long Line, long Type, void *Value ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
Type | | variable type; |
Value | | variable address. |
The function puts the record of the completion a reduction calculation into the trace table.
void trc_put_variable( char *File, unsigned long Line, char *Operand, byte iType, long Type, void *Value, byte Reduct ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
iType | | trace record type; |
Type | | variable type; |
Value | | variable address; |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The common function of putting the record of the variable accesses into the trace table.
void trc_put_skip( char *File, unsigned long Line ) | |||
File | | the source file name of DVM-program; | |
Line | | the line number of DVM-program. |
The function puts the record of finishing self-calculation block in a sequential branch of the program.
The functions of trace reading module is intended to read and examine reference trace file and configuration file. The trace accumulation functions is used to form records in table of trace records.
The trace reading functions have the following prototypes:
void trc_rd_header( DVMFILE *hf, char* szFileName ) | ||
hf | | opened file handle; |
szFileName | | file name that is used in the diagnostic messages. |
The function reads trace configuration file. It forms the hierarchy of program structures in the memory. The function returns number of read lines.
void trc_rd_trace( DVMFILE *hf, char* szFileName, unsigned long StrBase ) | ||
hf | | opened file handle; |
szFileName | | file name that is used in the diagnostic messages; |
StrBase | | the line number that was read from this file. This parameter is used for diagnostic messages. |
The function reads the standard trace file.
unsigned long trc_rd_gets( DVMFILE *hf ) | ||
hf | | opened file handle; |
The function reads a next record from a file. This function skips all empty strings and removes comments. The number of read lines is returned.
short trc_rd_search_key(char *str) | ||||
str | | string with a keyword. |
The function finds matched key code that corresponds to a keyword. It returns -1 if key code is not found for the specified string.
char* trc_rd_split( char *Str, char *Format, ) | ||
Str | | the parsed string; |
Format | | the string format; |
| variable addresses that accepts parameters. |
The function parses string and gets parameters by specified format.
The following symbols can be used with the Format string:
i int
l long
f float
d double
The trace comparing functions compares trace events with standard trace records.
The trace comparing functions have the following prototypes:
void trc_cmp_beginstruct( char *File, unsigned long Line, long No, byte Type, byte Rank, long *Init, long *Last, long *Step ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
No | | unique structure number; |
Type | | structure type (parallel or sequential loop, task region); |
Rank | | structure rank; |
Init | | the array of initial values of iteration variables; |
Last | | the array of end values of iteration variables; |
Step | | the array of iteration variables steps; |
The function compares the trace record of a program structure beginning with the corresponding standard trace record.
void
trc_cmp_endstruct(char *File, unsigned long Line, long
No, unsigned long BegLine) |
||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
No | | unique structure number; |
BegLine | | line number of the structure beginning. |
The function compares the trace record of a program structure completion with the corresponding standard trace record.
void trc_cmp_iteration( AddrType *index ) | ||
index | | array of pointers to iteration variables. |
The function compares the trace record of the iteration or task beginning with the corresponding standard trace record. If the mode of writing empty iterations is not selected then the record really will be compared only after beginning an inner structure or variable accessing inside this iteration.
void trc_cmp_iteration_flash(void) |
The function compares the current postponed trace record of the iteration beginning with the corresponding standard trace record. This function is called from functions trc_cmp_beginstruct() and trc_cmp_variable ().
void trc_cmp_readvar(char
*File, unsigned long Line, long Type, void *Value, byte Reduct) |
||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
Type | | variable type; |
Value | | variable address; |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function compares the trace record of a variable reading with the corresponding standard trace record.
void trc_cmp_prewritevar( char *File, unsigned long Line, long Type, byte Reduct ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
Type | | variable type; |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function compares the trace record of a beginning expression calculation with the corresponding standard trace record.
void
trc_cmp_postwritevar( char *File, unsigned long Line,
long Type, void *Value, byte Reduct ) |
||||
File | | the source file name of DVM-program; | ||
Line | | the line number of DVM-program; | ||
Operand | | variable name; | ||
Type | | variable type; | ||
Value | | variable address; | ||
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The function compares the trace record of a completion expression calculation with the corresponding standard trace record.
void trc_cmp_reductvar( char *File, unsigned long Line, long Type, void *Value ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
Type | | variable type; |
Value | | variable address. |
The function compares the trace record of a reduction result with the corresponding standard trace record.
void trc_cmp_variable(
char *File, unsigned long Line, enum_TraceType iType, long vType, void *Value, byte Reduct ) |
||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program; |
Operand | | variable name; |
iType | | trace record type; |
Type | | variable type; |
Value | | variable address; |
Reduct | | reduction variable flag. It is equal to 1 if a reduction variable is used. |
The general function of the comparing variable usage trace record with the corresponding standard trace record.
void trc_cmp_skip( char *File, unsigned long Line ) | ||
File | | the source file name of DVM-program; |
Line | | the line number of DVM-program. |
The function compares the trace record of finishing self-calculation block in a sequential branch of the program with the standard trace record. The function may skip several trace records if it is needed.
long trc_cmp_forward(long CurTraceRecord, enum_TraceType iType) | ||
CurTraceRecord | | the number of the current trace record; |
iType | | searched trace record type. |
The function searches a nearest trace record with the specified type from the current trace record. It returns the number of a found trace record or 1 if the specified type is absent or records with structure beginning, iteration beginning or structure completion types are presented between the current and found trace records.
6.5.6 Reduction processing module
The reduction-processing module uses its own variable-table. This variable-table contains entries of the following type that describe a reduction variable:
typedef struct tag_REDUCT_INFO |
{ | |||||
char* | Current; | ||||
char* | Initial; | ||||
byte | StartReduct; | ||||
s_REDVAR* | RVar; | ||||
} | REDUCT_INFO; |
Current | | pointer to the buffer with a current calculated reduction result; | |||
Initial | | pointer to the buffer with an initial value of the reduction variable; | |||
StartReduct | | asynchronous reduction flag. It is equal to one if reduction calculation is started; | |||
Rvar | | pointer to an internal RTL-structure that describes the reduction variable. |
The method of manual reduction calculation is used for validation of the specified reduction operation. This method is based on partial reduction result calculation after each performed loop iteration. The function diter_() calculates partial reduction result by applying the specified reduction operation and restores initial value reduction variable after each performed iteration or parallel task. The dendl_() function calculates the final reduction result after completion the parallel structure.
Thus, we can manually calculate the specified reduction operation by restoring initial reduction variable value after every iteration and applying the specified reduction operation for intermediate values.
The following functions are intended for work with the reduction variable-table and performing manual reduction calculation:
void trcreduct_Insert(s_REDVAR* RVar ) | ||
RVar | | pointer to an internal RTL structure that describes the reduction variable. |
The function registers the reduction variable in the variable-table. The function is called when a user defines the reduction variable.
REDUCT_INFO* trcreduct_Find( void* addr ) | ||
addr | | variable address. |
The function finds reduction variable description structure by the variable address. It returns NULL if a reduction variable with the specified address is not registered.
void trcreduct_Remove( s_REDVAR* RVar ) | ||
RVar | | pointer to an internal RTL structure that describes the reduction variable. |
The function removes the reduction variable from the variable-table. The function is called when the reduction calculation is completed.
int trcreduct_IsReduct( void *addr ) | ||
addr | | variable address. |
The function checks registration of the reduction variable with the specified address in the variable table.
void trcreduct_VarDestructor( VarInfo *Var ) | ||
Var | | pointer to the reduction variable description structure. |
Destructor of the reduction variable description structure.
void trcreduct_StoreInitial(s_REDVAR* RVar) | ||
RVar | | pointer to an internal RTL structure that describes the reduction variable. |
The function saves the initial value of the reduction variable.
void trcreduct_Calculate(void) |
The function calculates the intermediate result of the manual reduction calculation after completion a next iteration of a current parallel loop or next parallel task.
void trcreduct_CalculateVar( VarInfo *Var ) | ||
Var | | pointer to the reduction variable description structure. |
The function calculates the intermediate result of the manual reduction calculation for the specified reduction variable.
void trcreduct_Complete( void *addr, long Type ) | ||
addr | | reduction variable address; |
Type | | reduction variable type (rt_INT, rt_LONG, rt_FLOAT or rt_DOUBLE). |
The function completes the manual reduction calculation for the specified reduction variable. The function puts the reduction result into the trace.
void trcreduct_CopyResult( s_COLLECTION *RedVars ) | ||
RedVars | | the collection of reduction variables that are calculated in the current parallel structure. |
The function copies the calculated reduction results into the specified reduction variables.
6.5.7 Parameters of subsystem of comparing execution results
The comparing execution results sub-system uses the same technique of parameter specifying as dynamic control. The execution result tracing uses the following parameters:
EnableTrace flag to enable or disable execution result tracing performance. If it is equal to 0 then tracing is disabled.
ManualReductCalc reduction calculation mode. The manual reduction calculation method is used if this parameter is equal to 1.
TraceOptions.FileLoopInfo trace configuration file name. This file is looked in the TraceOptions.TracePath directory.
TraceOptions.TraceFile the name of the standard trace file. This file is looked in the TraceOptions.TracePath directory. This parameter is used only in the trace-comparing mode.
TraceOptions.ErrorFile the name of diagnostic output file. This file is used if parameter TraceOptions.ErrorToScreen is equal to 0. If system cannot open the file, the error messages will be output to the screen.
TraceOptions.Ext extension of trace files. The name of a trace file is formed by using the following rule: <processor number>.<TraceOptions.Ext>. The trace file will be created in the TraceOptions.TracePath directory. This parameter is used only in the trace accumulation mode.
TraceOptions.Exp exactitude of a float number comparison in the trace-comparing mode.
TraceOptions.WrtHeaderProc the number of a processor that forms trace configuration file. The trace configuration file will contain trace size estimations for the specified processor. The summary trace size estimation can be got by launching the program on a single processor.
TraceOptions.TracePath the directory of trace files.
TraceOptions.TraceMode the mode of execution result tracing:
0 | | generate trace configuration file. Only processor with the number TraceOptions.WrtHeaderProc creates this file; |
1 | | accumulate trace into the file <processor number>.<TraceOptions.Ext>; |
2 | | join of the two previous modes; |
3 | | compare the execution result trace with the standard trace file TraceOptions.TraceFile. |
TraceOptions.TraceLevel the default trace level. It is used only in the trace accumulation mode. The possible values:
0 | | disable tracing (level NONE); |
1 | | trace beginning and finishing loops and task regions, beginning iterations and parallel task only (level MINIMAL); |
2 | | the previous level plus trace variable modifications (level MODIFY); |
3 | | trace all events (level FULL). |
TraceOptions.SpaceIndent the indent size that is used in the trace files.
TraceOptions.ErrorToScreen if this parameter is not equal to 0 then all diagnostic messages will be output to the screen.
TraceOptions.TableTraceSize increment size of the trace table.
TraceOptions.HashIterIndex and TraceOptions.HashIterSize hash-table parameters.
TraceOptions.ReductHashIndexSize, TraceOptions.ReductHashTableSize and TraceOptions.ReductVarTableSize the parameters of the reduction variable-table.
TraceOptions.SaveThroughExec the trace will be written into the file during program execution if this parameter is not equal to 1. Otherwise the trace will be accumulated in the memory and written after program completion. You can enable this mode only if the trace configuration file exist.
TraceOptions.PrintStatistic flag to enable or disable output of the trace statistics.
TraceOptions.WriteEmptyIter if it is equal to 0 then the empty iterations are not put into the trace.
TraceOptions.AppendErrorFile the mode of a diagnostic file usage. The file will be cleared each time before program startup if the parameter is equal to 0.
TraceOptions.MaxErrors the maximum count of errors after that the trace accumulation or comparing is disabled.
DVM debugger - contents | Part 1 (1 - 4) | Part 2 (5 - 6.4) | Part 3 (6.5) | Part 4 (7) |