CPU
The CPU procedure is used to change the values stored in the read-only !CPU system variable, which in turn controls the way IDL uses the system processor or processors.
Not all routines are affected by changes to the !CPU system variable. Those routines that are affected can override some of the values in the !CPU system variable by setting thread pool keywords, which change the way IDL uses the system processor(s) during a single invocation of the routine. A list of thread pool keywords appears at the end of the keywords list for each routine that is affected by the state of the !CPU system variable.
Syntax
CPU [,TPOOL_MAX_ELTS = NumMaxElts] [,TPOOL_MIN_ELTS = NumMinElts] [,TPOOL_NTHREADS = NumThreads] [,/VECTOR_ENABLE]
Arguments
None.
Keywords
TPOOL_MAX_ELTS
This keyword changes the value returned by !CPU.TPOOL_MAX_ELTS.
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 !CPU.TPOOL_MAX_ELTS, IDL will not use the thread pool for the computation. Setting this value to 0 removes any limit on maximum number of elements, and any computation with at least !CPU.TPOOL_MIN_ELTS will use the thread pool.
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.
TPOOL_MIN_ELTS
This keyword changes the value returned by !CPU.TPOOL_MIN_ELTS.
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 !CPU.TPOOL_MIN_ELTS, IDL will not use the thread pool for the computation. Use this keyword to prevent IDL from using the thread pool on tasks that are too small to benefit from it.
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.
TPOOL_NTHREADS
This keyword changes the value returned by !CPU.TPOOL.NTHREADS.
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 !CPU.HW_NCPU threads, so that each thread will have the potential to run in parallel with the others. Set this keyword equal to 0 (zero) to ensure that !CPU.HW_NCPU threads will be used. Set this keyword equal to 1 (one) to disable use of the thread pool.
For numerical computation, there is no benefit to using more threads than your system has CPUs. However, depending on the size of the problem and the number of other programs running on the system, there may be a performance advantage to using fewer CPUs. See Possible Drawbacks to the Use of the IDL Thread Pool for a discussion of the circumstances under which using fewer than the maximum number of CPUs makes sense.
VECTOR_ENABLE
This keyword changes the value returned by !CPU.VECTOR_ENABLE.
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 !CPU.HW_VECTOR =0).
Examples
Configure !CPU so that by default, IDL will use two threads for computations that involve more than 5000 data values.
Version History
Introduced: 5.5
See Also
!CPU, Multithreading in IDL.