# 本程序用于测试HW_index并行运算效率
source("test/main_pkgs.R")
library(profvis)
library(peakRAM)
library(foreach)
# library(CMIP5tools)
library(parallel)
library(bigmemory)
library(biganalytics)
library(doMC)
################################################################################
load("../DATA/data_ex-HW_index.rda")
# peakRam 320.2, 645.9
# HW_index <- HW_index_cgrid(obj, obj_TRS, probs, prefix, ...)
mat_big <- obj$value %>% as.big.matrix()
date <- obj$grid$date
# year <- str_year(date)
# r <- FUN_HW_index(obj, obj_TRS, probs, prefix, .parallel = 1, .nchunk = ncluster)
ncluster <- 4
InitCluster(ncluster)
profvis({
# p11 <- peakRAM(l_hw1 <- HW_index.matrix(mat_big, obj_TRS$TRS, probs, date, prefix, .parallel = 0, .nchunk = 18))
# p12 <- peakRAM(l_hw1 <- HW_index.matrix(mat_big, obj_TRS$TRS, probs, date, prefix, .parallel = 1, .nchunk = ncluster))
p21 <- peakRAM(l_hw1 <- HW_index.matrix(mat_big, obj_TRS$TRS, probs, date, prefix, .parallel = 2, .nchunk = ncluster))
p22 <- peakRAM(l_hw2 <- HW_index.matrix(mat_big, obj_TRS$TRS, probs, date, prefix, .parallel = 1, .nchunk = ncluster))
})
all.equal(l_hw1, l_hw2)
data('dTmax')
probs <- c(0.9, 0.95, 0.975, 0.99, 0.995, 0.9975, 0.999, 0.9995, 0.99975, 0.9999)
d_hw <- HW_index(dTmax, probs = probs, simplify = TRUE)
# r <- index_FAR_2d.year(mat_big, year, obj_TRS$TRS, p_left = probs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.