Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lars Dalby
almass
Commits
e15317c1
Commit
e15317c1
authored
Jan 04, 2019
by
LDalby
Browse files
Add starter and collector scripts. Adjust sbatch script
parent
9800a993
Changes
3
Hide whitespace changes
Inline
Side-by-side
Grendel/ALMaSS_q28_goose_scenario_02
View file @
e15317c1
...
...
@@ -4,7 +4,7 @@
#SBATCH --ntasks=1
#SBATCH --mem=240G
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=
4
#SBATCH --cpus-per-task=
8
#SBATCH --time=06:00:00
#SBATCH --exclusive
#SBATCH --mem-per-cpu=60G
...
...
@@ -12,6 +12,6 @@
#SBATCH --mail-user=lars@bios.au.dk
echo "========= Job started at `date` =========="
sh /home/ldalby/ALMaSS/almass/Grendel/start-scenario_0
1
.sh
sh /home/ldalby/ALMaSS/almass/Grendel/start-scenario_0
2
.sh
echo "========= Job finished at `date` =========="
#
\ No newline at end of file
Grendel/collect-results-scenario_02.R
0 → 100644
View file @
e15317c1
# Collect results from parameter fitting
# Author: Lars Dalby
# Date: 12 Aug 2018
# Short script to combine the results form mulitple runs into one file and
# write that to a safe place on Grendel.
# Set the local R package library (if not done already)
if
(
!
"/home/ldalby/R/packages"
%in%
.libPaths
())
{
.libPaths
(
"/home/ldalby/R/packages"
)
}
suppressMessages
(
library
(
furrr
))
library
(
fs
)
library
(
magrittr
)
# Get the slurm job-id (is being passed in from the shell script calling this R script)
args
<-
commandArgs
(
trailingOnly
=
TRUE
)
# The parent directory of all the work directories
path_to_dirs
<-
path
(
"/scratch"
,
args
)
file_name
<-
"scenario-results.txt"
npar
=
4
# Specifies the number of run directories that was being used
plan
(
multiprocess
)
# to run in parallel future_map in parallel.
suffix
<-
stringr
::
str_pad
(
as.character
(
1
:
npar
),
width
=
2
,
pad
=
"0"
)
path
(
path_to_dirs
,
glue
::
glue
(
"WD{suffix}"
),
"Results"
,
file_name
)
%>%
future_map
(
data.table
::
fread
)
%>%
data.table
::
rbindlist
()
%>%
data.table
::
setnames
(
c
(
"season"
,
"day"
,
"pinkfoot"
,
"pinkfoot_dist"
,
"barnacle"
,
"barnacle_dist"
,
"greylag"
,
"greylag_dist"
,
"grain"
,
"maize"
,
"polyref"
,
"param"
,
"value"
))
->
all_res
grain_file_name
<-
"scenario-grain-distributions.txt"
path
(
path_to_dirs
,
glue
::
glue
(
"WD{suffix}"
),
"Results"
,
grain_file_name
)
%>%
future_map
(
data.table
::
fread
)
%>%
data.table
::
rbindlist
()
%>%
data.table
::
setnames
(
c
(
"season"
,
"grain_dist"
,
"param"
,
"value"
))
->
all_grain
numbers_file_name
<-
"scenario-goose-numbers.txt"
path
(
path_to_dirs
,
glue
::
glue
(
"WD{suffix}"
),
"Results"
,
numbers_file_name
)
%>%
future_map
(
data.table
::
fread
)
%>%
data.table
::
rbindlist
()
%>%
data.table
::
setnames
(
c
(
"season"
,
"day"
,
"pf_families"
,
"pf_non_breeders"
,
"bn_families"
,
"bn_non_breeders"
,
"gl_families"
,
"gl_non_breeders"
,
"snow_depth"
,
"param"
,
"value"
))
->
all_numbers
dest_dir
<-
"/home/ldalby/workspace/Goose/Scenarios/Results/"
res_file_name
<-
glue
::
glue
(
"{args}_scenario-results_{Sys.Date()}.fst"
)
fst
::
write_fst
(
all_res
,
path
=
path
(
dest_dir
,
res_file_name
))
grain_file_name
<-
glue
::
glue
(
"{args}_scenario-grain-distributions_{Sys.Date()}.fst"
)
fst
::
write_fst
(
all_grain
,
path
=
path
(
dest_dir
,
grain_file_name
))
numbers_file_name
<-
glue
::
glue
(
"{args}_scenario-goose-numbers_{Sys.Date()}.fst"
)
fst
::
write_fst
(
all_numbers
,
path
=
path
(
dest_dir
,
numbers_file_name
))
vers_path
<-
path
(
"/scratch"
,
args
,
"WD01"
,
"almass-version.txt"
)
file_copy
(
vers_path
,
path
(
dest_dir
,
glue
::
glue
(
"{args}_almass-version.txt"
)))
Grendel/start-scenario_02.sh
0 → 100644
View file @
e15317c1
#!/bin/bash
cd
/home/ldalby/workspace/Goose/Scenarios
chmod
+x scenario_01_goose-numbers_file-dist.R
/home/com/R/3.4.1/bin/Rscript scenario_01_goose-numbers_file-dist.R
$SLURM_JOB_ID
for
i
in
{
01..4
}
;
do
cd
/scratch/
$SLURM_JOB_ID
/WD
"
$i
"
chmod
+x _01_BatchLoop.sh
./_01_BatchLoop.sh
>
out &
sleep
5
done
wait
cd
/home/ldalby/workspace/Goose/Scenarios
chmod
+x collect-results-scenario_01.R
/home/com/R/3.4.1/bin/Rscript collect-results-scenario_01.R
$SLURM_JOB_ID
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment