<div dir="ltr"><div><div><div>Right, but the cost function is the same value each time, the norm of x is 0 each time, and the norm of g is the same each time.  This suggests nothing is happening.  It's a bit ridiculous that one of the core tutorials simply isn't working out of the box...<br></div><br></div>I will have a go at debugging.<br><br></div>Andrew<br><div class="gmail_extra"><br><div class="gmail_quote">On 30 April 2018 at 22:54, Matthew Mazloff <span dir="ltr"><<a href="mailto:mmazloff@ucsd.edu" target="_blank">mmazloff@ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;line-break:after-white-space">
Well you are correct that its not actually taking a step because the dot product of the control is 0:
<div>
<blockquote type="cite">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space">
<div>
<div class="m_-4786631353620127977m_3710995647012400324h5">
<div>
<div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div>
<div>norm of x................... 0.00000000E+00</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
meaning the controls are all 0 still.</div>
<div><br>
</div>
<div>However the gradients are non-zero</div>
<div>
<blockquote type="cite">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space">
<div>
<div class="m_-4786631353620127977m_3710995647012400324h5">
<div>
<div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div>
<div>norm of g................... 0.12730927E-01</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
so the linesearch should step and </div>
<div>ecco_ctrl_MIT_CE_000.opt0001 </div>
<div>should not be all zero. </div>
<div><br>
</div>
<div>To debug this you could put a print statement in optim_writedata.F to see what it is writing…..</div>
<div><br>
</div>
<div>I don’t know enough about this tutorial to be a bigger help, sorry</div>
<div><br>
</div>
<div>Matt</div><div><div class="m_-4786631353620127977h5">
<div><br>
<div><br>
<blockquote type="cite">
<div>On Apr 30, 2018, at 2:50 PM, Andrew McRae <<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank">andrew.mcrae@physics.ox.ac.uk</a><wbr>> wrote:</div>
<br class="m_-4786631353620127977m_3710995647012400324Apple-interchange-newline">
<div>
<div dir="ltr">Yes, I did.<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 30 April 2018 at 22:42, Matthew Mazloff <span dir="ltr">
<<a href="mailto:mmazloff@ucsd.edu" target="_blank">mmazloff@ucsd.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space">This is still iteration 0. You have to update data.optim to tell it you are now at iteration 1
<div><br>
</div>
<div>Matt</div>
<div>
<div class="m_-4786631353620127977m_3710995647012400324h5">
<div><br>
<div><br>
<blockquote type="cite">
<div>On Apr 30, 2018, at 2:38 PM, Andrew McRae <<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank">andrew.mcrae@physics.ox.ac.uk</a><wbr>> wrote:</div>
<br class="m_-4786631353620127977m_3710995647012400324m_5573198295039926652Apple-interchange-newline">
<div>
<div dir="ltr">
<div>
<div>I tried a few steps of this, but the output of optim.x always has<br>
<br>
  cost function............... 0.62002323E+01<br>
  norm of x................... 0.00000000E+00<br>
  norm of g................... 0.12730927E-01<br>
