Validation is the process of comparing redundant results
and deciding which is to be considered correct.
Because floating-point arithmetic varies between platforms,
this decision is an application-specific.
A validator is a back-end program that does validation
and credit-granting.
You must supply a validator for each application in your project.
BOINC supplies a framework program validator.C.
This program must be linked with two application-specific functions:
",
htmlspecialchars("
int check_set(vector results, DB_WORKUNIT& wu, int& canonicalid, double& credit, bool& retry);
"),
"
- check_set() takes a set of results (all with outcome=SUCCESS).
If there is a quorum of matching results,
it selects one of them as the canonical result, returning its ID.
In this case it also returns the credit to
be granted for correct results for this workunit.
-
If, when an output file for a result has a nonrecoverable error
(i.e. the directory is there but the file isn't),
then it must set the result's outcome (in memory, not database)
to VALIDATE_ERROR.
Note: the function try_fopen() (in lib/util.C) can be used
to detect recoverable/nonrecoverable errors.
-
If a canonical result is found, check_set() must set the
validate_state field of each non-ERROR result to either VALID or INVALID.
-
If a recoverable error occurs while reading output files
(e.g. a directory wasn't visible due to NFS mount failure)
then check_set() should return retry=true.
This tells the validator to arrange for this WU to be
examined again in a few hours.
-
check_set() should return nonzero if a major error occurs.
This tells the validator to write an error message and exit.
",
htmlspecialchars("
int check_pair(RESULT& new_result, RESULT& canonical_result, bool& retry);
"),
"
-
check_pair() compares a new result to the canonical result.
In the absence of errors,
it sets the new result's validate_state to either VALID or INVALID.
-
If it has a nonrecoverable error reading an output file of either result,
it must set the new result's outcome (in memory, not database)
to VALIDATE_ERROR.
-
If it has a recoverable error while reading an output file of either result,
it returns retry=true,
which causes the validator to arrange for the WU to be examined
again in a few hours.
-
check_pair() should return nonzero if a major error occurs.
This tells the validator to write an error message and exit.
Two example validators are supplied
(each implements check_set() and check_pair()):
-
sample_bitwise_validator requires a strict majority,
and regards results as equivalent only if they agree byte for byte.
-
sample_trivial_validator
regards any two results as equivalent if their CPU time
exceeds a given minimum.
validate_util.C contains support functions for both of the above.
NOTE: the above code assumes that each result
has a single output file.
Revisions will be needed to handle multiple output files.
To do this you will need to know the following:
The database field 'result.xml_doc_out'
describes a result's output files.
It has the form
",htmlspecialchars("
...
[ ... ]
foobar
blah
blah
...
[ ... ]
"),"
The components are:
- The <name> element is the result name.
- The <wu_name> element is the workunit name.
- Each <file_ref> element is an association to an output file,
described by a corresponding <file_info> element.
The XML document describing the sizes and checksums of the output
files is a list of <file_info> elements,
with the nbytes and md5_cksum fields present.
The project back end
must parse this field to find the locations and checksums of output files.
";
page_tail();
?>