nmfs-ost / ss3-source-code

The source code for Stock Synthesis (SS3).
https://nmfs-ost.github.io/ss3-website/
Creative Commons Zero v1.0 Universal
36 stars 16 forks source link

Add docker target to build file. #520

Closed johnoel closed 10 months ago

johnoel commented 11 months ago

Add docker to build file.

e-perl-NOAA commented 10 months ago

@johnoel, the commit I added was just a change to trigger the workflows to build ss3 with the changes to the makefile, will drop the commit after the check has passed.

johnoel commented 10 months ago

should be

pr_body <- strsplit(info$body, split = "\n" )[[1]]

e-perl-NOAA commented 10 months ago

It's just that there was nothing in the body of the PR to pull from with info$body. I put something in the body and it started working.

e-perl-NOAA commented 10 months ago

I'm still not getting an opt version from this sadly. The linux workflow in github actions uses this .sh file to create the executable. I don't know if there is a clue in that file that could help get the GNUMakefile to work. Maybe something similar to the lines 119-125 need to be added to the GNUMakefile?

johnoel commented 10 months ago

My bad, the target used the wrong filename. It has been corrected.

To make it easier

make docker

will build both the optimized and safe version of ss.

Or, you can build separately.

Make the safe ss version

make docker_ss

Make the optimized ss version

make docker_ss_opt
johnoel commented 10 months ago

Okay, added docker command to Make_SS_330_new.sh. To build with docker use the command below

stock-synthesis % ./Make_SS_330_new.sh --admb docker -w

ADMB_HOME is where docker is...

Notice the -w option. The script will now build just once with the compiler warnings. The second unneeded call to compile source code was removed.

e-perl-NOAA commented 10 months ago

Okay so this IS running on codespaces which is amazing, but I'm having trouble getting it to run github actions, see test action here. @johnoel do you have any ideas or changes that I need to make to get it running?

e-perl-NOAA commented 10 months ago

The main error is this: /usr/local/bin/admb: line 361: admb.log: Permission denied Error: could not parse "ss.tpl".

cat: admb.log: No such file or directory make: *** [GNUmakefile:26: docker_ss] Error 1 Error: Process completed with exit code 2.

johnoel commented 10 months ago

Try again, just pushed a new docker image.

e-perl-NOAA commented 10 months ago

Sadly, this is the error message that I am getting now: Status: Downloaded newer image for johnoel/admb:linux *** Parse: ss.tpl tpl2cpp ss || tpl2rem ss

Error trying to open file xxhtop.tmp Error trying to open file xxglobal.tmp /usr/local/bin/admb: line 361: 27 Segmentation fault (core dumped) tpl2cpp ss Error trying to open file xxhtop.tmp Error trying to open file xxglobal.tmp /usr/local/bin/admb: line 361: 28 Segmentation fault (core dumped) tpl2rem ss Error: could not parse "ss.tpl".

cat: admb.log: No such file or directory make: *** [GNUmakefile:26: docker_ss] Error 1 Error: Process completed with exit code 2.

johnoel commented 10 months ago

Strange, the mounted directory is read-only. I will investigate a bit more...

e-perl-NOAA commented 10 months ago

Okay, thanks for helping me with this. FYI, I will also eventually be trying to add the admb docker image to the workflow for linux and macOS, so will I likely have some more questions on that after we get this worked out.

Rick-Methot-NOAA commented 10 months ago

Thanks to both of you for working on this. I can't help but will certainly appreciate the result when you are done.

e-perl-NOAA commented 10 months ago

I added "chmod -R 777 ." to the run line and the action that I am testing on is now successful - see here

e-perl-NOAA commented 10 months ago

Will try windows and macOS next

e-perl-NOAA commented 10 months ago

Okay so I got it working on windows (so it seems) but now I'm running into issues with running the image on macos. The workflow that I am running is here and the failed action is here. The macos workflow to build ss3 uses the .Make_SS_330_new file.

johnoel commented 10 months ago

Shoots, I lost my changes...

e-perl-NOAA commented 10 months ago

@johnoel have you had any more time to investigate this?

johnoel commented 10 months ago

Okay, there are some updates to the docker images that was uploaded. Also, updated github action test build files. The only case that could not be tested is building with the linux docker version on windows. Since the windows docker version works on windows, it should be enough. Also, I tried to find a workaround to needing to do chmod 777. None of the workaround options were very easy to do. It should be ready to go with the current changes. Please test and let me know if you find other issues.