Skip to content

191 spawner recruit rebased #347

191 spawner recruit rebased

191 spawner recruit rebased #347

Workflow file for this run

# Check that MCMC using the NUTS algorithim in ADMB is reproducible with SS3 using the simple model.
# Developed with Cole Monnahan.
# Only runs on a pull request and a push to main if the tpl files have changed.
name: run-ss3-mcmc
on:
workflow_dispatch:
push:
paths:
- '**.tpl'
branches:
- main
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize', 'ready_for_review']
paths:
- '**.tpl'
branches:
- main
# Check MCMC works
jobs:
run-ss3-no-est:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"
steps:
- name: Checkout ss3 repo
uses: actions/checkout@v4
- name: Checkout models repo
uses: actions/checkout@v4
with:
repository: 'nmfs-ost/ss3-test-models'
path: test-models-repo
- name: Update Ubuntu packages
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install --only-upgrade libstdc++6
- name: Setup R
uses: r-lib/actions/setup-r@v2
# - name: Get admb and put in path, linux
# run: |
# wget https://github.com/admb-project/admb/releases/download/admb-13.1/admb-13.1-linux.zip
# sudo unzip admb-13.1-linux.zip -d /usr/local/bin
# sudo chmod 755 /usr/local/bin/admb-13.1/bin/admb
# echo "/usr/local/bin/admb-13.1/bin" >> $GITHUB_PATH
# - name: Build stock synthesis
# run: |
# rm -rf SS330
# mkdir SS330
# /bin/bash ./Make_SS_330_new.sh -b SS330
- name: Build stock synthesis with admb docker image
run: |
rm -rf SS330
rm -rf ss3_osx.tar
mkdir SS330
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330
- name: Move exes, scripts to needed locations
run: |
mv test-models-repo/models/Simple/starter.ss starter.ss
mv test-models-repo/models/Simple/forecast.ss forecast.ss
mv test-models-repo/models/Simple/control.ss control.ss
mv test-models-repo/models/Simple/data.ss data.ss
mv SS330/ss3 ss3
ls
- name: Change permissions on ss3 exe
run: sudo chmod a+x ss3
- name: Run models without estimation
run: |
# Run NUTS algorithim in ADMB to make sure still works with stock synthesis
# run the simple model with -hbf option to get the necessary files
system("./ss3 -hbf")
# run the simple model 30 times using the NUTS algorithim
niters <- 100
for (i in 1:niters) {
message("Running iteration ", i)
# run simple model
system("./ss3 -maxfn 0 -phase 40 -nohess -mcmc 10 -nuts -mcseed 1 -max_treedepth 3")
# read in adaption.csv
adapt_df <- read.csv("adaptation.csv")
if(i == 1) {
compare_val <- adapt_df[nrow(adapt_df), "stepsize__"]
message("Getting ref value from iteration ", i, ". Ref value is " ,
compare_val)
} else {
message("Checking iteration ", i)
val_to_check <- adapt_df[nrow(adapt_df), "stepsize__"]
if(!identical(val_to_check, compare_val)) {
stop("First step size for iteration ", i ," (step size =",
val_to_check,
")", " was not equal to values in the first iteration (",
compare_val, ").")
}
}
}
message("No differences in step size among stock synthesis runs.")
shell: Rscript {0}