共用方式為


Managing threads in RevoScaleR

Important

This content is being retired and may not be updated in the future. The support for Machine Learning Server will end on July 1, 2022. For more information, see What's happening to Machine Learning Server?

RevoScaleR provides functions for managing the thread pool used for parallel execution.

On Windows, thread pool management is enabled and should not be turned off.

On Linux, thread pool management is turned off by default to avoid interfering with how Unix systems fork processes. Process forking is only available on Unix-based systems. You can turn the thread pool on if you do not fork your R process. RevoScaleR provides an interface to activate the thread pool:

rxSetEnableThreadPool(TRUE)

Similarly, the thread pool may be disabled as follows:

rxSetEnableThreadPool(FALSE)

If you want to ensure that the RevoScaleR thread pool is always enabled on Linux, you can add the preceding command to a .First function defined in either your own Rprofile startup file, or the system Rprofile.site file. For example, you can add the following lines after the closing right parenthesis of the existing Rprofile.site file:

.First <- function()
{
	.First.sys()
	invisible(rxSetEnableThreadPool(TRUE))
}

The .First.sys function is normally run after all other initialization is complete, including the evaluation of the .First function. We need the call to rxSetEnableThreadPool to occur after RevoScaleR is loaded. That is done by .First.sys, so we call .First.sys first.

See Also