The CPU procedure is used to change the values stored in the read-only
| Note |
CPU [, /RESET] [, RESTORE = structure] [,TPOOL_MAX_ELTS = NumMaxElts] [,TPOOL_MIN_ELTS = NumMinElts] [,TPOOL_NTHREADS = NumThreads] [,/VECTOR_ENABLE]
None.
Set this keyword to cause the CPU procedure to reset the values contained in the
Set this keyword equal to a structure of type
This keyword changes the value returned by
Set this keyword to a non-zero value to set the maximum number of data elements involved in a computation that uses the thread pool. If the number of elements in the computation exceeds the number contained in
See Possible Drawbacks to the Use of the IDL Thread Pool for discussion of the circumstances under which it may be useful to specify a maximum number of elements for computations that use the thread pool.
This keyword changes the value returned by
Set this keyword to a non-zero value to set the minimum number of data elements involved in a computation that uses the thread pool. If the number of elements in the computation is less than the number contained in
See Possible Drawbacks to the Use of the IDL Thread Pool for discussion of the circumstances under which it may be useful to specify a minimum number of elements for computations that use the thread pool.
This keyword changes the value returned by
Set this keyword to the number of threads IDL should use when performing computations that take advantage of the thread pool. By default, IDL will use
| Note |
If the IDL_CPU_TPOOL_NTHREADS environment variable has been set, then
This keyword changes the value returned by
Set this keyword to enable use of the system's vector unit (e.g. Macintosh Altivec/Velocity Engine) if one is present. Set this keyword equal to 0 (zero) explicitly disable such use. This keyword is ignored if the current system does not support a vector unit (that is, if
It is sometimes necessary to alter the way IDL uses the system processor or processors for a section of code, and then to restore IDL to the settings in effect before the code section was executed. It is often possible to accomplish this using the thread pool keywords to specific routines; in some circumstances, however, this approach may be inconvenient or ineffective. For example:
In all of these cases, the answer is to use the CPU procedure to alter the value of the
save_cpu =!CPU ; Save the current configuration CPU, TPOOL_NTHREADS=2, ... ; Change the current configuration ... ; Carry out a computation ; Restore the CPU state CPU, TPOOL_MAX_ELTS=save_cpu.tpool_max_elts, $ TPOOL_MIN_ELTS=save_cpu.tpool_min_elts, $ TPOOL_NTHREADS=save_cpu.tpool_nthreads
There are two obvious problems with this approach: it is tedious and error prone, and if new versions of IDL add new CPU attributes, your code will require updates in order to reset them.
The RESTORE keyword to CPU solves both of these problems. When a structure of type
save_cpu =!CPU CPU, TPOOL_NTHREADS=2, ... ... CPU, RESTORE=save_cpu
The RESET keyword is similar to RESTORE, but it resets the
CPU, /RESET
The RESET keyword is useful in ad hoc analysis, when you've made changes to the
RESET and RESTORE are mutually exclusive - only one of them can be used in a given call to the CPU procedure. However, they are allowed in conjunction with the other keywords to CPU. In such cases, the explicit keywords take precedence over the values from the RESET or RESTORE keywords. For example, the following statement changes the number of threads used by the IDL thread pool to 3, and sets all other CPU parameters to the values contained in a variable named save_cpu:
CPU, TPOOL_NTHREADS=3, RESTORE=save_cpu
Configure
CPU, TPOOL_MIN_ELTS=5000, TPOOL_NTHREADS=2
Introduced: 5.5
RESET and RESTORE keywords: 6.1