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

R handing after Java finished computing #95

Open
WillRust303 opened this issue Mar 19, 2024 · 0 comments
Open

R handing after Java finished computing #95

WillRust303 opened this issue Mar 19, 2024 · 0 comments

Comments

@WillRust303
Copy link

WillRust303 commented Mar 19, 2024

Hi there,

I am trying to calculate the CPU time for a broad range of netlogo sims, however at the moment I am only running one simulation and timing that. I have noticed that simulations (even for one, small simulation) takes ~7x longer on nrlx than it does in NetLogo (NetLogo ~1 min, nlrx ~7 mins). Looking at the Processes in Windows Task Manager, it seems that when I run the sim from nlrx, java starts computing and then after about a minute, java finishes and closes. R then hangs for the remaining time before completeing its process.

I see other issues posted here on similar issues but the response is typically due to running too many sims / parameters. Whereas I am running only one simulation. I have pasted my code below:

R Code

Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre-1.8')

netlogopath <- file.path("C:/Program Files/NetLogo 6.0.3")
modelpath <- "AJ2015_upscale_test.nlogo")
outpath <- file.path("C:/out")

#~~~~~~~~~~~~~~OPEN MODEL AND TEST~~~~~~~~~~~~~~~~~~#
nl <- nl(nlversion = "6.0.3",
nlpath = netlogopath,
modelpath = modelpath,
jvmmem = 2048*8)

nl@experiment <- experiment(expname = "worms",
outpath = outpath,
repetition = 1,
tickmetrics = "true",
idsetup = "setup",
idgo = "go",
runtime = 7300,
evalticks = seq(1,7300),
constants = list("Application_Rate" = 0,
"Application_Year" = 0,
"Application_Day" = 0,
"Initial_Number_Adults" = 300,
"Initial_Number_Juveniles" = 300,
"Initial_Number_Cocoons" = 300),
metrics.turtles = list("turtles" = c("who", "xcor", "ycor", "mass", "age", "breed")))

eval_variables_constants(nl)

nl@simdesign <- simdesign_simple(nl = nl, nseeds = 1)
start <- Sys.time()
results <- run_nl_all(nl = nl)
end <- Sys.time()

difftime(end, start, units = "mins")

Any help you could give would be great! Thanks again.

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

1 participant