- Data Files with PDBDiff
- PDBDiff Syntax
- Starting PDBDiff
- PDBDiff Commands
- Default State
- Other PACT Documents
IntroductionThe PACT system provides a number of tools for working with PDB files in a fairly generic fashion. In particular, PDBDiff compares the contents of two PDB files and displays the differences (in a manner similar but not identical to the UNIX utility diff). PDBDiff can also be run in an interactive mode which allows you to compare two PDB files on a variable by variable or even leaf by leaf basis.
PDBDiff is an SX program. SX is the SCHEME dialect of the LISP programming language with PACT extensions. The extensions provide functionality for graphics, binary data handling, and other areas of functionality.
PDBDiff has a help command which provides information about available commands.
Note: The files compared may have been created on or for different target machines. Consequently, a given data type may be represented differently in the two files. In this event values are compared to the precision in the first file, or the precision in the second file, or the precision you specify, whichever is least.
Data Files with PDBDiffPDBDiff can be used to compare the contents of any two PDB files. It compares files entry by entry. In the most commonly used mode of use it has no knowledge of the semantics of the data in the files it compares.
2.1 PVA FilesThere is a special kind of PDB file called a PVA (Portable Visualization and Analysis) file which contains data sets structured in a particular way so as to completely specify all information necessary to visualize the data set or to perform mathematical operations such as differentiation and integration on it. PANACEA codes produce PVA files as the PACT supported option for data output. PDBDiff can compare these files in a special way. Since it has complete information about the data sets, it can compare data sets which represent the same quantity but, potentially, with different amounts of information. For example, two runs of a numerical simulation code might compute a given quantity but with different resolution on the computational mesh. PDBDiff can compare these data sets by interpolating them to a common domain and computing the difference measure:
If the difference measure is less than a specified threshold (specified by the -t option), PDBDiff goes on to the next mapping in the file. However, if the difference measure exceeds the threshold, the two mappings, a and b, are displayed in separate windows along with the integrand above in its own window. The user is prompted to specify whether or not the differences are acceptable. In this way PDBDiff can be used as an aide to developing simulation codes and testing them.
PDBDiff SyntaxPDBDiff uses a slightly different data description syntax than PDBLib. With PDBLib variable names and names of members of structures cannot contain the characters: ., (, ), [, and ]. The characters (, ), [, and ] are used in array reference and dimension definition expressions. In PDBDiff, ( and ) CANNOT be used in variable reference expressions because they are special characters for PDBDiff. For example,
print a(2)is illegal and results in an error. The legal expression is:
print aOther examples of legal expressions are:
print a.b[3,2]The first two forms are not identical. In the first form an element of a two dimensional array is being referenced. In the second form, the third element of the fourth array of arrays is being referenced (assuming zero based indexing in the definition of the b member of a).
For completeness and clarity in the following discussion, an index expression is defined as:
If an index expression uses either of the two starred forms it is said to be a hyper-index expression. A hyper-index expression implies more than one data item. Only the terminating index expression in a data reference may be a hyper-index expression. An index expression is said to dereference an indirection (or pointer or array). For each level of indirection a suitable index expression dereferences the desired data.index expression := [index list] index list := index | index, index list index := simple index | index-min : index-max | (*) index-min : index-max : increment (*) simple index := integer index-min := integer index-max := integer increment := integer
For example, this means that a variable defined as:
char **sis said to have two levels of indirection and can have parts accessed as follows:
In the above example a zero based index is assumed.
print s prints the entire item print s prints the third character array of s print s prints the eleventh character of the fourth character array of s
When referring to part of a variable, especially a structured variable, the terminal node must be of primitive type or a structure containing no indirections and whose descendant members contain no indirections. Furthermore, the path to the desired part must contain one array reference for each level of indirection traversed.
Starting PDBDiffOn UNIX systems a shell script called pdbdiff is provided; it starts up SX and loads the PDBDiff SCHEME forms. You must add a line to your .cshrc or .profile file that defines the environment variable SCHEME. This variable tells SX where to find the PDBDiff program. Consult your system administrator or some other knowledgeable source to find where this is kept. If, for example, the directory /usr/local/scheme contains the PDBDiff program file, add the line:
setenv SCHEME /usr/local/schemeto your .cshrc or .profile file.
pdbdiff [-a] [-b n] [-d] [-i] [-l] [-p f] [-s] [-t #] [-v] pdb-file1 pdb-file2
a - display all elements if any differ
b - number of mantissa bits to use in floating point comparisons
d - compare floating point types of differing precision
i - enter interactive mode
l - compare fixed point types of differing precision
p - fractional decimal precision to use in floating point comparisons
s - display only differing elements (default)
t - comparison tolerance for -v option defaults to 1.0e-8
v - compare PVA files (batch mode only currently)
PDBDiff CommandsIn this section the PDBDiff commands are listed alphabetically. Each command is given with a brief description of its function and examples of its usage. The examples are intended to illustrate the various ways of invoking each command.
Change the current file directory in the designated file. The first file is designated by 1, a, or first and the second file is designated by 2, b, or second. If neither file is specified the file directory is changed for both files. The new directory may be specified by either a relative path or a full path.
Usage: cd [directory] [1 | a | first | 2 | b | second]
cd ../reptiles first
Close the current pair of files.
Describe the named variable or structure member in the designated file. The first file is designated by 1, a, or first and the second file is designated by 2, b, or second. To get a description of part of a variable or structure member, qualify the name with index expressions (see the PDBDiff Syntax section for a discussion of index expressions).
Usage: desc variable | structure-member [1 | a | first | 2 | b | second]
desc Mapping1.range 1
desc baz second
Compare the values of the named variable(s) or structure member(s) in the two open files. If two variable names are provided, the values of the first variable in the first file will be compared with the values of the second variable in the second file. To compare part of a variable or structure member, qualify the name with index expressions (see the PDBDiff Syntax section for a discussion of index expressions). You may specify the format of the output with the mode and set commands.
Usage: diff variable | structure-member [variable | structure-member]
diff abc def
End the PDBDiff session.
Describe a PDB file. The first file is designated by 1, a, or first and the second file is designated by 2, b, or second.
Usage: file [1 | a | first | 2 | b | second]
Set the printing format for a specified data type. If the argument specifying the type has 1 or 2 appended, then the new format is applied only to arrays shorter than array-length or to arrays longer than or equal to array-length, respectively. Otherwise, the format applies to both. Invoking the format command with the single argument, default, causes the formats for all types to be reset to their default values. The format argument must be a Standard C I/O Library format string. Double quotes are only necessary if the format string contains embedded blanks. See the set command for more information about the array-length display control parameter. This command overrides the settings of the decimal-precision and bits-precision display control parameters.
Usage: format integer[1 | 2] | long[1 | 2] | float[1 | 2] | double[1 | 2] | short[1 | 2] | char[1 | 2] format Usage: format default
Examples:format double %12.5e
format double2 %10.2e
format char %s
Print a list of the available commands or information about the specified command.
Usage: help [command]
List the names of variables, links, and directories in the designated file. The first file is designated by 1, a, or first and the second file is designated by 2, b, or second. If neither file is specified the information is listed for both files. Directories have a terminal slash. An optional selection pattern may be specified. Each ? in the pattern matches any single character. Each * in the pattern matches any string of zero or more characters. An optional type qualifier may also be specified in order restrict the list to a given type. A type qualifier of * may be used to match all types. Both a selection pattern and a type qualifier must be specified if you wish to designate a file.
Usage: ls [pattern [type [1 | a | first | 2 | b | second]]]
ls var? integer second
ls * Directory
ls * * first
Set the print mode for arrays and structures.
Display modes are:
Type display is controlled by:
full-path - the full path name is printed at each branch, e.g. foo.bar.baz indent - indent 4 spaces at each branch (default) tree - display as a tree (lines connecting branches)
no-type - turns off the display of types (default)Display of recursive structures is controlled by:
type - displays the type of each item and branch
recursive - indent each level of recursive structuresDisplay of differing elements is controlled by:
iterative - number each level of recursive structures (default)
individual - display only differing elements (default)
display-all - display all elements if even one differs
Usage: mode full-path | indent | tree | no-type | type | recursive | iterative | individual | display-all
Open a new pair of files.
Usage: open filename1 filename2
Example:open foo.s00 bar.s00
Print out all or part of the specified variable or structure member from the first or second file. The first file is designated by 1, a, or first and the second file is designated by 2, b, or second. To print part of a variable or structure member, qualify the name with index expressions (see the PDBDiff Syntax section for a discussion of index expressions).
Usage: print variable | structure-member [1 | a | first | 2 | b | second]
print Mapping2.range.elements 2
print a.b.c[5,10:20,1:8:3] b
Promote lower precision types in the specified class or classes to higher precision to permit comparison, if necessary. Turn off promotion for classes not specified. The default is no promotion.
Usage: promote [fixed] [float]
promote fixed float
Print the current file directory for the designated file.The first file is designated by 1, a, or first and the second file is designated by 2, b, or second. If neither file is specified the current file directory will be printed for both files. NOTE: If the current file directory is the same for both files, it will only be printed once.
Usage: pwd [1 | a | first | 2 | b | second]
Set the value of some display parameters. Parameters:
Usage: set line-length | array-length | bits-precision | decimal-precision value
line-length - number of array elements per line array-length - for arrays shorter than value, label each element individually bits-precision - number of mantissa bits compared in floating point numbers decimal-precision - limit on the fractional difference reported
Examples:set line-length 3
set array-length 20
set bits-precision 10
set decimal-precision 1.0e-6
Describe the named data type in the specified file. The first file is designated by 1, a, or first and the second file is designated by 2, b, or second.
Usage: struct data-type [1 | a | first | 2 | b | second]
Examples:struct double 1
struct PM_mapping second
Toggle a transcript of the PDBDiff session. The name of the transcript file may be specified when the transcript is activated. A file named pdbdiff.trn will contain the transcript of the session if no name is given.
Usage: transcript [filename]
List the data types in the designated file.The first file is designated by 1, a, or first and the second file is designated by 2, b, or second. If neither file is specified the data types will be printed for both files.
Usage: types [1 | a | first | 2 | b | second]
Default StateThe initial state of PDBDiff is:
- mode indent
- mode no-type
- mode iterative
- mode individual
- set line-length 2
- set array-length 4
- set bits-precision 128 (i.e. use all mantissa bits in floating point comparisons)
Other PACT DocumentsInterested readers may wish to refer to the other PACT documents which describe the data structures and functionality underlying the more common PDB files upon which PDBDiff operates. The PANACEA, PGS, and PDBLib manuals are of special interest to people who wish to generate and view data files with PACT.
The list of PACT Documents is:
LLNL-CODE-422942| Privacy & Legal Notice
Last modified: January 28, 2010