Skip to content

Instantly share code, notes, and snippets.

View BlasBenito's full-sized avatar

Blas Benito BlasBenito

View GitHub Profile
#generates a cluster specification for the "spec" argument of the parallel::makeCluster() function
#ips: vector of computer ips within the local network: c('10.42.0.1', '10.42.0.34', '10.42.0.104')
#cores: vector of integers with the number of cores available on each computer, in the same order as ips: cores = c(7, 4, 4)
#user: character, name of the user in the different computers. Only one user name allowed.
#returns a list that can be used directly as input for the "spec" argument of makeCluster().
cluster_spec <- function(
ips,
cores,
user
){