-
Notifications
You must be signed in to change notification settings - Fork 0
/
sim-accre.R
35 lines (29 loc) · 1.17 KB
/
sim-accre.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#############################################################################
##
## ACCRE specific configuration here
##
## This area is for things that require ACCRE specific configuration
##
##
## An example when C++ was required and needed specical compile flags
Sys.setenv(PKG_LIBS="-L${MKLROOT}/lib/intel64 -lmkl_rt -lpthread -lm -ldl")
Sys.setenv(PKG_CXXFLAGS="-I${MKLROOT}/include")
#############################################################################
##
## Load simulation file that contains `simulation <- function(array_task_id)`
source("simulation.R")
#############################################################################
##
## ACCRE batch run
# Pull the ARRAY number from the command line arguments provided by slurm
args <- commandArgs(trailingOnly=TRUE)
array_task_id <- as.numeric(args[1])
# A simple output statement to the logs
cat("Batch", array_task_id, "\n")
# Set the random seed using the array number
# This could be moved inside the simulation function
# But is included here for pedantic purposes as
# this is _key_ to repoducibility.
set.seed(array_task_id)
# Now run the simulation and provide the array number
simulation(array_task_id)