Comments (2)
I really liked this post https://rpubs.com/Jouni_Helske/225931 (mentioned in the issue you pointed out). Following one of the (rather simple) tests, which as you suggested the simple 1:njobs
does not pass, I wrote this simple (sort of arbitrary) function:
# A naive seeding function
new_seeds <- function(nseeds) {
sum_of_seed <- sum(.Random.seed)
sum_of_seed <- sum_of_seed - (sum_of_seed %/% 100L)*100L
seeds <- (1L:nseeds) * 10L
(seeds + sum_of_seed ^ (1L:nseeds %% 2L))[order(stats::runif(nseeds))]
}
# "Test" from https://rpubs.com/Jouni_Helske/225931
last_rand_seq <- list()
random <- function(kind) {
set.seed(123)
RNGkind(kind = kind)
x <- numeric(1e5)
seeds <- new_seeds(1e5)
for(i in seq_along(x)){
set.seed(seeds[i])
x[i] <- runif(1)
}
last_rand_seq <<- c(last_rand_seq, list(x))
acf(x, main = kind)
}
kinds <- c("Mersenne-Twister", "Marsaglia-Multicarry", "L'Ecuyer-CMRG")
invisible(sapply(kinds, random)) # Looks nice, no autocorrelation
This function is reproducible, i.e., seeds can be reproduced. Will including this function to generate the random seeds instead of using 1:njobs
be enough for JOSS? From what I read in the discussion this is still a problem without a clear solution.
from slurmr.
I'm not sure I understand how the function new_seeds()
helps to solve the problem
Your seeds are determined by the current RNG state on which you apply some transformations. Wouldn't you get the same quality of randomness with as.integer(runif(nseeds, 1, .Machine$integer.max))
?
Either way, I think that the proposed solution (or just calling runif()
) would be sufficient for me -- the arguably better solution is the one proposed by @HenrikBengtsson in the linked issue.
Note that there are two special cases which you might also need to address to get the seeding right:
.Random.seed
isNULL
until the RNG is initiated (usually by drawing the first random number).sum(.Random.seed)
might overflow.
from slurmr.
Related Issues (20)
- `opts_slurmR` not appearing in sbatch script HOT 3
- If error happens before command, Slurm_* hangs HOT 1
- When submitting a job with sbatch(..., array = ) Slurm_collect fails
- Matching STATE_CODES should be using regex not exact
- Passing along an environmental variable HOT 4
- βAn error has occurred when calling `silent_system2`:β HOT 19
- Suppress cleanup of output files from makeSlurmCluster
- mem-per-cpu as sbatch-opt HOT 1
- Error in save.image(name) when running R task in batch mode using slurm HOT 1
- slurmr command line tool deletes source file
- Error in loading shared libraries
- Hook error w/ Slurm_sapply
- Reverse HOT 1
- Default partition, account, and cluster
- Slurm_collect throws 'Error in x$njobs : $ operator is invalid for atomic vectors' HOT 2
- Slurm_lapply unable to parse sbatch output when starting jobs on federated slurm cluster when cluster name specified HOT 1
- Incompatible with `renv` projects HOT 1
- Error with --exclusive option HOT 2
- filesystem error: cannot rename: Directory not empty HOT 1
- Single function evaluation?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slurmr.