Normally, a single application which wished to tune HDS itself (rather than accepting the default settings, or those specified by environment variables) would do so via calls to HDS_TUNE at the start, and would thus establish a default "tuning profile" to apply throughout the rest of the program. Similarly, a software environment can initially tune HDS to obtain the required default behaviour for the applications it will later invoke.
Sometimes, however, it may be necessary to modify a tuning parameter to improve performance locally while not affecting behaviour of other parts of a program (or other applications in a software environment). The routine HDS_GTUNE may therefore be used to determine the current setting of an HDS tuning parameter, so that it may later be returned to its original value. For instance, if the `MAP' parameter were to be set locally to allow sparse access to a large array of data, the following technique might be used:
... INTEGER OLDMAP * Obtain the original setting of the MAP parameter. CALL HDS_GTUNE( 'MAP', OLDMAP, STATUS ) IF ( STATUS .EQ. SAI__OK ) THEN * Set a new value. CALL HDS_TUNE( 'MAP', -2, STATUS ) <map the array> * Return to the old tuning setting. CALL ERR_BEGIN( STATUS ) CALL HDS_TUNE( 'MAP', OLDMAP, STATUS ) CALL ERR_END( STATUS ) END IF
Notice how great care has been taken over handling error
conditions. In a large software system it could prove disastrous if a
tuning parameter remained set to an incorrect value (perhaps causing
gross inefficiencies elsewhere) simply because HDS_TUNE did not
execute after an unexpected error had caused STATUS to be set to an