admb-project / admb

AD Model Builder
http://admb-project.org
Other
64 stars 19 forks source link

The admb executable called with a path should be stripped. #165

Closed johnoel closed 3 years ago

johnoel commented 3 years ago

Currently, if the executable is called with the path, the inputs will be read from the executable path and the outputs would be written to the executable path.

For example,

~/run$ ~/bin/model.exe

model.exe would try to read input files from ~/bin, then write outputs to ~/bin instead of ~/run directory. The executable should read and write to the ~/run directory.

@jimianelli requested this feature.

johnoel commented 3 years ago

Hi @jimianelli and @Cole-Monnahan-NOAA, please test the issue165 branch. It should be able to read and write to a directory that is different from where the executable is.

Cole-Monnahan-NOAA commented 3 years ago

I built this branch, compiled simple then tried this:

C:\Users\cole.monnahan\admb\examples\admb>simple\simple.exe Error trying to read in model data This is usual caused by a missing DAT file

Is that what you wanted me to test?

johnoel commented 3 years ago

Move simple.exe to another directory (ie C:\Users\cole.monnahan\bin\simple.exe).

Then call simple.exe with it's full path,

C:\Users\cole.monnahan\admb\examples\admb\simple> C:\Users\cole.monnahan\bin\simple.exe

Check that program was able to read input files and write the outputs in the simple directory.

Cole-Monnahan-NOAA commented 3 years ago

Still fails. I should note this in Win10.

C:\Users\cole.monnahan\admb\examples\admb\simple>C:\Users\cole.monnahan\test\simple\simple.exe -version ADMB Program: C:\Users\cole.monnahan\test\simple\simple.exe

ADMB-12.2-git safe libraries compiled with GNU C++ 8.3.0 (64bit) Copyright (c) 2008-2020 ADMB Foundation and Regents of the University of California Build date: Jan 12 2021

C:\Users\cole.monnahan\admb\examples\admb>C:\Users\cole.monnahan\test\simple\simple.exe Error trying to read in model data This is usual caused by a missing DAT file

C:\Users\cole.monnahan\admb\examples\admb>ls C:\Users\cole.monnahan\test\simple\ simple.dat simple.exe simple.tpl

Cole-Monnahan-NOAA commented 3 years ago

I misunderstood your original request. The idea is you have one master .exe file and multiple directories with e.g., different inputs and you want the inputs/outputs to always be in the directory. Yes this works:

C:\Users\cole.monnahan\admb\examples\admb\simple>C:\Users\cole.monnahan\test\simple\simple.exe

Initial statistics: 2 variables; iteration 0; function evaluation 0; phase 1 Function value 2.4980653e+01; maximum gradient component mag -3.6127e+00 Var Value Gradient |Var Value Gradient |Var Value Gradient 1 0.00000 -7.2781e-01 | 2 0.00000 -3.6127e+00 |