Actual source code: rosenbrock4.c

      1: static char help[] = "This example demonstrates the use of different performance portable backends in user-defined callbacks in Tao.\n";

      3: #include "rosenbrock4.h"

      5: int main(int argc, char **argv)
      6: {
      7:   PetscFunctionBeginUser;
      8:   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
      9:   PetscCall(RosenbrockMain());
     10:   PetscCall(PetscFinalize());
     11:   return 0;
     12: }

     14: /*TEST

     16:   build:
     17:     requires: !complex !__float128 !single !defined(PETSC_USE_64BIT_INDICES)

     19:   test:
     20:     suffix: 1
     21:     nsize: {{1 2 3}}
     22:     args: -tao_monitor_short -tao_type nls -tao_gatol 1.e-4
     23:     output_file: output/rosenbrock1_1.out

     25:   test:
     26:     suffix: 2
     27:     args: -tao_monitor_short -tao_type lmvm -tao_gatol 1.e-3
     28:     output_file: output/rosenbrock1_2.out

     30:   test:
     31:     suffix: 3
     32:     args: -tao_monitor_short -tao_type ntr -tao_gatol 1.e-4
     33:     output_file: output/rosenbrock1_3.out

     35:   test:
     36:     suffix: 4
     37:     args: -tao_monitor_short -tao_type ntr -tao_mf_hessian -tao_ntr_pc_type none -tao_gatol 1.e-4
     38:     output_file: output/rosenbrock1_4.out

     40:   test:
     41:     suffix: 5
     42:     args: -tao_monitor_short -tao_type bntr -tao_gatol 1.e-4
     43:     output_file: output/rosenbrock1_5.out

     45:   test:
     46:     suffix: 6
     47:     args: -tao_monitor_short -tao_type bntl -tao_gatol 1.e-4
     48:     output_file: output/rosenbrock1_6.out

     50:   test:
     51:     suffix: 7
     52:     args: -tao_monitor_short -tao_type bnls -tao_gatol 1.e-4
     53:     output_file: output/rosenbrock1_7.out

     55:   test:
     56:     suffix: 8
     57:     args: -tao_monitor_short -tao_type bntr -tao_bnk_max_cg_its 3 -tao_gatol 1.e-4 -tao_bnk_cg_tao_monitor_short
     58:     output_file: output/rosenbrock1_8.out

     60:   test:
     61:     suffix: 9
     62:     args: -tao_monitor_short -tao_type bntl -tao_bnk_max_cg_its 3 -tao_gatol 1.e-4 -tao_bnk_cg_tao_monitor_short
     63:     output_file: output/rosenbrock1_9.out

     65:   test:
     66:     suffix: 10
     67:     args: -tao_monitor_short -tao_type bnls -tao_bnk_max_cg_its 3 -tao_gatol 1.e-4 -tao_bnk_cg_tao_monitor_short
     68:     output_file: output/rosenbrock1_10.out

     70:   test:
     71:     suffix: 11
     72:     args: -test_lmvm -tao_type bqnktr -tao_max_it 10 -tao_bqnk_mat_type lmvmbroyden
     73:     output_file: output/rosenbrock1_11.out

     75:   test:
     76:     suffix: 12
     77:     args: -test_lmvm -tao_type bqnktr -tao_max_it 10 -tao_bqnk_mat_type lmvmbadbroyden
     78:     output_file: output/rosenbrock1_12.out

     80:   test:
     81:     suffix: 13
     82:     args: -test_lmvm -tao_type bqnktr -tao_max_it 10 -tao_bqnk_mat_type lmvmsymbroyden
     83:     output_file: output/rosenbrock1_13.out

     85:   test:
     86:     suffix: 14
     87:     args: -test_lmvm -tao_type bqnktr -tao_max_it 10 -tao_bqnk_mat_type lmvmbfgs
     88:     output_file: output/rosenbrock1_14.out

     90:   test:
     91:     suffix: 15
     92:     args: -test_lmvm -tao_type bqnktr -tao_max_it 10 -tao_bqnk_mat_type lmvmdfp
     93:     output_file: output/rosenbrock1_15.out

     95:   test:
     96:     suffix: 16
     97:     args: -test_lmvm -tao_type bqnktr -tao_max_it 10 -tao_bqnk_mat_type lmvmsr1
     98:     output_file: output/rosenbrock1_16.out

    100:   test:
    101:     suffix: 17
    102:     args: -tao_monitor_short -tao_gatol 1e-4 -tao_type bqnls
    103:     output_file: output/rosenbrock1_17.out

    105:   test:
    106:     suffix: 18
    107:     args: -tao_monitor_short -tao_gatol 1e-4 -tao_type blmvm
    108:     output_file: output/rosenbrock1_18.out

    110:   test:
    111:     suffix: 19
    112:     args: -tao_monitor_short -tao_gatol 1e-4 -tao_type bqnktr -tao_bqnk_mat_type lmvmsr1
    113:     output_file: output/rosenbrock1_19.out

    115:   test:
    116:     suffix: 20
    117:     args: -tao_monitor -tao_gatol 1e-4 -tao_type blmvm -tao_ls_monitor
    118:     output_file: output/rosenbrock1_20.out

    120:   test:
    121:     suffix: 21
    122:     args: -test_lmvm -tao_type bqnktr -tao_max_it 10 -tao_bqnk_mat_type lmvmsymbadbroyden
    123:     output_file: output/rosenbrock1_21.out

    125:   test:
    126:     suffix: 22
    127:     args: -tao_max_it 1 -tao_converged_reason
    128:     output_file: output/rosenbrock1_22.out

    130:   test:
    131:     suffix: 23
    132:     args: -tao_max_funcs 0 -tao_converged_reason
    133:     output_file: output/rosenbrock1_23.out

    135:   test:
    136:     suffix: 24
    137:     args: -tao_gatol 10 -tao_converged_reason
    138:     output_file: output/rosenbrock1_24.out

    140:   test:
    141:     suffix: 25
    142:     args: -tao_grtol 10 -tao_converged_reason
    143:     output_file: output/rosenbrock1_25.out

    145:   test:
    146:     suffix: 26
    147:     args: -tao_gttol 10 -tao_converged_reason
    148:     output_file: output/rosenbrock1_26.out

    150:   test:
    151:     suffix: 27
    152:     args: -tao_steptol 10 -tao_converged_reason
    153:     output_file: output/rosenbrock1_27.out

    155:   test:
    156:     suffix: 28
    157:     args: -tao_fmin 10 -tao_converged_reason
    158:     output_file: output/rosenbrock1_28.out

    160:   test:
    161:     suffix: test_dbfgs
    162:     nsize: {{1 2 3}}
    163:     output_file: output/rosenbrock1_14.out
    164:     args: -n 10 -tao_type bqnktr -test_lmvm -tao_max_it 10 -tao_bqnk_mat_type lmvmdbfgs -tao_bqnk_mat_lmvm_scale_type none -tao_bqnk_mat_lbfgs_type {{inplace reorder}} -tao_bqnk_mat_lbfgs_recursive {{0 1}}

    166:   test:
    167:     suffix: test_ddfp
    168:     nsize: {{1 2 3}}
    169:     output_file: output/rosenbrock1_14.out
    170:     args: -n 10 -tao_type bqnktr -test_lmvm -tao_max_it 10 -tao_bqnk_mat_type lmvmddfp -tao_bqnk_mat_lmvm_scale_type none -tao_bqnk_mat_ldfp_type {{inplace reorder}} -tao_bqnk_mat_ldfp_recursive {{0 1}}

    172:   test:
    173:     suffix: test_dqn_1
    174:     nsize: 1
    175:     output_file: output/rosenbrock1_29.out
    176:     args: -n 10 -tao_type bqnktr -test_lmvm -tao_max_it 10 -tao_bqnk_mat_type lmvmdqn -tao_bqnk_mat_lmvm_scale_type none -tao_bqnk_mat_lqn_type {{inplace reorder}}

    178:   test:
    179:     suffix: test_dqn_2
    180:     nsize: 2
    181:     output_file: output/rosenbrock1_30.out
    182:     args: -n 10 -tao_type bqnktr -test_lmvm -tao_max_it 10 -tao_bqnk_mat_type lmvmdqn -tao_bqnk_mat_lmvm_scale_type none -tao_bqnk_mat_lqn_type {{inplace reorder}}

    184:   test:
    185:     suffix: test_dqn_3
    186:     nsize: 3
    187:     output_file: output/rosenbrock1_31.out
    188:     args: -n 10 -tao_type bqnktr -test_lmvm -tao_max_it 10 -tao_bqnk_mat_type lmvmdqn -tao_bqnk_mat_lmvm_scale_type none -tao_bqnk_mat_lqn_type {{inplace reorder}}

    190:   test:
    191:     suffix: test_dqn_diag
    192:     output_file: output/rosenbrock1_32.out
    193:     args: -n 10 -tao_type bqnktr -test_lmvm -tao_max_it 10 -tao_bqnk_mat_type lmvmdqn -tao_bqnk_mat_lmvm_scale_type diagonal -tao_bqnk_mat_lqn_type {{inplace reorder}}

    195:   # test with a large update rejection tolerance to test that portion of code
    196:   test:
    197:     suffix: bfgs_rejects
    198:     output_file: output/rosenbrock4_bfgs_rejects.out
    199:     args: -tao_monitor_short -tao_gatol 1e-4 -tao_type blmvm -tao_view -n 10 -bs 10 -alpha 8.0 -tao_blmvm_mat_lmvm_eps 1.2 -tao_blmvm_mat_type lmvmbfgs -tao_blmvm_mat_lmvm_scale_type scalar -tao_blmvm_mat_lmvm_mult_algorithm {{recursive dense}}

    201:   test:
    202:     suffix: dbfgs_rejects
    203:     output_file: output/rosenbrock4_dbfgs_rejects.out
    204:     args: -tao_monitor_short -tao_gatol 1e-4 -tao_type blmvm -tao_view -n 10 -bs 10 -alpha 8.0 -tao_blmvm_mat_lmvm_eps 0.01 -tao_blmvm_mat_type lmvmdbfgs -tao_blmvm_mat_lmvm_scale_type scalar

    206: TEST*/