Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contextual do_parallel dosnt work on MRAN 3.5.1 #17

Closed
fhujiil opened this issue Mar 22, 2020 · 3 comments
Closed

contextual do_parallel dosnt work on MRAN 3.5.1 #17

fhujiil opened this issue Mar 22, 2020 · 3 comments

Comments

@fhujiil
Copy link

fhujiil commented Mar 22, 2020

Hi!
I try to run on my MRAN 3.5.1:
history <- Simulator$new(agents = agent,
horizon = horizon,
simulations = 1000,do_parallel = T)$run()
but recieve :
Setting up parallel backend.
Cores available: 4
Workers assigned: 3
Simulation horizon: 250
Number of simulations: 5000 # this also stay unchanged!
Number of batches: 3
Starting main loop.
Error in gp$globals[[match(s, syms)]] : subscript out of bounds

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)

Matrix products: default

locale:
[1] LC_COLLATE=Russian_Russia.1251 LC_CTYPE=Russian_Russia.1251 LC_MONETARY=Russian_Russia.1251
[4] LC_NUMERIC=C LC_TIME=Russian_Russia.1251

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] itertools_0.1-3 iterators_1.0.10 data.table_1.11.4 contextual_0.9.8.3 RevoUtils_11.0.1
[6] RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
[1] codetools_0.2-15 listenv_0.7.0 future_1.9.0 withr_2.1.2 digest_0.6.15 foreach_1.5.0
[7] R.methodsS3_1.7.1 R6_2.3.0 R.devices_2.16.0 doParallel_1.0.13 R.oo_1.22.0 R.utils_2.6.0
[13] devtools_1.13.6 Formula_1.2-3 rjson_0.2.20 tools_3.5.1 yaml_2.2.0 parallel_3.5.1
[19] compiler_3.5.1 base64enc_0.1-3 globals_0.12.1 memoise_1.1.0

@fhujiil fhujiil changed the title contextual do_parallel dosnt work on MRAN contextual do_parallel dosnt work on MRAN 3.5.1 Mar 22, 2020
@g0ulash
Copy link
Contributor

g0ulash commented Mar 23, 2020

Can you show the complete code that you are trying to run? That would make debugging a tad easier.

@fhujiil
Copy link
Author

fhujiil commented Apr 1, 2020

Here it is :
prob_per_arm <- c(0.1, 0.1, 0.1, 0.1, 0.9)
horizon <- 250
simulations <- 1000

bandit <- BasicBernoulliBandit$new(weights = prob_per_arm)

agent <- list(Agent$new(EpsilonGreedyPolicy$new(0.1), bandit, "Epsilon = 0.1"),
Agent$new(EpsilonGreedyPolicy$new(0.2), bandit, "Epsilon = 0.2"),
Agent$new(EpsilonGreedyPolicy$new(0.3), bandit, "Epsilon = 0.3"),
Agent$new(EpsilonGreedyPolicy$new(0.4), bandit, "Epsilon = 0.4"),
Agent$new(EpsilonGreedyPolicy$new(0.5), bandit, "Epsilon = 0.5"))
history <- Simulator$new(agents = agent,
horizon = horizon,
simulations = 1000,do_parallel = T)$run()

@robinvanemden
Copy link
Member

robinvanemden commented Apr 9, 2020

Hi @fhujiil -thanks for reporting this issue! It seems that using setMKLthreads() in MRO 3.5.3 in combination with RStudio crashes R. See also here.

I was able to resolve the issue by skipping "setMKLthreads(1)" when both RStudio and MRAN are detected .

This might degrade performance when running contextual on MRAN+RStudio though - as contextual's parallel processing and MRAN's multi-threaded linear algebra computations will now compete for the same processors.

This solution will be in contextual's next CRAN release, probably sometime next month. To use the updated code right away, just install from GitHub:

install.packages("devtools")
devtools::install_github('Nth-iteration-labs/contextual')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants