On computer systems that have more than one central processing unit (CPU), or cores, multithreading can be used to increase the speed of numeric computations by using multiple system processors to simultaneously carry out different parts of the computations. In a multithreaded environment, each thread handles a portion of the overall task. If several threads can run in parallel, the computation is often quicker than if different portions of the task run in series.

Users with powerful desktop systems that include multiple cores often ask us, "Does ENVI use all of my available cores?"

ENVI uses multithreading for specific operations; namely:

  • Saving files to disk (File > Save As)
  • Creating pyramid files
  • Displaying multiple rasters in a view

ENVI is heavily based on IDL; thus, it inherits the same behavior as IDL, including the use of a thread pool. This is a pool of computational threads that is used to accelerate numerical operations, allowing for multithreading on systems with multiple cores. IDL automatically evaluates all computations performed by routines that may benefit from multithreading to determine whether or not to use the thread pool in the current computation. Not all IDL routines offer the possibility of using multithreading. To learn more about thread pools, see the IDL Thread Pool topic in IDL Help.

In some instances, allowing IDL to use its default thread pool settings can lead to undesirable results and longer times to complete jobs. If the computation does not include a large enough number of data elements (where each element is a data value of a particular data type), the overhead from a thread pool can exceed the benefit of multithreading and processing time will be slower.

Another way that ENVI allows for parallel processing is through ENVI Servers as well as the ENVI Task Engine, where programmers can run ENVI analytics in a command-line environment. The benefit of this is that it allows you to run as many concurrent jobs as resources and licenses allow. However, you must know how to create JSON-formatted task inputs and how to parse JSON outputs. ENVI also provides an asynchronous framework that allows you to run individual ENVITasks that will be executed by the IDL_IDLBridge or ENVITaskEngine when there are available resources. You can define the task input parameters and spawn applications, then add them to a queue for execution later. You can see the results of completed tasks whenever you want. See the ENVIAsyncSpawnTaskJob topic for examples.

In many circumstances, the use of multiple cores is more effectively accomplished using the ENVITaskEngine or ENVI Servers. This provides the ability to implement distributed geospatial processing as a web service.