diff --git a/.github/workflows/build-ss3-warnings.yml b/.github/workflows/build-ss3-warnings.yml index 21bb038a..f1343a17 100644 --- a/.github/workflows/build-ss3-warnings.yml +++ b/.github/workflows/build-ss3-warnings.yml @@ -45,7 +45,7 @@ jobs: - name: Build stock synthesis with warnings displayed in console using admb docker image run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -w @@ -53,7 +53,7 @@ jobs: - name: Build stock synthesis with warnings again to save to file run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -w &> warnings.txt @@ -61,21 +61,17 @@ jobs: # Runs a set of commands using the runners shell - name: Use R to parse warnings output run: | - txt <- readLines("warnings.txt", encoding = "UTF-8" ) + 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) - end_warn_line <- grep(pattern = "*** Linking: ss.obj ", x = txt, fixed = TRUE) - txt <- txt[(warn_line+2):(end_warn_line-1)] - rm_warn_start_lines <- grep(pattern = "/usr/local/admb/include/admodel.h", x = txt, fixed = TRUE) - all_warning_end_lines <- grep(pattern = "^", x = txt, fixed = TRUE) - to_rm <- NULL - for (l in rm_warn_start_lines) { - tmp_end_line <- min(all_warning_end_lines[all_warning_end_lines > l]) - to_rm <- c(to_rm, l:tmp_end_line) - } - txt <- txt[-to_rm] - n_errors <- length(grep(pattern = "^", x = txt)) - message("There are ", n_errors, " warning messages related to SS.") - write.table(n_errors, "n_warn.txt") + 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") + } 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)] diff --git a/.github/workflows/build-ss3.yml b/.github/workflows/build-ss3.yml index 02d16ce2..66c9a361 100644 --- a/.github/workflows/build-ss3.yml +++ b/.github/workflows/build-ss3.yml @@ -207,10 +207,10 @@ jobs: run: | mkdir SS330 chmod 777 SS330 - mv Compile/ss.exe SS330/ - mv Compile/ss_opt.exe SS330/ - mv SS330/ss.exe SS330/ss3_win.exe - mv SS330/ss_opt.exe SS330/ss3_opt_win.exe + mv Compile/ss3.exe SS330/ + mv Compile/ss3_opt.exe SS330/ + mv SS330/ss3.exe SS330/ss3_win.exe + mv SS330/ss3_opt.exe SS330/ss3_opt_win.exe - name: Build stock synthesis for mac with admb docker image if: matrix.config.os == 'macos-latest' @@ -220,7 +220,7 @@ jobs: docker pull johnoel/admb:linux rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 @@ -231,22 +231,22 @@ jobs: - name: Verify binary on mac if: matrix.config.os == 'macos-latest' run: | - shasum -a 256 SS330/ss - shasum -a 256 SS330/ss_opt + shasum -a 256 SS330/ss3 + shasum -a 256 SS330/ss3_opt - name: Delete unneeded files and change exe names on mac if: matrix.config.os == 'macos-latest' run: | cd SS330 - rm *.obj *.htp *.cpp ss_opt.tpl - mv ss ss3_osx - mv ss_opt ss3_opt_osx + rm *.obj *.htp *.cpp ss3_opt.tpl + mv ss3 ss3_osx + mv ss3_opt ss3_opt_osx - name: Build stock synthesis for linux with p flag and admb docker image if: matrix.config.os == 'ubuntu-latest' run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -p @@ -255,16 +255,16 @@ jobs: - name: Verify binary on linux if: matrix.config.os == 'ubuntu-latest' run: | - sha256sum SS330/ss - sha256sum SS330/ss_opt + sha256sum SS330/ss3 + sha256sum SS330/ss3_opt - name: Delete unneeded files and change exe names on linux if: matrix.config.os == 'ubuntu-latest' run: | cd SS330 - rm *.obj *.htp *.cpp ss_opt.tpl ss.tpl - mv ss ss3_linux - mv ss_opt ss3_opt_linux + rm *.obj *.htp *.cpp ss3_opt.tpl ss3.tpl + mv ss3 ss3_linux + mv ss3_opt ss3_opt_linux - name: Archive binaries if: success() diff --git a/.github/workflows/reference_files/warnings_ss_ref.txt b/.github/workflows/reference_files/warnings_ss_ref.txt index c7b50e46..d92da4e6 100644 --- a/.github/workflows/reference_files/warnings_ss_ref.txt +++ b/.github/workflows/reference_files/warnings_ss_ref.txt @@ -1,8 +1,12 @@ -In file included from ss.cpp:7: -ss.cpp: In member function 'void model_parameters::evaluate_the_objective_function()': -ss.cpp:27544:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation] -27544 | for (i = 1; i <= Svy_N_fleet(f); i++) - | ^~~ -ss.cpp:27571:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for' -27571 | surv_like(f) = sum(Svy_like_I(f)); - | ^~~~~~~~~ +/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){} + | ~~~~~^~~~~~ diff --git a/.github/workflows/run-ss3-bootstrap.yml b/.github/workflows/run-ss3-bootstrap.yml index 02ad347c..ebceb6b6 100644 --- a/.github/workflows/run-ss3-bootstrap.yml +++ b/.github/workflows/run-ss3-bootstrap.yml @@ -58,7 +58,7 @@ jobs: - name: Build stock synthesis with admb docker image run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 @@ -66,7 +66,7 @@ jobs: - name: move exes, scripts to needed locations run: | mv test-models-repo/models test-models-repo/model_runs - mv SS330/ss test-models-repo/model_runs/Simple_with_DM_sizefreq/ss3 + mv SS330/ss3 test-models-repo/model_runs/Simple_with_DM_sizefreq/ss3 - name: change permissions on ss3 exes run: sudo chmod a+x test-models-repo/model_runs/Simple_with_DM_sizefreq/ss3 diff --git a/.github/workflows/run-ss3-mcmc.yml b/.github/workflows/run-ss3-mcmc.yml index b265d85b..cba1203d 100644 --- a/.github/workflows/run-ss3-mcmc.yml +++ b/.github/workflows/run-ss3-mcmc.yml @@ -56,7 +56,7 @@ jobs: - name: Build stock synthesis with admb docker image run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 @@ -67,7 +67,7 @@ jobs: 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/ss ss3 + mv SS330/ss3 ss3 ls - name: change permissions on ss exe diff --git a/.github/workflows/run-ss3-no-est.yml b/.github/workflows/run-ss3-no-est.yml index de0cff1e..912ced4a 100644 --- a/.github/workflows/run-ss3-no-est.yml +++ b/.github/workflows/run-ss3-no-est.yml @@ -62,7 +62,7 @@ jobs: - name: Build stock synthesis with admb docker image run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 @@ -70,7 +70,7 @@ jobs: - name: move exes, scripts to needed locations run: | mv test-models-repo/models test-models-repo/model_runs - mv SS330/ss test-models-repo/model_runs/ss3 + mv SS330/ss3 test-models-repo/model_runs/ss3 mv test-models-repo/.github/r_scripts/run_from_par.R test-models-repo/run_from_par.R mv test-models-repo/.github/r_scripts/run_compare_noest.R test-models-repo/run_compare_noest.R diff --git a/.github/workflows/run-ss3-with-est.yml b/.github/workflows/run-ss3-with-est.yml index da32e049..667068c3 100644 --- a/.github/workflows/run-ss3-with-est.yml +++ b/.github/workflows/run-ss3-with-est.yml @@ -52,7 +52,7 @@ jobs: - name: Build stock synthesis with admb docker image run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 @@ -60,7 +60,7 @@ jobs: - name: move exes, scripts to needed locations run: | mv test-models-repo/models test-models-repo/model_runs - mv SS330/ss test-models-repo/model_runs/ss3 + mv SS330/ss3 test-models-repo/model_runs/ss3 - name: change permissions on ss3 exes run: sudo chmod a+x test-models-repo/model_runs/ss3 diff --git a/.github/workflows/test-r4ss-with-ss3.yml b/.github/workflows/test-r4ss-with-ss3.yml index 9aee8dda..c4dce171 100644 --- a/.github/workflows/test-r4ss-with-ss3.yml +++ b/.github/workflows/test-r4ss-with-ss3.yml @@ -64,7 +64,7 @@ jobs: - name: Build stock synthesis with admb docker image run: | rm -rf SS330 - rm -rf ss_osx.tar + rm -rf ss3_osx.tar mkdir SS330 chmod 777 SS330 /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 @@ -72,7 +72,7 @@ jobs: - name: move exes, scripts to needed locations run: | mv test-models-repo/models test-models-repo/model_runs - mv SS330/ss test-models-repo/model_runs/ss3 + mv SS330/ss3 test-models-repo/model_runs/ss3 mv test-models-repo/.github/r_scripts/run_from_par.R test-models-repo/run_from_par.R mv test-models-repo/.github/r_scripts/run_compare_noest.R test-models-repo/run_compare_noest.R diff --git a/.gitignore b/.gitignore index 5c306277..2d39ecb0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,12 +8,14 @@ *.obj *.log ss.tpl +ss3.tpl ss_opt.tpl ss_trans.tpl ~$*.* Compile/ss.log +Compile/ss3.log .Rproj.user *.Rproj .Rhistory -Compile/ssFileLabels.txt -StockSynthesis.code-workspace +Compile/ssFileLabels.txt +StockSynthesis.code-workspace diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..1474b617 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "*.tpl": "c", + "*.htp": "c" + } +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 571ba1e9..4e2a655a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ All code contributions should be submitted as pull requests to be reviewed by an 3. Add ADMB to the PATH or use the ADMB command window for the following commands. 4. On Linux or Mac: - Change directory to the cloned Stock Synthesis repository and use the script [Make_SS_330_new.sh](https://github.com/nmfs-ost/ss3-source-code/blob/main/Make_SS_330_new.sh) by calling `./Make_SS_330_new.sh`. To see all options for the function, use `./Make_SS_330_new.sh --help`. - - Follow the instructions found in the [GNUmakefile](https://github.com/nmfs-ost/ss3-source-code/blob/main/GNUmakefile) which will allow you to compile Stock Synthesis using the command `~/stock-synthesis$ make` within a command line opened in the cloned Stock Synthesis repository folder. + - Follow the instructions found in the [GNUmakefile](https://github.com/nmfs-ost/ss3-source-code/blob/main/GNUmakefile) which will allow you to compile Stock Synthesis using the command `~/ss3-source-code$ make` within a command line opened in the cloned Stock Synthesis repository folder. 6. On Windows: Change directory to the cloned Stock Synthesis repository's [Compile](https://github.com/nmfs-ost/ss3-source-code/tree/main/Compile) subfolder and call the [Make_SS_safe batch script](https://github.com/nmfs-ost/ss3-source-code/blob/main/Compile/Make_SS_safe.bat) to build the "safe" version of Stock Synthesis. (to build the fast (aka optimized) version of Stock Synthesis, call the Make_SS_fast.bat batch scripts instead). Upon calling the batch script, SS3 will be built in the Compile subfolder. # Still have a question on the contributing workflow? diff --git a/Compile/Make_SS_fast.bat b/Compile/Make_SS_fast.bat index 8f5c44ab..d2a60c6d 100644 --- a/Compile/Make_SS_fast.bat +++ b/Compile/Make_SS_fast.bat @@ -12,8 +12,8 @@ del SS_functions.temp @REM create SS_functions.temp file combining various functions copy/b SS_biofxn.tpl+SS_miscfxn.tpl+SS_selex.tpl+SS_popdyn.tpl+SS_recruit.tpl+SS_benchfore.tpl+SS_expval.tpl+SS_objfunc.tpl+SS_write.tpl+SS_write_ssnew.tpl+SS_write_report.tpl+SS_ALK.tpl+SS_timevaryparm.tpl+SS_tagrecap.tpl SS_functions.temp -@REM combine remaining files to create ss.tpl -copy/b SS_versioninfo_330opt.tpl+SS_readstarter.tpl+SS_readdata_330.tpl+SS_readcontrol_330.tpl+SS_param.tpl+SS_prelim.tpl+SS_global.tpl+SS_proced.tpl+SS_functions.temp "Compile\ss_opt.tpl" +@REM combine remaining files to create ss3_opt.tpl +copy/b SS_versioninfo_330opt.tpl+SS_readstarter.tpl+SS_readdata_330.tpl+SS_readcontrol_330.tpl+SS_param.tpl+SS_prelim.tpl+SS_global.tpl+SS_proced.tpl+SS_functions.temp "Compile\ss3_opt.tpl" cd Compile @@ -21,7 +21,7 @@ if defined ADMB_HOME ( if exist "%ADMB_HOME%\\admb.cmd" ( @echo "-- Building ss_opt.exe with %ADMB_HOME%\admb.cmd in '%CD%' --" set CXX=g++ - %ADMB_HOME%\\admb.cmd -f ss_opt + %ADMB_HOME%\\admb.cmd -f ss3_opt goto CHECK ) ) @@ -30,7 +30,7 @@ if defined ADMB_HOME ( for /f "tokens=*" %%i in ('where admb.cmd 2^>^&1 ^| findstr "admb.cmd"') do ( @echo "-- Building ss_opt.exe with admb.cmd in '%CD%' --" set CXX=g++ - admb -f ss_opt.tpl + admb -f ss3_opt.tpl goto CHECK ) @@ -41,15 +41,15 @@ for /f "tokens=*" %%i in ('where docker.exe 2^>^&1 ^| findstr "docker.exe"') do set "ISWINDOWS10=found" ) if defined ISWINDOWS10 ( - docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2019-winlibs -f ss_opt.tpl + docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2019-winlibs -f ss3_opt.tpl ) else ( - docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2022-winlibs -f ss_opt.tpl + docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2022-winlibs -f ss3_opt.tpl ) goto CHECK ) :CHECK -if not exist ss_opt.exe ( - @echo "Error: Unable to build ss_opt.exe" +if not exist ss3_opt.exe ( + @echo "Error: Unable to build ss3_opt.exe" exit /b 1 ) diff --git a/Compile/Make_SS_safe.bat b/Compile/Make_SS_safe.bat index 81e74ea7..ee0860ba 100644 --- a/Compile/Make_SS_safe.bat +++ b/Compile/Make_SS_safe.bat @@ -11,8 +11,8 @@ del SS_functions.temp ::create SS_functions.temp file combining various functions copy/b SS_biofxn.tpl+SS_miscfxn.tpl+SS_selex.tpl+SS_popdyn.tpl+SS_recruit.tpl+SS_benchfore.tpl+SS_expval.tpl+SS_objfunc.tpl+SS_write.tpl+SS_write_ssnew.tpl+SS_write_report.tpl+SS_ALK.tpl+SS_timevaryparm.tpl+SS_tagrecap.tpl SS_functions.temp -::combine remaining files to create ss.tpl -copy/b SS_versioninfo_330safe.tpl+SS_readstarter.tpl+SS_readdata_330.tpl+SS_readcontrol_330.tpl+SS_param.tpl+SS_prelim.tpl+SS_global.tpl+SS_proced.tpl+SS_functions.temp "Compile\ss.tpl" +::combine remaining files to create ss3.tpl +copy/b SS_versioninfo_330safe.tpl+SS_readstarter.tpl+SS_readdata_330.tpl+SS_readcontrol_330.tpl+SS_param.tpl+SS_prelim.tpl+SS_global.tpl+SS_proced.tpl+SS_functions.temp "Compile\ss3.tpl" ::path=c:\admb;C:\rtools40\mingw64\bin;%path% @@ -20,37 +20,37 @@ cd Compile if defined ADMB_HOME ( if exist "%ADMB_HOME%\\admb.cmd" ( - @echo "-- Building ss.exe with %ADMB_HOME%\admb.cmd in '%CD%' --" + @echo "-- Building ss3.exe with %ADMB_HOME%\admb.cmd in '%CD%' --" set CXX=g++ - %ADMB_HOME%\\admb.cmd ss + %ADMB_HOME%\\admb.cmd ss3 goto CHECK ) ) @REM check if admb.cmd is in path for /f "tokens=*" %%i in ('where admb.cmd 2^>^&1 ^| findstr "admb.cmd"') do ( - @echo "-- Building ss.exe with admb.cmd in '%CD%' --" + @echo "-- Building ss3.exe with admb.cmd in '%CD%' --" set CXX=g++ - admb ss.tpl + admb ss3.tpl goto CHECK ) @REM compile executable for /f "tokens=*" %%i in ('where docker.exe 2^>^&1 ^| findstr "docker.exe"') do ( - @echo "-- Building ss.exe with docker in '%CD%' --" + @echo "-- Building ss3.exe with docker in '%CD%' --" for /f "tokens=*" %%j in ('ver ^| findstr "10.0.1"') do ( set "ISWINDOWS10=found" ) if defined ISWINDOWS10 ( - docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2019-winlibs ss.tpl + docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2019-winlibs ss3.tpl ) else ( - docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2022-winlibs ss.tpl + docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2022-winlibs ss3.tpl ) goto CHECK ) :CHECK -if not exist ss.exe ( - @echo "Error: Unable to build ss.exe" +if not exist ss3.exe ( + @echo "Error: Unable to build ss3.exe" exit /b 1 ) diff --git a/Compile/Make_SS_warn.bat b/Compile/Make_SS_warn.bat new file mode 100644 index 00000000..3fdb0d20 --- /dev/null +++ b/Compile/Make_SS_warn.bat @@ -0,0 +1,33 @@ + +::compiling ss.exe (safe executable) with generic path +::requires "Compile" directory in the same directory as the .tpl files and this .bat file + +cd .. + +::deleted temporary file +del SS_functions.temp + +::create SS_functions.temp file combining various functions +copy/b SS_biofxn.tpl+SS_miscfxn.tpl+SS_selex.tpl+SS_popdyn.tpl+SS_recruit.tpl+SS_benchfore.tpl+SS_expval.tpl+SS_objfunc.tpl+SS_write.tpl+SS_write_ssnew.tpl+SS_write_report.tpl+SS_ALK.tpl+SS_timevaryparm.tpl+SS_tagrecap.tpl SS_functions.temp + +::combine remaining files to create ss3.tpl +copy/b SS_versioninfo_330safe.tpl+SS_readstarter.tpl+SS_readdata_330.tpl+SS_readcontrol_330.tpl+SS_param.tpl+SS_prelim.tpl+SS_global.tpl+SS_proced.tpl+SS_functions.temp "Compile\ss3.tpl" + +::path=c:\admb;C:\rtools40\mingw64\bin;%path% + +cd Compile + +if exist ss3.exe ( + if exist ss3_old.exe ( + del ss3old.exe + ) + ren ss3.exe ss3_old.exe +) + +tpl2cpp ss3 + +g++ -c -std=c++14 -O2 -D_FILE_OFFSET_BITS=64 -DUSE_ADMB_CONTRIBS -D_USE_MATH_DEFINES -I. -I"C:\ADMB-13.1\include" -I"C:\ADMB-13.1\include\contrib" -Wall -Wextra -o ss3.obj ss3.cpp + +g++ -static -o ss3.exe ss3.obj "C:\ADMB-13.1\lib\libadmb-contrib-mingw64-g++8.a" + +dir *.exe diff --git a/GNUmakefile b/GNUmakefile index 45404ac2..158bdee7 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -16,53 +16,53 @@ export CXXFLAGS=-Wall -Wextra all: clean - $(MAKE) ss - $(MAKE) ss_opt + $(MAKE) ss3 + $(MAKE) ss3_opt docker: chmod -R 777 $(CURDIR) $(MAKE) USE_DOCKER=yes all -ss: ss.tpl +ss3: ss3.tpl ifdef USE_DOCKER ifeq ($(OS),Windows_NT) - docker run --rm --volume $(CURDIR):C:\\workdir\\ss --workdir C:\\workdir\\ss johnoel/admb:windows-ltsc2022-winlibs ss.tpl + docker run --rm --volume $(CURDIR):C:\\workdir\\ss --workdir C:\\workdir\\ss johnoel/admb:windows-ltsc2022-winlibs ss3.tpl else - docker run --rm --volume $(CURDIR):/workdir/ss:rw --workdir /workdir/ss johnoel/admb:linux ss.tpl + docker run --rm --volume $(CURDIR):/workdir/ss:rw --workdir /workdir/ss johnoel/admb:linux ss3.tpl endif else - $(MY_ADMB_HOME)admb $(DEBUG)$(STATIC_BUILD) ss.tpl + $(MY_ADMB_HOME)admb $(DEBUG)$(STATIC_BUILD) ss3.tpl endif -ss_opt: ss_opt.tpl +ss3_opt: ss3_opt.tpl ifdef USE_DOCKER ifeq ($(OS),Windows_NT) - docker run --rm --volume $(CURDIR):C:\\workdir\\ss_opt --workdir C:\\workdir\\ss_opt johnoel/admb:windows-ltsc2022-winlibs ss_opt.tpl + docker run --rm --volume $(CURDIR):C:\\workdir\\ss_opt --workdir C:\\workdir\\ss_opt johnoel/admb:windows-ltsc2022-winlibs ss3_opt.tpl else - docker run --rm --volume $(CURDIR):/workdir/ss_opt:rw --workdir /workdir/ss_opt johnoel/admb:linux ss_opt.tpl + docker run --rm --volume $(CURDIR):/workdir/ss_opt:rw --workdir /workdir/ss_opt johnoel/admb:linux ss3_opt.tpl endif else - $(MY_ADMB_HOME)admb -f $(DEBUG)$(STATIC_BUILD) ss_opt.tpl + $(MY_ADMB_HOME)admb -f $(DEBUG)$(STATIC_BUILD) ss3_opt.tpl endif -ss.tpl: SS_functions.temp - cat SS_versioninfo_330safe.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > ss.tpl +ss3.tpl: SS_functions.temp + cat SS_versioninfo_330safe.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > ss3.tpl -ss_opt.tpl: SS_functions.temp - cat SS_versioninfo_330opt.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > ss_opt.tpl +ss3_opt.tpl: SS_functions.temp + cat SS_versioninfo_330opt.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > ss3_opt.tpl SS_functions.temp: cat SS_biofxn.tpl SS_miscfxn.tpl SS_selex.tpl SS_popdyn.tpl SS_recruit.tpl SS_benchfore.tpl SS_expval.tpl SS_objfunc.tpl SS_write.tpl SS_write_ssnew.tpl SS_write_report.tpl SS_ALK.tpl SS_timevaryparm.tpl SS_tagrecap.tpl > SS_functions.temp clean: - @rm -vf ss - @rm -vf ss_opt - @rm -vf ss.tpl - @rm -vf ss_opt.tpl + @rm -vf ss3 + @rm -vf ss3_opt + @rm -vf ss3.tpl + @rm -vf ss3_opt.tpl @rm -vf SS_functions.temp - @rm -vf ss.cpp - @rm -vf ss.htp - @rm -vf ss.obj - @rm -vf ss_opt.cpp - @rm -vf ss_opt.htp - @rm -vf ss_opt.obj + @rm -vf ss3.cpp + @rm -vf ss3.htp + @rm -vf ss3.obj + @rm -vf ss3_opt.cpp + @rm -vf ss3_opt.htp + @rm -vf ss3_opt.obj diff --git a/Make_SS_330_new.sh b/Make_SS_330_new.sh index ed14b9d0..096d867f 100755 --- a/Make_SS_330_new.sh +++ b/Make_SS_330_new.sh @@ -36,7 +36,7 @@ function cat_safe_files() { # concatenate all tpl files to a single file cat SS_biofxn.tpl SS_miscfxn.tpl SS_selex.tpl SS_popdyn.tpl SS_recruit.tpl SS_benchfore.tpl SS_expval.tpl SS_objfunc.tpl SS_write.tpl SS_write_ssnew.tpl SS_write_report.tpl SS_ALK.tpl SS_timevaryparm.tpl SS_tagrecap.tpl > SS_functions.temp -cat SS_versioninfo_330safe.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > $BUILD_DIR/ss.tpl +cat SS_versioninfo_330safe.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > $BUILD_DIR/ss3.tpl } # create opt source tpl @@ -44,14 +44,14 @@ function cat_opt_files() { # concatenate all tpl files to a single file cat SS_biofxn.tpl SS_miscfxn.tpl SS_selex.tpl SS_popdyn.tpl SS_recruit.tpl SS_benchfore.tpl SS_expval.tpl SS_objfunc.tpl SS_write.tpl SS_write_ssnew.tpl SS_write_report.tpl SS_ALK.tpl SS_timevaryparm.tpl SS_tagrecap.tpl > SS_functions.temp -cat SS_versioninfo_330opt.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > $BUILD_DIR/ss_opt.tpl +cat SS_versioninfo_330opt.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > $BUILD_DIR/ss3_opt.tpl } # default directories SRC_DIR=. BUILD_DIR=SS330 # other defaults (safe build is the default) -BUILD_TYPE=ss +BUILD_TYPE=ss3 WARNINGS=off DEBUG=off GREP= @@ -101,10 +101,10 @@ while [ "$1" != "" ]; do -p ) STATICFLAG=-p ;; # build safe version - -f | --safe ) BUILD_TYPE=ss + -f | --safe ) BUILD_TYPE=ss3 ;; # build fast version - -o | --opt ) BUILD_TYPE=ss_opt + -o | --opt ) BUILD_TYPE=ss3_opt OPTFLAG=-f ;; esac @@ -124,10 +124,10 @@ if [[ ! -d "$BUILD_DIR" ]]; then mkdir -p $BUILD_DIR fi case $BUILD_TYPE in - ss_opt ) grep "opt" SS_versioninfo_330opt.tpl + ss3_opt ) grep "opt" SS_versioninfo_330opt.tpl cat_opt_files ;; - ss ) grep "safe" SS_versioninfo_330safe.tpl + ss3 ) grep "safe" SS_versioninfo_330safe.tpl cat_safe_files ;; esac diff --git a/SS_objfunc.tpl b/SS_objfunc.tpl index ea70db73..c0f277fe 100644 --- a/SS_objfunc.tpl +++ b/SS_objfunc.tpl @@ -125,7 +125,7 @@ FUNCTION void evaluate_the_objective_function() } // SS_Label_Info_25.1.4 #calc the logL - for (i = 1; i <= Svy_N_fleet(f); i++) + for (i = 1; i <= Svy_N_fleet(f); i++) { if (Svy_use(f, i) > 0) { if (Svy_errtype(f) == 0) { // lognormal @@ -152,7 +152,8 @@ FUNCTION void evaluate_the_objective_function() // values <-2 are trapped in readdata } } - surv_like(f) = sum(Svy_like_I(f)); + } // end loop of obs + surv_like(f) = sum(Svy_like_I(f)); } // end having obs for this survey } if (do_once == 1) diff --git a/SS_write_report.tpl b/SS_write_report.tpl index a1ede57a..4054e822 100644 --- a/SS_write_report.tpl +++ b/SS_write_report.tpl @@ -1385,11 +1385,14 @@ FUNCTION void write_bigoutput() { SS2out << " SmryBio_SX:" << gg << "_GP:" << gp; } + for (gg = 1; gg <= gender; gg++) + { for (gp = 1; gp <= N_GP; gp++) { SS2out << " SmryNum_SX:" << gg << "_GP:" << gp; } + } SS2out << " mature_bio mature_num "; for (f = 1; f <= Nfleet; f++) diff --git a/StockSynthesis.code-workspace b/StockSynthesis.code-workspace index 068856cf..2bfc56e8 100644 --- a/StockSynthesis.code-workspace +++ b/StockSynthesis.code-workspace @@ -9,7 +9,8 @@ "*.tpl": "c", "\"*.extension\":": "\"tpl\"", "*.htp": "c", - "ostream": "c" + "ostream": "c", + "iosfwd": "c" }, "explorer.excludeGitIgnore": true } diff --git a/warnings_ss.txt b/warnings_ss.txt deleted file mode 100644 index 4619e22c..00000000 --- a/warnings_ss.txt +++ /dev/null @@ -1,9 +0,0 @@ -In file included from ss.cpp:7: -In file included from ss.cpp:7: -ss.cpp: In member function ‘void model_parameters::write_bigoutput()’: -ss.cpp:34714:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] -34714 | for (gg = 1; gg <= gender; gg++) - | ^~~ -ss.cpp:34719:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ -34719 | SS2out << " mature_bio mature_num "; - | ^~~~~~