Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions .github/workflows/build-ss3-warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,49 +60,48 @@ jobs:
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -w &> warnings.txt

# Runs a set of commands using the runners shell
- name: Use R to parse warnings output
- name: Print warnings
run: cat warnings.txt

- name: Use R to parse warnings output and determine if amount of warnings has changed
run: |
txt <- readLines("warnings.txt", encoding = "UTF-8")
warn_line <- grep(pattern = "g++ -c -std=c++17 -O3 -Wall -Wextra -D_USE_MATH_DEFINES -DUSE_ADMB_CONTRIBS", x = txt, fixed = TRUE)
warn_line <- grep(pattern = "g++ -c -std=c++17 -O3 -Wall -Wextra -static-libstdc++ -static-libgcc -D_USE_MATH_DEFINES -DUSE_ADMB_CONTRIBS", x = txt, fixed = TRUE)
end_warn_line <- grep(pattern = "*** Linking: ss3.obj ", x = txt, fixed = TRUE)
if (length(warn_line) == 1 & length(end_warn_line) == 1) {
txt <- txt[(warn_line+3):(end_warn_line-1)]
rm_warn_start_lines <- grep(pattern = "/usr/local/admb/include/admodel.h: ", x = txt, fixed = TRUE, invert = TRUE)
txt <- txt[rm_warn_start_lines]
n_errors <- length(grep(pattern = "^ [0-9]", x = txt))
message("There are ", n_errors, " warning messages related to SS3.")
write.table(n_errors, "n_warn.txt")
# write.table(n_errors, "n_warn.txt")
}
writeLines(txt, "warnings_ss.txt")
# warn_line <- grep(pattern = "compiling a second time to get warnings", x = txt, fixed = TRUE)
# txt <- txt[(warn_line+1):length(txt)]
shell: Rscript {0}

- name: Print warnings
run: cat warnings_ss.txt

- name: Determine if fails/passes based on the number of warnings
run: |
ref <- readLines(".github/workflows/reference_files/warnings_ss_ref.txt")
n_warn <- read.table("n_warn.txt")
n_warn <- as.integer(n_warn[1,1])
ref2 <- ref[!grepl("ss3.obj", ref) & nzchar(txt)]
n_warn <- n_errors
if(n_warn != 0){
n_warn <- as.integer(n_warn[1,1])
}
if (n_warn > length(ref)) {
stop("Increased number of warnings compared to reference warning file")
} else {
# n_warn doesn't take into account the "In file included from ss.cpp:7:"
# so add 2 to add those lines back in
if (n_warn+length(ref) < length(ref)){
stop("Number of warnings of decreased compared to reference warning file")
message("Number of warnings of decreased compared to reference warning file, if this is pushed to main, change the ref file")
} else {
message("Acceptable number of warnings")
message(paste0("Acceptable number of warnings: ", n_warn))
}
}
shell: Rscript {0}

- name: Print warnings
run: cat warnings_ss.txt

