[MITgcm-support] lsopt / optim routines

Andrew McRae andrew.mcrae at physics.ox.ac.uk
Tue Apr 24 05:22:41 EDT 2018


What changes do I need to make to get this working with, e.g.,
tutorial_global_oce_optim?

I have added

 &M1QN3
 &end

to data.optim, and have updated the cycsh script as the filenames there
seem outdated:

11c10
<  cp -p OPTIM/ctrlhflux_tut_MITgcm.opt0$ii .
---
>  cp -p OPTIM/ecco_ctrl_MIT_CE_000.opt0$ii .
27,28c26,27
<  mv ctrlhflux_tut_MITgcm.opt0$ii $fich $direc
<  mv costhflux_tut_MITgcm.opt0$ii OPTIM/
---
>  mv ecco_ctrl_MIT_CE_000.opt0$ii $fich $direc
>  mv ecco_cost_MIT_CE_000.opt0$ii OPTIM/

but, following the instructions from 3.18.5 of the .pdf manual, the
optimisation seems to fail from the second iteration onwards:

Beginning of iteration 001
Running mitcgm_ad: iteration 001
STOP NORMAL END
Cleaning
rm: No match.
mkdir: cannot create directory ‘runtutorial001’: File exists
Line-search: iteration 001
 optimcycle=1,
Beginning of iteration 002
Running mitcgm_ad: iteration 002
STOP NORMAL END
Cleaning
rm: No match.
mkdir: cannot create directory ‘runtutorial002’: File exists
Line-search: iteration 002
 optimcycle=2,
STOP ABNORMAL in S/R OPTIM_SUB
Beginning of iteration 003
Running mitcgm_ad: iteration 003
[Ctrl+C]

The file m1qn3_output.txt is attached.  I'm suspicious that lines 28-29 and
49-50 are the same; it looks like the step was never taken?

Thanks,
Andrew

On 16 April 2018 at 11:24, Andrew McRae <andrew.mcrae at physics.ox.ac.uk>
wrote:

> Thanks, this seems to work (at least, build, and the testbed files run).
>
> Hopefully this 5-year old code replaces the 10-year old code in master at
> some point!
>
> Andrew
>
> On 20 March 2018 at 19:37, Matthew Mazloff <mmazloff at ucsd.edu> wrote:
>
>> Hello
>>
>> Lately I have been using:
>> http://wwwcvs.mitgcm.org/viewvc/MITgcm/MITgcm_contrib/mlosch
>> /optim_m1qn3/?pathrev=HEAD
>>
>> This is an alternative search algorithm code that I find easier to use
>> (Thanks again Martin!). You may want to give it a try
>>
>> -Matt
>>
>>
>> On Mar 20, 2018, at 11:46 AM, Andrew McRae <andrew.mcrae at physics.ox.ac.uk>
>> wrote:
>>
>> Are these run as part of the daily builds?  I can't get it to build.
>>
>> Following part 3.18.4.2 of the .pdf manual (I don't think this section
>> has been ported online yet)...
>>
>> In lsopt/, the supplied blas libraries are 10+ years old and my compiler
>> says the Pentium 4 blas1 library is incompatible.
>>
>> In optim/, "make depend" doesn't work (makedepend undefined).
>>
>> "make" obviously causes the compiler to complain about -lblas1 not
>> existing.
>>
>> After changing the makefile to use -lblas instead of -lblas1, "make"
>> gives the output
>>
>> f77 -o optim.x  optim_main.o optim_sub.o optim_numbmod.o optim_initmod.o
>> optim_readdata.o optim_writedata.o optim_write_control.o xerbla.o simul.o
>> -L. -L../lsopt/ -llsopt_ecco -lblas
>> /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crt1.o: In
>> function `_start':
>> (.text+0x20): undefined reference to `main'
>> optim_numbmod.o: In function `optim_numbmod_':
>> optim_numbmod.f:(.text+0x1ff1): undefined reference to `ilnblnk_'
>> optim_numbmod.f:(.text+0x2478): undefined reference to `ilnblnk_'
>> collect2: error: ld returned 1 exit status
>> Makefile:78: recipe for target 'optim.x' failed
>> make: *** [optim.x] Error 1
>>
>> And this just looks like broken code rather than anything BLAS-related.
>> An undefined reference to main, and two undefined references to ilnblnk.
>>
>> ilnblnk is defined with
>> c     == external ==
>>       integer  ilnblnk
>>
>> Then used twice as
>> il = max(ilnblnk(record),1)
>>
>> Any ideas?
>> _______________________________________________
>> MITgcm-support mailing list
>> MITgcm-support at mitgcm.org
>> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20180424/396fdbc0/attachment.html>
-------------- next part --------------
 -------------------------------------------------------------------------------
 M1QN3 Copyright (C) 2008, J. Ch. Gilbert, Cl. Lemarechal.
 -------------------------------------------------------------------------------
 This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you
 are welcome to redistribute it under certain conditions. See the file COPYING 
 in the root directory of the M1QN3 distribution for details.
 -------------------------------------------------------------------------------

 M1QN3 (Version 3.3, October 2009): entry point
     dimension of the problem (n):          2315
     absolute precision on x (dxmin):          1.00D-06
     expected decrease for f (df1):            4.60D-01
     relative precision on g (epsg):           1.00D-06 (two-norm)
     maximal number of iterations (niter):     1
     maximal number of simulations (nsim):     3
     printing level (impres):                 10
     reverse communication

 m1qn3: Diagonal Initial Scaling mode

     allocated memory (ndz) :    62513
     used memory :               60201
     number of updates :            11
     (y,s) pairs are stored in core memory

 m1qn3: cold start

     f             =  6.20023228D+00
     two-norm of g =  1.27309267D-02

 m1qn3a: descent direction -g: precon =  0.568D+04

 -------------------------------------------------------------------------------

 m1qn3: iter 1, simul 1, f= 6.20023228D+00, h'(0)=-9.20465D-01

 m1qn3: line search

     mlis3       fpn=-9.205D-01 d2= 5.23D+03  tmin= 1.44D-07 tmax= 1.00D+20
     mlis3                                      1.000D+00  0.000D+00 -9.205D-01
     mlis3                                      2.113D-01  0.000D+00 -9.205D-01

 -------------------------------------------------------------------------------

 m1qn3: output mode is  5
     number of iterations:              1
     number of simulations:             4
     realized relative precision on g:  1.00D+00
     f             =  6.20023228D+00
     two-norm of g =  1.27309267D-02


More information about the MITgcm-support mailing list