Download Read the User`s Guide - BeBOP (Berkeley Benchmarking and

Transcript
5.5
Saving and restoring tuning transformations
28
Listing 6: An example of saving transformations. This example extracts the tuning transformations applied to a matrix object A tunable and saves them to a file.
oski matrix t A tunable = oski CreateMatCSR( . . . );
char∗ xforms; /∗ stores transformations ∗/
FILE∗ fp saved xforms = fopen( "./my_xform.txt", "wt" ); /∗ text file for output ∗/
5
/∗ ... ∗/
/∗ Tune the matrix object ∗/
oski TuneMat( A tunable );
10
/∗ ... ∗/
15
/∗ Extract transformations ∗/
xforms = oski GetMatTransforms( A tunable );
printf ( "--- Matrix transformations ---\n%s\n--- end ---\n", xforms );
/∗ Save to a file ∗/
fprintf ( fp saved xforms, "%s\n", xforms );
fclose ( fp saved xforms );
20
free ( xforms );
/∗ ... ∗/
oski GetMatTransforms
oski ApplyMatTransforms
Retrieve a string representation of the tuning
transformations that have been applied to a
given matrix.
Apply tuning transformations to a given matrix.
Table 14: Saving and restoring tuning transformations. The interface defines a basic facility to allow users to view the tuning transformations that have been applied to matrix,
and later re-apply those (or other) transformations to another matrix. Bindings appear in
Appendix B.6 on page 58.
5.5
Saving and restoring tuning transformations
The interface defines basic facilities that allow users to view the tuning transformations
which have been applied to a matrix, to edit these transformations, and to re-apply them
(Table 14). To get a string describing how the input matrix data structure was transformed
during tuning, the user calls oski GetMatTransforms. This routine returns a newly allocated string containing the transformations description. To set the data structure (i.e.,
to apply some set of transformations to the input matrix data structure), the user calls
oski ApplyMatTransforms. Such a call is equivalent to calling oski TuneMat, except that
instead of allowing the library to decide what data structure to use, we are specifying it
explicitly. We illustrate the usage of these two routines in Listing 6 and Listing 7 on the
following page.