Return to Ferret FAQ

Speeding up large calculations


Question:

Why does my script run so slowly?  How might I improve the speed of the calculations?

Explanation:

SET MODE DIAGNOSTIC lets you see where resources are being used.   Memory use can be adjusted, and using explicitly defined regions may allow Ferret to able to take advantage of reusing cached results.

Solution:

Here's how you figure out where Ferret is spending its time during a large calculation:
yes? SET MODE DIAGNOSTIC
On the commands that follow this Ferret will list diagnostic information describing its internal actions. A fragment of the output with explanation is listed below.   Try the following: Explicit limits are especially important when you see "gathering" (above). Watch the diagnostic output to see if Ferret is re-reading the same data. If so, consider using LOAD (and LOAD/PERMANENT) to read file variables into memory prior to requesting a result. This is especially useful when calculations involve derivatives and shift operators. For example, using MY_VAR[I=101:110] and MY_VAR[I=101:110@SHF:2] in the same calculation may require two separate reading operations; pre-reading with LOAD MY_VAR[I=101:112] will cache a single block of data big enough for both.
 

Example:


Here's a fragment of MODE DIAGNOSTIC output and some explanation:

yes? SET MODE DIAGNOSTIC
yes? LOAD SST[l=1:400@AVE]
 getgrid EX#1   5 D: 2  I:    1    1  J:    1    1  K:    1    1  L:    1    1
 eval    EX#1   4 D: 2  I: -111 -111  J: -111 -111  K: -111 -111  L: -111 -111
 strip gathering SST on Y axis:     1    90
 strip -->; SST[T=01-JAN-1946:01-MAY-1979@AVE,D=2]
 reading SST    3 D: 2  I:    1  180  J:    1    4  K: -111 -111  L:    1  400
 doing -->; SST[T=01-JAN-1946:01-MAY-1979@AVE,D=2]
 doing gathering SST on Y axis:     1     4

Explanation:


Last modified: Tue June 5 2001 [an error occurred while processing this directive]