<br>
</div>
near the end, with no decrease in the cost function.  So I guess it's not actually taking the step?<br>
<br>
</div>
Andrew</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 27 April 2018 at 18:04, Andrew McRae <span dir="ltr">
<<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank">andrew.mcrae@physics.ox.ac.uk</a><wbr>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>
<div>!!!  Okay...<br>
<br>
</div>
Yes, it produced the .opt0001 file.  I'll see how this goes.<br>
<br>
</div>
Thanks,<br>
Andrew<br>
</div>
<div class="m_-4786631353620127977m_3710995647012400324m_5573198295039926652HOEnZb">
<div class="m_-4786631353620127977m_3710995647012400324m_5573198295039926652h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On 27 April 2018 at 17:57, Matthew Mazloff <span dir="ltr">
<<a href="mailto:mmazloff@ucsd.edu" target="_blank">mmazloff@ucsd.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space">Hello
<div><br>
</div>
<div>Its been awhile, but I am pretty sure that is the normal output. It says “fail", but it did give you a new and ecco_ctrl_MIT_CE_000.opt0001 (correct?) and if you unpack and run likely the cost will descend.</div>
<div><br>
</div>
<div>I think it worked correctly. lsopt/optim are just confusing…but I think its working. I think all is good!</div>
<div><br>
</div>
<div>Matt</div>
<div><br>
</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>
<div class="m_-4786631353620127977m_3710995647012400324m_5573198295039926652m_-7216922944695548211h5">
<div>On Apr 27, 2018, at 8:25 AM, Andrew McRae <<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank">andrew.mcrae@physics.ox.ac.uk</a><wbr>> wrote:</div>
<br class="m_-4786631353620127977m_3710995647012400324m_5573198295039926652m_-7216922944695548211m_769995241832615540Apple-interchange-newline">
</div>
</div>
<div>
<div>
<div class="m_-4786631353620127977m_3710995647012400324m_5573198295039926652m_-7216922944695548211h5">
<div dir="ltr">
<div>
<div>
<div>Just separating this from the <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2018-April/011521.html" target="_blank">
other thread</a>, I got the bundled MITgcm optim routine built (having made <a href="https://github.com/MITgcm/MITgcm/compare/master...dorugeber:optim_fix" target="_blank">
these changes</a>, based on <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2010-September/006825.html" target="_blank">
this</a> thread from 2010 and <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2016-July/010527.html" target="_blank">
this</a> one from 2016).<br>
<br>
</div>
I use OpenAD to create the adjoint.<br>
<br>
</div>
My steps are:<br>
</div>
<div>1) in the build directory, run ../../../tools/genmake2 -oad -mods=../code_oad<br>
</div>
<div>2) run make depend and make adAll<br>
3) copy input_oad/ into a new folder scratch/<br>
</div>
<div>4) within scratch/, run ./prepare_run<br>
</div>
<div>5) copy mitgcmuv_ad from build/ into scratch/, copy optim.x into scratch/OPTIM/<br>
</div>
<div>6) run ./mitgcmuv_ad<br>
</div>
<div>7) in scratch/OPTIM, create symlinks to ../data.optim and ../data.ctrl<br>
</div>
<div>8) copy the files ecco_cost_MIT_CE_000.opt0000 and ecco_ctrl_MIT_CE_000.opt0000 into the OPTIM subdirectory<br>
</div>
<div>9) run ./optim.x within the subdirectory<br>
<br>
</div>
<div>The full output is attached, but I assume the optimisation failed since the last lines are<br>
</div>
<div>
<div>
<div><br>
  optimization stopped because :<br>
  ifail =   4    the search direction is not a descent one<br>
<br>
</div>
<div>Any ideas?  (I guess this isn't something that is tested in the daily builds?)<br>
<br>
</div>
<div>In the meantime, I'll try the m1qn3 routine as in the other thread, which should help distinguish between a problem with the optimisation routine or the gradient generated by mitgcmuv_ad.<br>
<br>
</div>
<div>Andrew<br>
</div>
</div>
</div>
</div>
</div>
</div>
<span id="m_-4786631353620127977m_3710995647012400324m_5573198295039926652m_-7216922944695548211m_769995241832615540cid:9D33FD64-1548-462F-99BA-72879C96702C@ucsd.edu"><out.txt></span>_____________________<wbr>__________________________<br>
MITgcm-support mailing list<br>
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" target="_blank">http://mailman.mitgcm.org/mail<wbr>man/listinfo/mitgcm-support</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
______________________________<wbr>_________________<br>
MITgcm-support mailing list<br>
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" target="_blank">http://mailman.mitgcm.org/mail<wbr>man/listinfo/mitgcm-support</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
______________________________<wbr>_________________<br>
MITgcm-support mailing list<br>
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" target="_blank">http://mailman.mitgcm.org/mail<wbr>man/listinfo/mitgcm-support</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div></div></div>

</blockquote></div><br></div></div>