- name: Archive warnings text file
if: always()
uses: actions/upload-artifact@main
with:
name: 'warnings_ss.txt'
path: warnings_ss.txt
path: warnings_ss.txt
15 changes: 3 additions & 12 deletions .github/workflows/reference_files/warnings_ss_ref.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/usr/local/admb/include/admodel.h:1915:38: warning: unused parameter 'gradients' [-Wunused-parameter]
1915 | virtual void report(const dvector& gradients){;};
| ~~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/admb/include/admodel.h:2501:43: warning: unused parameter 'ofs' [-Wunused-parameter]
2501 | virtual void save_value(const ofstream& ofs, int prec,const dvector&,
| ~~~~~~~~~~~~~~~~^~~
/usr/local/admb/include/admodel.h:2501:52: warning: unused parameter 'prec' [-Wunused-parameter]
2501 | virtual void save_value(const ofstream& ofs, int prec,const dvector&,
| ~~~~^~~~
/usr/local/admb/include/admodel.h:2502:10: warning: unused parameter 'offset' [-Wunused-parameter]
2502 | int& offset){}
| ~~~~~^~~~~~
g++ -std=c++17 -O3 -oss3 ss3.obj "/usr/local/admb/lib/libadmb-contrib-x86_64-linux-g++13.a"
*** Linking: ss3.obj

22 changes: 12 additions & 10 deletions SS_benchfore.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
SSBpR_Calc(equ_Recr);
F01_origin = YPR_opt / Fmult;

BTGT_target = 0.1; // now relative to Bmark
BTGT_frac = 0.1; // now relative to Bmark
Btgttgt = F01_origin * 0.1;
if (show_MSY == 1)
{
Expand Down Expand Up @@ -1138,18 +1138,18 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
{
// ******************************************************

if (depletion_basis == 1)
{Btgttgt = BTGT_target * SSB_virgin;}
if (depletion_basis == 1 && timevary_bio_4SRR != 0)
{Btgttgt = BTGT_frac * SSB_virgin;}
else
{Btgttgt = BTGT_target * SSB_unf;} // current SS3 approach uses benchmark biology
{Btgttgt = BTGT_frac * SSB_unf;} // current SS3 approach uses benchmark biology

if (show_MSY == 1)
{
report5 << "#" << endl;
if (depletion_basis == 1)
{report5 << "Find_target_SSB as fraction: " << BTGT_target << " of Virgin SSB:" << SSB_virgin << endl;}
if (depletion_basis == 1 && timevary_bio_4SRR != 0)
{report5 << "Find_target_SSB as fraction: " << BTGT_frac << " of Virgin SSB:" << SSB_virgin << endl;}
else
{report5 << "Find_target_SSB as fraction: " << BTGT_target << " of SSB_unf: "<< SSB_unf << endl;}
{report5 << "Find_target_SSB as fraction: " << BTGT_frac << " of SSB_unf: "<< SSB_unf << endl;}
report5 << "Iter Fmult ann_F SPR Catch SSB Recruits SSB/Bzero Tot_catch";

for (p = 1; p <= pop; p++)
Expand Down Expand Up @@ -1212,9 +1212,11 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
}
SSBpR_Calc(equ_Recr); // where equ_Recr=1.0, so returned SSB_equil is in units of SSB/R,
SSBpR_temp = SSB_equil;
// warning << equ_Recr << " " << SSB_equil << " " << SRparm_bench << " " << SSBpR_temp << endl;
SPR_Btgt = SSBpR_temp / SSBpR_unf; // where SSBpR_unf = SSB_unf / Recr_unf so units of SSB/R; so result is SPR_Btgt = (fished SSB/R) / (unfished SSB/R)
// SPAWN-RECR: calc equil spawn-recr for Btarget calcs; need to make area-specific
Equ_SpawnRecr_Result = Equil_Spawn_Recr_Fxn(SRparm_bench, SSB0_4_SRR, R0_4_SRR, SSBpR_temp); // returns 2 element vector containing equilibrium biomass and recruitment at this SPR
// warning << SSB0_4_SRR << " " << R0_4_SRR << Equ_SpawnRecr_Result << endl;
yld1(ii) = Equ_SpawnRecr_Result(1);
}

Expand Down Expand Up @@ -1247,7 +1249,7 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
if (show_MSY == 1)
{
report5 << j << " " << Fmult << " " << equ_F_std << " " << SPR_Btgt << " " << YPR_dead * Equ_SpawnRecr_Result(2) << " " << Btgt << " " << Equ_SpawnRecr_Result(2)
<< " " << Btgt / SSB_unf << " " << sum(equ_catch_fleet(2)) * Equ_SpawnRecr_Result(2);
<< " " << Btgt / (Btgttgt / BTGT_frac) << " " << sum(equ_catch_fleet(2)) * Equ_SpawnRecr_Result(2);
for (p = 1; p <= pop; p++)
for (gp = 1; gp <= N_GP; gp++)
{
Expand Down Expand Up @@ -1774,7 +1776,7 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
Nloops = 28;
}

// Btgttgt=BTGT_target*SSB_virgin; // this is relative to virgin, not to the average biology from benchmark years
// Btgttgt=BTGT_frac*SSB_virgin; // this is relative to virgin, not to the average biology from benchmark years
double Blim_report;
if (Blim_frac > 0.0)
{
Expand Down Expand Up @@ -1971,7 +1973,7 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
{
report5 << "#" << endl
<< "Ratio_SSB/B0_as_target" << endl;
report5 << "Ratio_target " << BTGT_target << endl;
report5 << "Ratio_target " << BTGT_frac << endl;
report5 << "Ratio_calc " << Btgt / SSB_unf << endl;
report5 << "SPR@Btgt " << SPR_Btgt << endl;
report5 << "Fmult " << Btgt_Fmult << endl;
Expand Down
4 changes: 2 additions & 2 deletions SS_readcontrol_330.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7026,7 +7026,7 @@
}
case 3: // compare to SPR_Btarget
{
sprintf(onenum, "%d", int(100. * BTGT_target));
sprintf(onenum, "%d", int(100. * BTGT_frac));
SPR_report_label += " (1-SPR)/(1-SPR_at_B" + onenum + "%)";
break;
}
Expand Down Expand Up @@ -7057,7 +7057,7 @@
}
case 3:
{
sprintf(onenum, "%d", int(100. * BTGT_target));
sprintf(onenum, "%d", int(100. * BTGT_frac));
F_report_label = "(F)/(F_at_B" + onenum + "%)";
break;
}
Expand Down
6 changes: 3 additions & 3 deletions SS_readdata_330.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3808,7 +3808,7 @@
ivector Bmark_Yr(1,10);
ivector Bmark_t(1,2); // for range of time values for averaging body size
number SPR_target;
number BTGT_target;
number BTGT_frac;
number Blim_frac;
int MSY_units; // 1=dead catch, 2=retained catch, 3=retained catch profits
vector CostPerF(1,Nfleet);
Expand Down Expand Up @@ -3937,8 +3937,8 @@
echoinput << "next read SPR target and Biomass target as fractions" << endl;
*(ad_comm::global_datafile) >> SPR_target;
echoinput << SPR_target << " echoed SPR_target " << endl;
*(ad_comm::global_datafile) >> BTGT_target;
echoinput << BTGT_target << " echoed B_target " << endl;
*(ad_comm::global_datafile) >> BTGT_frac;
echoinput << BTGT_frac << " echoed BTGT_frac " << endl;

if (Do_Benchmark == 3)
{
Expand Down
2 changes: 1 addition & 1 deletion SS_write_ssnew.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ FUNCTION void write_nucontrol()
}

NuFore << SPR_target << " # SPR target (e.g. 0.40)" << endl;
NuFore << BTGT_target << " # Biomass target (e.g. 0.40) as fraction of SSB_virgin if depletion basis = 1, else as fraction of SSB_unfished in benchmark" << endl;
NuFore << BTGT_frac << " # Biomass target (e.g. 0.40) as fraction of SSB_virgin if depletion basis = 1 or time_vary compatibility = 0, else as fraction of SSB_unfished in benchmark" << endl;
if (Do_Benchmark != 3) NuFore << "#";
NuFore << Blim_frac << " # COND: Do_Benchmark==3; Blimit as fraction of Bmsy (neg value to use as frac of SSB_virgin or SSB_unfished) (e.g. 0.50)";
NuFore << "#" << endl << "# Bmark_years: beg_bio, end_bio, beg_selex, end_selex, beg_relF, end_relF, beg_recr_dist, end_recr_dist, beg_SRparm, end_SRparm (enter actual year, or values of 0 or -integer to be rel. endyr)" << endl
Expand Down
13 changes: 13 additions & 0 deletions warnings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
!!version_info += "#V3.30.xx.yy;_safe;_compile_date:_";
-- Building ss3 with docker in 'SS330' --
*** Parse: ss3.tpl
tpl2cpp ss3 || tpl2rem ss3

*** Compile: ss3.cpp
g++ -c -std=c++17 -O3 -Wall -Wextra -D_USE_MATH_DEFINES -DUSE_ADMB_CONTRIBS -I. -I"/usr/local/admb/include" -I"/usr/local/admb/include/contrib" -oss3.obj ss3.cpp

*** Linking: ss3.obj
g++ -std=c++17 -O3 -oss3 ss3.obj "/usr/local/admb/lib/libadmb-contrib-x86_64-linux-g++13.a"

Successfully built executable.

Loading