我不是这方面的专家Matlab
所以我不能代表所有可用的资源,但是,我知道您的任务在标准笔记本电脑上是可行的,无需任何花哨的高性能服务,例如https://aws.amazon.com/hpc/.
我已经编写了一个包R
called RcppAlgos
能够在几个小时内轻松完成这项任务。这是代码:
options(scipen = 999)
library(parallel)
library(RcppAlgos)
## WARNING Don't run this unless you have a few hours on your hand
## break up into even intervals of one million
firstPart <- mclapply(seq(1, 269128000000, 10^6), function(x) {
temp <- permuteGeneral(c(1L,-1L), freqs = c(21,20), lower = x, upper = x + 999999)
## your analysis here
x
}, mc.cores = 8)
## get the last few results and complete analysis
lastPart <- permuteGeneral(c(1L, -1L), freqs = c(21, 20),
lower = 269128000000, upper = 269128937220)
## analysis for last part goes here
为了向您展示此设置的效率,我们将演示完成前 10 亿个结果的速度。
system.time(mclapply(seq(1, 10^9, 10^6), function(x) {
temp <- permuteGeneral(c(1L, -1L), freqs = c(21, 20), lower = x, upper = x + 999999)
## your analysis here
x
}, mc.cores = 8))
user system elapsed
121.158 64.057 27.182
30 秒内获得 1000000000 个结果!!!!!!!
因此,正如 @CrisLuengo 计算的那样,这不会花费超过 3000 天,而是保守估计每十亿需要 30 秒:
(269128937220 / 1000000000 / 60) * 30 ~= 134.5645 minutes
我还应该注意,通过上面的设置,您仅使用1251.2 Mb
一次,这样你的记忆就不会爆炸。
testSize <- object.size(permuteGeneral(c(1L,-1L), freqs = c(21,20), upper = 1e6))
print(testSize, units = "Mb")
156.4 Mb ## per core
所有结果均在 MacBook Pro 2.8GHz 四核(有 4 个虚拟核心……总共 8 个)上获得。
Edit:
正如 @CrisLuengo 指出的,上面的方法仅测量生成那么多排列,并没有考虑分析每次计算所花费的时间。经过更多澄清和新问题后,我们得到了answer现在...大约2.5天!