Description Usage Arguments Value Author(s) Examples
This function is used to set the parallel environment. For Linux system, a cluster of 'FORK' is created. For Windows system, a cluster of 'PSOCK' is created.
1 | ComEnvir(is_Unix = TRUE, core_num = 1, clusterExport = list('py','Y','Npop','dmvnorm'))
|
is_Unix |
Indicate if your system is Linux or Windows |
core_num |
The number of cores |
clusterExport |
If Windows is used, please state the list of values involved on the master process of the variables to variables of the same names in the global environment of each node. This normalily is a list that includes 'py' (the unnormalized density2: Y|theta&phi * theta), observation 'Y' and other variables or functions. |
If is_Unix == TRUE, a list of is_Unix is returned. If is_Unix == FALSE, the list of is_Unix and clusterExport is returned.
Yang Liu
1 2 3 4 5 6 7 8 9 10 11 12 | ## The function is currently defined as
function(is_Unix = TRUE, core_num = 1, clusterExport = list('py','Y','Npop','dmvnorm')){
if(is_Unix){
cl<-makeCluster(core_num,type = 'FORK')
registerDoParallel(cl)
}else{
#cl<-makeCluster(detectCores( ))
cl<-makeCluster(core_num)
registerDoParallel(cl)
return(clusterExport)
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.