diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt index 80316cd899..71d8b8403a 100644 --- a/.github/actions/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -2067,3 +2067,8 @@ libclang dumpbin objdump rfun +calcb +callbck +CCALLBACK +evalcallback +fcb diff --git a/.github/workflows/lint_hosted.yml b/.github/workflows/lint_hosted.yml deleted file mode 100644 index cc87643f1a..0000000000 --- a/.github/workflows/lint_hosted.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Lint the Fortran code and the MEX gateways on GitHub hosted runners - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 17 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Lint the Fortran code - runs-on: ubuntu-latest - continue-on-error: true - strategy: - fail-fast: false - matrix: - linter: [flint, mlint] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - - steps: - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Set up MATLAB - id: set-up-matlab - if: ${{ matrix.linter == 'mlint' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: latest - - - name: Get fintrf.h and remove MATLAB - if: ${{ matrix.linter == 'mlint' }} - run: | - MATLABROOT=${{steps.set-up-matlab.outputs.matlabroot}} - # fintrf.h must be located under a directory "extern/include/", or mlint cannot find it. - mkdir -p ~/extern/include/ - cp "$MATLABROOT"/extern/include/fintrf.h ~/extern/include/ || exit 2 - sudo chmod 777 ~/extern/include/fintrf.h || exit 3 - # Remove MATLAB, or the runner will run out of space. - sudo rm -rf "$MATLABROOT"/* || exit 4 - # mlint uses `locate` to find fintrf.h - sudo apt update && sudo apt install mlocate -y && sudo updatedb - locate '/extern/include/fintrf.h' || exit 5 - - - name: Install AOCC - run: bash .github/scripts/install_aocc - - - name: Install gfortran - uses: awvwgk/setup-fortran@main - id: setup-fortran - with: - compiler: gcc - version: ${{ env.GFORTRAN_VERSION }} - - - name: Install Intel oneAPI - run: bash .github/scripts/install_oneapi_linux.sh - - - name: Install g95 - run: bash .github/scripts/install_g95 - - - name: Install nvfortran - run: bash .github/scripts/install_nvfortran - - - name: Install Oracle sunf95 - run: bash .github/scripts/install_sunf95 - - # Install Flang after AOCC, to make sure that flang is this one, while AOCC flang will be - # known as aflang. - - name: Install Flang - run: bash .github/scripts/install_flang - - - name: Conduct the test - run: | - type gfortran ifort ifx aflang g95 nvfortran sunf95 flang - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./${{ matrix.linter }} --all - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/lint_nagfor.yml b/.github/workflows/lint_nagfor.yml deleted file mode 100644 index 1e05eb107a..0000000000 --- a/.github/workflows/lint_nagfor.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Lint the Fortran code and the MEX gateways with nagfor - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 17 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Lint the Fortran code and the MEX gateways with nagfor - runs-on: [self-hosted, nagfor] - continue-on-error: true - strategy: - fail-fast: false - matrix: - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - source ~/.bashrc - export PATH=$PATH:"~/local/bin" - source ~/local/bin/nag_licensing || (echo "\n\nNAG licensing failed.\n\n" && exit 2) - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} - if [[ $(($(date +%-d) % 2)) == 0 ]] ; then - bash ./flint -n --all - else - bash ./mlint -n --all - fi - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/profile_all.yml b/.github/workflows/profile_all.yml deleted file mode 100644 index 5c698a6b16..0000000000 --- a/.github/workflows/profile_all.yml +++ /dev/null @@ -1,191 +0,0 @@ -name: Plot performance profiles for all - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [all] - solver: [cobylal, cobylan, uobyqa, newuoa, bobyqa, lincoa] # prima is too expensive - competitor: [classical, archiva] - with_optim_toolbox: [yes, no] - ctol_indicator: [0, 1, 2] - exclude: - - solver: cobylan - with_optim_toolbox: yes - - solver: uobyqa - with_optim_toolbox: yes - - solver: newuoa - with_optim_toolbox: yes - - solver: bobyqa - with_optim_toolbox: yes - - solver: uobyqa - ctol_indicator: 1 - - solver: uobyqa - ctol_indicator: 2 - - solver: newuoa - ctol_indicator: 1 - - solver: newuoa - ctol_indicator: 2 - - solver: bobyqa - ctol_indicator: 1 - - solver: bobyqa - ctol_indicator: 2 - - steps: - - name: Get the solver name - run: echo "SOLNAME=$(echo ${{ matrix.solver }} | cut -c1-6)" >> $GITHUB_ENV - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-${{ matrix.with_optim_toolbox }} - - - name: Set up MATLAB with optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox == 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Set up MATLAB without optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox != 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.nr = 4; % 4 random runs for each problem - options.ctol_multiple = 10^(2*str2num('${{ matrix.ctol_indicator }}')); - - if strcmp('${{ matrix.solver }}', 'cobylal') - %options.nr = 3; - prof('cobyla', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'cobylan') - %options.nr = 3; - prof('cobyla', '${{ matrix.dim }}', 'n', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'lincoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'bobyqa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'b', '${{ matrix.competitor }}', options); - else - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}', options); - end - - - % Move the files to prepare for uploading artifacts - - solver = '${{ env.SOLNAME }}'; - cd(fullfile(cd(), 'testdata')); - files = dir([solver, '*.summary.*.pdf']) - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - movefile(fullfile(cd(), '*summary*.pdf'), ['/tmp/', solver, '_profile_prima/']); - movefile(fullfile(cd(), '*.txt'), ['/tmp/', solver, '_profile_prima/']); - - files = [dir(['/tmp/', solver, '_profile_prima/*start*']); dir(['/tmp/', solver, '_profile_prima/*end*'])] - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ env.SOLNAME }}_profile_prima/*summary*.pdf - /tmp/${{ env.SOLNAME }}_profile_prima/*.txt - /tmp/${{ env.SOLNAME }}_profile_prima/*start* - /tmp/${{ env.SOLNAME }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ env.SOLNAME }}_profile_prima diff --git a/.github/workflows/profile_bobyqa_small.yml b/.github/workflows/profile_bobyqa_small.yml deleted file mode 100644 index f54f188d45..0000000000 --- a/.github/workflows/profile_bobyqa_small.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Plot performance profiles for BOBYQA, small - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - # schedule: - # - cron: '0 2,6,10,14,18,22 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [bobyqa] - competitor: [classical, archiva] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.nr = 3; - - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}', options); - - - % Move the files to prepare for uploading artifacts - - movefile(fullfile(cd(), 'testdata', '*summary*.pdf'), '/tmp/${{ matrix.solver }}_profile_prima/'); - movefile(fullfile(cd(), 'testdata', '*.txt'), '/tmp/${{ matrix.solver }}_profile_prima/'); - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_profile_prima/*summary*.pdf - /tmp/${{ matrix.solver }}_profile_prima/*.txt - /tmp/${{ matrix.solver }}_profile_prima/*start* - /tmp/${{ matrix.solver }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ matrix.solver }}_profile_prima diff --git a/.github/workflows/profile_cobyla_small.yml b/.github/workflows/profile_cobyla_small.yml deleted file mode 100644 index 4e92d38584..0000000000 --- a/.github/workflows/profile_cobyla_small.yml +++ /dev/null @@ -1,149 +0,0 @@ -name: Plot performance profiles for COBYLA, small - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - # schedule: - # - cron: '0 2,6,10,14,18,22 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [cobylal, cobylan] - competitor: [classical, archiva] - with_optim_toolbox: [yes, no] - ctol_indicator: [0, 1, 2] - exclude: - - solver: cobylan - with_optim_toolbox: yes - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-${{ matrix.with_optim_toolbox }} - - - name: Set up MATLAB with optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox == 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Set up MATLAB without optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox != 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.nr = 3; - options.ctol_multiple = 10^(2*str2num('${{ matrix.ctol_indicator }}')); - - if strcmp('${{ matrix.solver }}', 'cobylal') - prof('cobyla', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'cobylan') - prof('cobyla', '${{ matrix.dim }}', 'n', '${{ matrix.competitor }}', options); - end - - - % Move the files to prepare for uploading artifacts - - solver = 'cobyla'; - cd(fullfile(cd(), 'testdata')); - files = dir([solver, '*.summary.*.pdf']) - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - movefile(fullfile(cd(), '*summary*.pdf'), '/tmp/cobyla_profile_prima/'); - movefile(fullfile(cd(), '*.txt'), '/tmp/cobyla_profile_prima/'); - - files = [dir(['/tmp/', solver, '_profile_prima/*start*']); dir(['/tmp/', solver, '_profile_prima/*end*'])] - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/cobyla_profile_prima/*summary*.pdf - /tmp/cobyla_profile_prima/*.txt - /tmp/cobyla_profile_prima/*start* - /tmp/cobyla_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/cobyla_profile_prima diff --git a/.github/workflows/profile_compiler_options.yml b/.github/workflows/profile_compiler_options.yml deleted file mode 100644 index 240de4bed2..0000000000 --- a/.github/workflows/profile_compiler_options.yml +++ /dev/null @@ -1,204 +0,0 @@ -name: Plot performance profiles, various compiler options - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 4 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [all] - solver: [cobylal, cobylan, uobyqa, newuoa, bobyqa, lincoa] # prima is too expensive - compiler_options: [-O0, -O1, -O2, -O3, -Ofast -fno-stack-arrays, -ffast-math] - competitor: [classical] - with_optim_toolbox: [yes, no] - exclude: - - solver: cobylan - with_optim_toolbox: yes - - solver: uobyqa - with_optim_toolbox: yes - - solver: newuoa - with_optim_toolbox: yes - - solver: bobyqa - with_optim_toolbox: yes - - steps: - - - name: Get the solver name - run: echo "SOLNAME=$(echo ${{ matrix.solver }} | cut -c1-6)" >> $GITHUB_ENV - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-${{ matrix.with_optim_toolbox }} - - - name: Set up MATLAB with optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox == 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Set up MATLAB without optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox != 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Revise setup_compiler_options to print the revised mexopt file - run: | - cd matlab/tests/private || exit 1 - sed -i "s|return|for ifile = 1 : length(config_files), ifile, cfile = fullfile(config_dir, config_files{ifile}) , system(['cat ', cfile]); end|" set_compiler_options.m - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.compiler_options = '${{ matrix.compiler_options }}'; - options.debug = ~contains('${{ matrix.compiler_options }}', 'fast') - options.nr = 4; % 4 random runs for each problem - - if strcmp('${{ matrix.solver }}', 'cobylal') - options.nr = 3; - prof('cobyla', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'cobylan') - options.nr = 3; - prof('cobyla', '${{ matrix.dim }}', 'n', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'lincoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'bobyqa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'b', '${{ matrix.competitor }}', options); - else - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}', options); - end - - - % Move the files to prepare for uploading artifacts - - solver = '${{ env.SOLNAME }}' - cd(fullfile(cd(), 'testdata')); - files = dir([solver, '*.summary.*.pdf']) - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['${{ matrix.with_optim_toolbox }}', '_', files(ifile).name]) - movefile(file, newfile); - end - movefile(fullfile(cd(), '*summary*.pdf'), ['/tmp/', solver, '_profile_prima/']); - movefile(fullfile(cd(), '*.txt'), ['/tmp/', solver, '_profile_prima/']); - - files = [dir(['/tmp/', solver, '_profile_prima/*start*']); dir(['/tmp/', solver, '_profile_prima/*end*'])] - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['${{ matrix.with_optim_toolbox }}', '_', files(ifile).name]) - movefile(file, newfile); - end - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ env.SOLNAME }}_profile_prima/*summary*.pdf - /tmp/${{ env.SOLNAME }}_profile_prima/*.txt - /tmp/${{ env.SOLNAME }}_profile_prima/*start* - /tmp/${{ env.SOLNAME }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ env.SOLNAME }}_profile_prima - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/profile_lincoa_small.yml b/.github/workflows/profile_lincoa_small.yml deleted file mode 100644 index 65cde7a7aa..0000000000 --- a/.github/workflows/profile_lincoa_small.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Plot performance profiles for LINCOA, small - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - # schedule: - # - cron: '0 2,6,10,14,18,22 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [lincoa] - competitor: [classical, archiva] - with_optim_toolbox: [yes, no] - ctol_indicator: [0, 1, 2] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-${{ matrix.with_optim_toolbox }} - - - name: Set up MATLAB with optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox == 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Set up MATLAB without optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox != 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.nr = 3; - options.ctol_multiple = 10^(2*str2num('${{ matrix.ctol_indicator }}')); - - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}', options); - - - % Move the files to prepare for uploading artifacts - - solver = 'lincoa'; - cd(fullfile(cd(), 'testdata')); - files = dir([solver, '*.summary.*.pdf']) - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - movefile(fullfile(cd(), '*summary*.pdf'), '/tmp/${{ matrix.solver }}_profile_prima/'); - movefile(fullfile(cd(), '*.txt'), '/tmp/${{ matrix.solver }}_profile_prima/'); - - files = [dir(['/tmp/', solver, '_profile_prima/*start*']); dir(['/tmp/', solver, '_profile_prima/*end*'])] - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_profile_prima/*summary*.pdf - /tmp/${{ matrix.solver }}_profile_prima/*.txt - /tmp/${{ matrix.solver }}_profile_prima/*start* - /tmp/${{ matrix.solver }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ matrix.solver }}_profile_prima diff --git a/.github/workflows/profile_newuoa_small.yml b/.github/workflows/profile_newuoa_small.yml deleted file mode 100644 index 774d1d7383..0000000000 --- a/.github/workflows/profile_newuoa_small.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: Plot performance profiles for NEWUOA, small - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - # schedule: - # - cron: '0 2,6,10,14,18,22 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [newuoa] - competitor: [classical, archiva] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}'); - - - % Move the files to prepare for uploading artifacts - - movefile(fullfile(cd(), 'testdata', '*summary*.pdf'), '/tmp/${{ matrix.solver }}_profile_prima/'); - movefile(fullfile(cd(), 'testdata', '*.txt'), '/tmp/${{ matrix.solver }}_profile_prima/'); - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_profile_prima/*summary*.pdf - /tmp/${{ matrix.solver }}_profile_prima/*.txt - /tmp/${{ matrix.solver }}_profile_prima/*start* - /tmp/${{ matrix.solver }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ matrix.solver }}_profile_prima diff --git a/.github/workflows/profile_prima_small.yml b/.github/workflows/profile_prima_small.yml deleted file mode 100644 index 2d96827ee3..0000000000 --- a/.github/workflows/profile_prima_small.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Plot performance profiles for PRIMA, small - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - # schedule: - # - cron: '0 2,6,10,14,18,22 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [prima] - competitor: [classical] - with_optim_toolbox: [yes, no] - ctol_indicator: [0, 1, 2] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-${{ matrix.with_optim_toolbox }} - - - name: Set up MATLAB with optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox == 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Set up MATLAB without optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' && matrix.with_optim_toolbox != 'yes' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.nr = 3; - options.ctol_multiple = 10^(2*str2num('${{ matrix.ctol_indicator }}')); - - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}', options); - - - % Move the files to prepare for uploading artifacts - - solver = '${{ matrix.solver }}'; - cd(fullfile(cd(), 'testdata')); - files = dir([solver, '*.summary.*.pdf']) - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - movefile(fullfile(cd(), '*summary*.pdf'), '/tmp/${{ matrix.solver }}_profile_prima/'); - movefile(fullfile(cd(), '*.txt'), '/tmp/${{ matrix.solver }}_profile_prima/'); - - files = [dir(['/tmp/', solver, '_profile_prima/*start*']); dir(['/tmp/', solver, '_profile_prima/*end*'])] - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['ctol', '${{ matrix.ctol_indicator }}_', '${{ matrix.with_optim_toolbox }}', '_optool_', files(ifile).name]) - movefile(file, newfile); - end - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_profile_prima/*summary*.pdf - /tmp/${{ matrix.solver }}_profile_prima/*.txt - /tmp/${{ matrix.solver }}_profile_prima/*start* - /tmp/${{ matrix.solver }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ matrix.solver }}_profile_prima diff --git a/.github/workflows/profile_quadruple.yml b/.github/workflows/profile_quadruple.yml deleted file mode 100644 index eb9cac1a91..0000000000 --- a/.github/workflows/profile_quadruple.yml +++ /dev/null @@ -1,144 +0,0 @@ -name: Plot performance profiles, quadruple - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 12 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [cobylal, cobylan, uobyqa, newuoa, bobyqa, lincoa, prima] - competitor: [quadruple] - - steps: - - name: Get the solver name - run: echo "SOLNAME=$(echo ${{ matrix.solver }} | cut -c1-6)" >> $GITHUB_ENV - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); options.nr = 2; % 2 random runs for each problem, as quadruple is slow - - if strcmp('${{ matrix.solver }}', 'cobylal') - prof('cobyla', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'cobylan') - prof('cobyla', '${{ matrix.dim }}', 'n', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'lincoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'bobyqa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'b', '${{ matrix.competitor }}', options); - else - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}', options); - end - - - % Move the files to prepare for uploading artifacts - - solver = '${{ env.SOLNAME }}'; - movefile(fullfile(cd(), 'testdata', '*summary*.pdf'), ['/tmp/', solver, '_profile_prima/']); - movefile(fullfile(cd(), 'testdata', '*.txt'), ['/tmp/', solver, '_profile_prima/']); - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ env.SOLNAME }}_profile_prima/*summary*.pdf - /tmp/${{ env.SOLNAME }}_profile_prima/*.txt - /tmp/${{ env.SOLNAME }}_profile_prima/*start* - /tmp/${{ env.SOLNAME }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ env.SOLNAME }}_profile_prima diff --git a/.github/workflows/profile_rescue_idz_classical.yml b/.github/workflows/profile_rescue_idz_classical.yml deleted file mode 100644 index fea1ac3377..0000000000 --- a/.github/workflows/profile_rescue_idz_classical.yml +++ /dev/null @@ -1,175 +0,0 @@ -name: Test RESCUE and IDZ, classical - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 20 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - -env: - BENCHMARK: rescue_idz - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small, all] - solver: [newuoa, bobyqa, lincoa] - - steps: - - name: Get the solver name - run: echo "SOLNAME=$(echo ${{ matrix.solver }} | cut -c1-6)" >> $GITHUB_ENV - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-yes # "yes" means that the Optimization_Toolbox is included in the cache - - - name: Set up MATLAB with optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - % Install MatCUTEst. - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - % Remove unnecessary files to make sure that we are testing the correct version. - files = {'.development/archiva', 'fortran', '.development/norma', 'matlab'}; - for ifile = 1 : length(files) - rmdir(fullfile(root_dir, files{ifile}), 's'); - end - delete(fullfile(root_dir, 'setup.m')); - movefile(fullfile(root_dir, 'benchmark/${{ env.BENCHMARK }}'), root_dir); - rmdir(fullfile(root_dir, 'benchmark'), 's'); - - - % Conduct the test. - - cd(fullfile(root_dir, '${{ env.BENCHMARK }}/matlab/tests')); - options = struct(); - options.classical = true; - options.rhoend = 1.0e-8; - options.maxfun_dim = 500; - options.strict = 0; - options.nr = 3; % 3 random runs for each problem - - % N.B.: Parallel profiling does not work. The worker will be shut down due to the resource - % requested by some problem. Worse, we do not know which problem it is due to the parallelism. - if strcmp('${{ matrix.dim }}', 'small') || strcmp('${{ matrix.solver }}', 'newuoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'norma', options, 'seq'); - elseif strcmp('${{ matrix.solver }}', 'lincoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'l', 'norma', options, 'seq'); - elseif strcmp('${{ matrix.solver }}', 'bobyqa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'b', 'norma', options, 'seq'); - end - - - % Move the files to prepare for uploading artifacts - - solver = '${{ env.SOLNAME }}'; - cd(fullfile(cd(), 'testdata')); - files = dir([solver, '*.summary.*.pdf']) - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['classical_', files(ifile).name]) - movefile(file, newfile); - end - movefile(fullfile(cd(), '*summary*.pdf'), ['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/']); - movefile(fullfile(cd(), '*.txt'), ['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/']); - - files = [dir(['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/*start*']); dir(['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/*end*'])] - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['classical_', files(ifile).name]) - movefile(file, newfile); - end - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*summary*.pdf - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*.txt - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*start* - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }} diff --git a/.github/workflows/profile_rescue_idz_modernized.yml b/.github/workflows/profile_rescue_idz_modernized.yml deleted file mode 100644 index 66f2faad6d..0000000000 --- a/.github/workflows/profile_rescue_idz_modernized.yml +++ /dev/null @@ -1,175 +0,0 @@ -name: Test RESCUE and IDZ, modernized - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - -env: - BENCHMARK: rescue_idz - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small, all] - solver: [newuoa, bobyqa, lincoa] - - steps: - - name: Get the solver name - run: echo "SOLNAME=$(echo ${{ matrix.solver }} | cut -c1-6)" >> $GITHUB_ENV - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-yes # Yes means that the Optimization_Toolbox is included in the cache - - - name: Set up MATLAB with optimization toolbox - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - % Install MatCUTEst. - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - % Remove unnecessary files to make sure that we are testing the correct version. - files = {'.development/archiva', 'fortran', '.development/norma', 'matlab'}; - for ifile = 1 : length(files) - rmdir(fullfile(root_dir, files{ifile}), 's'); - end - delete(fullfile(root_dir, 'setup.m')); - movefile(fullfile(root_dir, 'benchmark/${{ env.BENCHMARK }}'), root_dir); - rmdir(fullfile(root_dir, 'benchmark'), 's'); - - - % Conduct the test. - - cd(fullfile(root_dir, '${{ env.BENCHMARK }}/matlab/tests')); - options = struct(); - options.classical = false; - options.rhoend = 1.0e-8; - options.maxfun_dim = 500; - options.strict = 0; - options.nr = 3; % 3 random runs for each problem - - % N.B.: Parallel profiling does not work. The worker will be shut down due to the resource - % requested by some problem. Worse, we do not know which problem it is due to the parallelism. - if strcmp('${{ matrix.dim }}', 'small') || strcmp('${{ matrix.solver }}', 'newuoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'norma', options, 'seq'); - elseif strcmp('${{ matrix.solver }}', 'lincoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'l', 'norma', options, 'seq'); - elseif strcmp('${{ matrix.solver }}', 'bobyqa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'b', 'norma', options, 'seq'); - end - - - % Move the files to prepare for uploading artifacts - - solver = '${{ env.SOLNAME }}'; - cd(fullfile(cd(), 'testdata')); - files = dir([solver, '*.summary.*.pdf']) - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['modernized_', files(ifile).name]) - movefile(file, newfile); - end - movefile(fullfile(cd(), '*summary*.pdf'), ['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/']); - movefile(fullfile(cd(), '*.txt'), ['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/']); - - files = [dir(['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/*start*']); dir(['/tmp/', solver, '_profile_${{ env.BENCHMARK }}/*end*'])] - for ifile = 1 : length(files) - file = fullfile(files(ifile).folder, files(ifile).name) - newfile = fullfile(files(ifile).folder, ['modernized_', files(ifile).name]) - movefile(file, newfile); - end - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*summary*.pdf - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*.txt - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*start* - /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }}/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ env.SOLNAME }}_profile_${{ env.BENCHMARK }} diff --git a/.github/workflows/profile_single.yml b/.github/workflows/profile_single.yml deleted file mode 100644 index fd2581ee57..0000000000 --- a/.github/workflows/profile_single.yml +++ /dev/null @@ -1,145 +0,0 @@ -name: Plot performance profiles, single - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 10 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [cobylal, cobylan, uobyqa, newuoa, bobyqa, lincoa, prima] - competitor: [single] - - steps: - - - name: Get the solver name - run: echo "SOLNAME=$(echo ${{ matrix.solver }} | cut -c1-6)" >> $GITHUB_ENV - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); options.nr = 5; % 5 random runs for each problem - - if strcmp('${{ matrix.solver }}', 'cobylal') - prof('cobyla', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'cobylan') - prof('cobyla', '${{ matrix.dim }}', 'n', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'lincoa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'l', '${{ matrix.competitor }}', options); - elseif strcmp('${{ matrix.solver }}', 'bobyqa') - prof('${{ matrix.solver }}', '${{ matrix.dim }}', 'b', '${{ matrix.competitor }}', options); - else - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}', options); - end - - - % Move the files to prepare for uploading artifacts - - solver = '${{ env.SOLNAME }}'; - movefile(fullfile(cd(), 'testdata', '*summary*.pdf'), ['/tmp/', solver, '_profile_prima/']); - movefile(fullfile(cd(), 'testdata', '*.txt'), ['/tmp/', solver, '_profile_prima/']); - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ env.SOLNAME }}_profile_prima/*summary*.pdf - /tmp/${{ env.SOLNAME }}_profile_prima/*.txt - /tmp/${{ env.SOLNAME }}_profile_prima/*start* - /tmp/${{ env.SOLNAME }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ env.SOLNAME }}_profile_prima diff --git a/.github/workflows/profile_uobyqa_small.yml b/.github/workflows/profile_uobyqa_small.yml deleted file mode 100644 index dd5579178e..0000000000 --- a/.github/workflows/profile_uobyqa_small.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Plot performance profiles for UOBYQA, small - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - # schedule: - # - cron: '0 2,6,10,14,18,22 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Profile PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - dim: [small] - solver: [uobyqa] - competitor: [classical, archiva] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Install epstopdf and ghostscript - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - cd(fullfile(root_dir, 'matlab/tests')); - - prof('${{ matrix.solver }}', '${{ matrix.dim }}', '${{ matrix.competitor }}'); - - - % Move the files to prepare for uploading artifacts - - movefile(fullfile(cd(), 'testdata', '*summary*.pdf'), '/tmp/${{ matrix.solver }}_profile_prima/'); - movefile(fullfile(cd(), 'testdata', '*.txt'), '/tmp/${{ matrix.solver }}_profile_prima/'); - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_profile_prima/*summary*.pdf - /tmp/${{ matrix.solver }}_profile_prima/*.txt - /tmp/${{ matrix.solver }}_profile_prima/*start* - /tmp/${{ matrix.solver }}_profile_prima/*end* - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ./matlab/tests/testdata && rm -rf /tmp/${{ matrix.solver }}_profile_prima diff --git a/.github/workflows/stress_test_fortran.yml b/.github/workflows/stress_test_fortran.yml deleted file mode 100644 index c558a2e5e8..0000000000 --- a/.github/workflows/stress_test_fortran.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: Stress test on large problems, Fortran - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 18 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Stress test of PRIMA on large problems - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] - compiler: [g, i, v, s, f, x, d] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - testdim: [large] - exclude: - - os: macos-latest - compiler: v - - os: macos-latest - compiler: s - - os: macos-latest - compiler: f - - os: macos-latest - compiler: x - - os: macos-latest - compiler: d - - compiler: s # BOBYQA fails stest for unknown reason - solver: bobyqa - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Install AOCC - if: ${{ matrix.compiler == 'd' }} - run: bash .github/scripts/install_aocc - - - name: Install gfortran - if: ${{ matrix.compiler == 'g' }} - uses: awvwgk/setup-fortran@main - id: setup-fortran - with: - compiler: gcc - - - name: Install Intel oneAPI on Linux - if: ${{ startsWith(matrix.os, 'ubuntu') && (matrix.compiler == 'i' || matrix.compiler == 'x') }} - run: bash .github/scripts/install_oneapi_linux.sh - - - name: Install Intel oneAPI on macOS - if: ${{ startsWith(matrix.os, 'macos') && (matrix.compiler == 'i' || matrix.compiler == 'x') }} - run: bash .github/scripts/install_oneapi_macos.sh - - - name: Install nvfortran - if: ${{ matrix.compiler == 'v' }} - run: bash .github/scripts/install_nvfortran - - - name: Install Oracle sunf95 - if: ${{ matrix.compiler == 's' }} - run: bash .github/scripts/install_sunf95 - - # Install Flang after AOCC, to make sure that flang is this one, while AOCC flang will be - # known as aflang. - - name: Install Flang - if: ${{ matrix.compiler == 'f' }} - run: bash .github/scripts/install_flang - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/tests - export TESTDIM=${{ matrix.testdim }} - RK=$((2**($(date +%-d) % 3 + 2))) - echo "RK = " $RK - if [[ $RK==16 && dfrv == *${{ matrix.compiler }}* ]] ; then - echo "r16 test is skipped for compiler " ${{ matrix.compiler }} - else - make ${{ matrix.compiler }}test_i2_r${RK}_d1_tst.${{ matrix.solver }} - fi - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/stress_test_matlab.yml b/.github/workflows/stress_test_matlab.yml deleted file mode 100644 index 42250a84c9..0000000000 --- a/.github/workflows/stress_test_matlab.yml +++ /dev/null @@ -1,169 +0,0 @@ -name: Stress test on large problems, MATLAB - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 6 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - random-seed: - description: Random Seed (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0} , seed {1}', inputs.git-ref, inputs.random-seed) || '' }} - -jobs: - test: - name: Stress test of PRIMA on large problems - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-20.04, macos-11, windows-2019] - matlab: [latest, R2020b, R2021a, R2022a] - solver: [uobyqa, newuoa, bobyqa, lincoa, cobyla] - test: [normal, tough] - - # Exclude some versions of OS and MATLAB. In addition to the latest versions, we intend to - # test the earliest version of MATLAB on each OS. - exclude: - - os: ubuntu-latest - matlab: R2020b - - os: ubuntu-latest - matlab: R2021a - - os: ubuntu-latest - matlab: R2022a - - os: ubuntu-20.04 - matlab: R2021a - - os: ubuntu-20.04 - matlab: R2022a - - os: ubuntu-20.04 - matlab: latest - - - os: macos-latest - matlab: R2020b - - os: macos-latest - matlab: R2021a - - os: macos-latest - matlab: R2022a - - os: macos-11 - matlab: R2020b - - os: macos-11 - matlab: R2021a - - os: macos-11 - matlab: latest - - - os: windows-latest - matlab: R2020b - - os: windows-latest - matlab: R2021a - - os: windows-latest - matlab: R2022a - - os: windows-2019 - matlab: R2020b - - os: windows-2019 - matlab: R2022a - - os: windows-2019 - matlab: latest - - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: | - GFVER=12 - if [[ "${{ matrix.os }}" = "ubuntu-20.04" ]] ; then - GFVER=11 - fi - if [[ "${{ matrix.matlab }}" = "R2020b" || "${{ matrix.matlab }}" = "R2021a" || "${{ matrix.matlab }}" = "R2021b" ]] ; then - GFVER=9 - fi - bash .github/scripts/link_gfortran "$GFVER" - - - name: Install Intel oneAPI on macOS - if: startsWith(matrix.os, 'macos') - run: bash .github/scripts/install_oneapi_macos.sh - - - name: Install Intel oneAPI on Windows - if: startsWith(matrix.os, 'windows') - run: cmd.exe "/K" '".github\scripts\install_oneapi_windows.bat"' - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }}-yes - - - name: Set up MATLAB with optimization toolbox - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - products: Optimization_Toolbox - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - if ~isempty('${{ inputs.random-seed }}') - options.seed = str2num('${{ inputs.random-seed }}'); - else - copyfile('private/year_week.m', cd()); - options.seed = year_week('Asia/Shanghai'); - end - options.tough = strcmp('${{ matrix.test }}', 'tough'); - daynum = day(datetime('now', 'TimeZone', 'Asia/Shanghai')); - if mod(daynum, 3) == 0 - options.precision = 'single'; - elseif mod(daynum, 3) == 1 - options.precision = 'double'; - else - options.precision = 'quadruple'; - end - options - stress('${{ matrix.solver }}', options); - - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_absoft.yml b/.github/workflows/test_absoft.yml deleted file mode 100644 index 0bef3d99ef..0000000000 --- a/.github/workflows/test_absoft.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Test Absoft - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 20 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - -jobs: - - test: - name: Run Absoft tests - runs-on: [self-hosted, absoft] - strategy: - fail-fast: false - matrix: - ikind: [i2] - solver: [newuoa, lincoa, bobyqa, uobyqa] # COBYLA cannot pass the test due to internal subroutines used as arguments - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - LOCAL="$HOME/local" - AFDIR="$(find "$LOCAL" -maxdepth 2 -name "absoft[0-9]*" -type d -print | sort | tail -n 1)" - source "$AFDIR"/bin/absvars.sh - export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH - # Use $(( )) rather than $(expr ). See https://unix.stackexchange.com/questions/63166/bash-e-exits-when-let-or-expr-evaluates-to-0 - FFLAGS=-O$(($(date +%-d) % 4)) - FFLAGS=${FFLAGS/O0/g} - export FFLAGS - cd "$ROOT_DIR"/fortran/tests && make atest_${{ matrix.ikind }}.${{ matrix.solver }} - # af95 cannot handle allocatable characters. - # cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make atest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_aflang.yml b/.github/workflows/test_aflang.yml deleted file mode 100644 index 4528129587..0000000000 --- a/.github/workflows/test_aflang.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Test Flang in AMD AOCC - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 4 1-31/3 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run AOCC Flang tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - ikind: [i2, i8] - #solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - # With flang in AMD clang version 14.0.6, fortran/cobyla of 54e66dd does not pass dtest. - # See https://github.com/libprima/prima/issues/41 . To be tested when AMD flang is updated. - solver: [newuoa, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install AOCC - run: bash .github/scripts/install_aocc - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make dtest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make dtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_armflang_kunpeng.yml b/.github/workflows/test_armflang_kunpeng.yml deleted file mode 100644 index e6637b8dfd..0000000000 --- a/.github/workflows/test_armflang_kunpeng.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Test armflang on Kunpeng - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 5-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run armflang tests - runs-on: [self-hosted, ARM64, kp] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - exclude: - - solver: lincoa # As of armflang 22.1, rtest often get canceled in the following cases. - fflags: [-O2, -O3] - testdim: big - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - ARMDIR="$(find /opt/arm -maxdepth 1 -name "arm-linux-compiler*" -type d -print | sort | tail -n 1)" - if [[ -n "$ARMDIR" ]] ; then - export PATH=$PATH:"$ARMDIR"/bin - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib - ARMLD="$(find /opt/arm -type f -executable -name ld | xargs dirname)" - ARMLD_DIR=${ARMLD//$'\n'/:} - export PATH=$PATH:"$ARMLD_DIR" - fi - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -r && bash ./mlint -r - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make rtest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make rtest - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_armflang_pi.yml b/.github/workflows/test_armflang_pi.yml deleted file mode 100644 index be5c3fdd57..0000000000 --- a/.github/workflows/test_armflang_pi.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Test armflang on Raspberry Pi - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 5-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run armflang tests - runs-on: [self-hosted, ARM64, pi64] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -r && bash ./mlint -r - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make rtest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make rtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_flang.yml b/.github/workflows/test_flang.yml deleted file mode 100644 index 1e41a754d2..0000000000 --- a/.github/workflows/test_flang.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Test Flang - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 4 2-31/3 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run Flang tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] # As of 20221217, the flang installed by ../scripts/install_flang may only work with ubuntu-22.04 - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install Flang - run: bash .github/scripts/install_flang - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make ftest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make ftest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_flang_kunpeng.yml b/.github/workflows/test_flang_kunpeng.yml deleted file mode 100644 index e3a15de4fa..0000000000 --- a/.github/workflows/test_flang_kunpeng.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Test Flang on Kunpeng - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 4-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run Flang tests - runs-on: [self-hosted, ARM64, kp] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - # For COBYLA, Flang (HUAWEI BiSheng Compiler 2.1.0) raises a false positive SIGSEG in testsuite/prob.f90 - #solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - solver: [newuoa, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - ARMDIR="$(find /opt/arm -maxdepth 1 -name "arm-linux-compiler*" -type d -print | sort | tail -n 1)" - if [[ -n "$ARMDIR" ]] ; then - export PATH=$PATH:"$ARMDIR"/bin - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib - ARMLD="$(find /opt/arm -type f -executable -name ld | xargs dirname)" - ARMLD_DIR=${ARMLD//$'\n'/:} - export PATH=$PATH:"$ARMLD_DIR" # For some reason, flang also needs this ld. The system ld does not work. - fi - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -f && bash ./mlint -f - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make ftest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make ftest - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_flang_pi.yml b/.github/workflows/test_flang_pi.yml deleted file mode 100644 index 0d4104340d..0000000000 --- a/.github/workflows/test_flang_pi.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Test Flang on Raspberry Pi - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 4-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run Flang tests - runs-on: [self-hosted, ARM64, pi64] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install Flang - run: bash .github/scripts/install_flang - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -f && bash ./mlint -f - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make ftest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make ftest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_g95.yml b/.github/workflows/test_g95.yml deleted file mode 100644 index e9393ee40e..0000000000 --- a/.github/workflows/test_g95.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Test g95 - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 5 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run g95 tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install g95 - run: bash .github/scripts/install_g95 - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - # No need to test in parallel, as 9test compiles without running (identical to 9test_c). - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - cd "$ROOT_DIR"/fortran/tests && make 9test_c.${{ matrix.solver }} - # 20211012: make 9test_newuoa will not work, because, for some unknown reason, 9test_c is - # remade when making 9test even though 9test_c has been made and up to date. Since the - # making of 9test is in parallel, 9test_c will also be triggered in parallel, which leads - # to problems like un-found modules. Not yet observed for other tests. - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_gfortran_O12.yml b/.github/workflows/test_gfortran_O12.yml deleted file mode 100644 index a6b8556ba1..0000000000 --- a/.github/workflows/test_gfortran_O12.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: Test gfortran, -O1, -O2 - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 3-31/4 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - compiler: [gcc] - version: [11, 13] # Too expensive to test all versions - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - testdim: [small] - exclude: - - os: windows-latest - version: 13 # gfortran-13 is not available on Windows as of 20230904 - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - - name: Setup Fortran - id: setup_fortran - uses: awvwgk/setup-fortran@main - with: - compiler: ${{ matrix.compiler }} - version: ${{ matrix.version }} - - - name: Check Fortran compiler - run: | - ${{ env.FC }} --version - ${{ env.CC }} --version - shell: bash - env: - FC: ${{ steps.setup_fortran.outputs.fc }} - CC: ${{ steps.setup_fortran.outputs.cc }} - - - name: Make tools such as grep, make, and git available on Windows - if: runner.os == 'Windows' - run: $env:Path += ";C:\Program Files\Git\usr\bin;C:\Program Files\Git\bin;C:\ProgramData\Chocolatey\bin" - - - name: Miscellaneous setup - shell: bash # Important; otherwise, the following statements do not work on Windows. - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash # Important; otherwise, `<` will not work on Windows. - # Not sure whether the Makefile has bugs, but on Windows the making of gtest always invokes - # the making of gtest_c twice even if the former is up to date after the first making. It - # may lead to errors due to parallel making. To avoid this, we make gtest_c first. - run: | - # 20221212: We skip the linting and extensive test on Windows due to the following - # reasons. The example will still be tested on Windows. - # 1. Windows does not support the symlink of linux, and hence mlint and flint do not work. - # 2. Makefile.common does not work on Windows for the moment due to quotation marks. - if [[ "$RUNNER_OS" != "Windows" ]] ; then - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export TESTDIM=${{ matrix.testdim }} - export FFLAGS='-O1' - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}.${{ matrix.solver }} - export FFLAGS='-O2' - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}.${{ matrix.solver }} - fi - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_gfortran_big.yml b/.github/workflows/test_gfortran_big.yml deleted file mode 100644 index 60a0ef90c9..0000000000 --- a/.github/workflows/test_gfortran_big.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Test gfortran, big - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 1-31/4 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] - compiler: [gcc] - version: [11, 13] - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, O3, -g, -fast] - testdim: [big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Setup Fortran - id: setup_fortran - uses: awvwgk/setup-fortran@main - with: - compiler: ${{ matrix.compiler }} - version: ${{ matrix.version }} - - - name: Check Fortran compiler - run: | - ${{ env.FC }} --version - ${{ env.CC }} --version - shell: bash - env: - FC: ${{ steps.setup_fortran.outputs.fc }} - CC: ${{ steps.setup_fortran.outputs.cc }} - - - name: Make tools such as grep, make, and git available on Windows - if: runner.os == 'Windows' - run: $env:Path += ";C:\Program Files\Git\usr\bin;C:\Program Files\Git\bin;C:\ProgramData\Chocolatey\bin" - - - name: Miscellaneous setup - shell: bash # Important; otherwise, the following statements do not work on Windows. - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash # Important; otherwise, `<` will not work on Windows. - # Not sure whether the Makefile has bugs, but on Windows the making of gtest always invokes - # the making of gtest_c twice even if the former is up to date after the first making. It - # may lead to errors due to parallel making. To avoid this, we make gtest_c first. - run: | - # 20221212: We skip the linting and extensive test on Windows due to the following - # reasons. The example will still be tested on Windows. - # 1. Windows does not support the symlink of linux, and hence mlint and flint do not work. - # 2. Makefile.common does not work on Windows for the moment due to quotation marks. - if [[ "$RUNNER_OS" != "Windows" ]] ; then - export TESTDIM=${{ matrix.testdim }} - export FFLAGS=${{ matrix.fflags }} - cd "$ROOT_DIR"/fortran/tests - make gtest_${{ matrix.ikind }}_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}.${{ matrix.solver }} - fi - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_gfortran_fast.yml b/.github/workflows/test_gfortran_fast.yml deleted file mode 100644 index 3b13c2b6ff..0000000000 --- a/.github/workflows/test_gfortran_fast.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Test gfortran, -fast - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 4-31/4 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - compiler: [gcc] - version: [11, 13] # gfortran 9 is buggy wit logical variables when invoked with -Ofast - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - testdim: [small] - exclude: - - os: windows-latest - version: 13 # gfortran-13 is not available on Windows as of 20230904 - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - - name: Setup Fortran - id: setup_fortran - uses: awvwgk/setup-fortran@main - with: - compiler: ${{ matrix.compiler }} - version: ${{ matrix.version }} - - - name: Check Fortran compiler - run: | - ${{ env.FC }} --version - ${{ env.CC }} --version - shell: bash - env: - FC: ${{ steps.setup_fortran.outputs.fc }} - CC: ${{ steps.setup_fortran.outputs.cc }} - - - name: Make tools such as grep, make, and git available on Windows - if: runner.os == 'Windows' - run: $env:Path += ";C:\Program Files\Git\usr\bin;C:\Program Files\Git\bin;C:\ProgramData\Chocolatey\bin" - - - name: Miscellaneous setup - shell: bash # Important; otherwise, the following statements do not work on Windows. - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash # Important; otherwise, `<` will not work on Windows. - # Not sure whether the Makefile has bugs, but on Windows the making of gtest always invokes - # the making of gtest_c twice even if the former is up to date after the first making. It - # may lead to errors due to parallel making. To avoid this, we make gtest_c first. - run: | - # 20221212: We skip the linting and extensive test on Windows due to the following - # reasons. The example will still be tested on Windows. - # 1. Windows does not support the symlink of linux, and hence mlint and flint do not work. - # 2. Makefile.common does not work on Windows for the moment due to quotation marks. - if [[ "$RUNNER_OS" != "Windows" ]] ; then - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export TESTDIM=${{ matrix.testdim }} - export FFLAGS='-fast' - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}.${{ matrix.solver }} - fi - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_gfortran_gO3.yml b/.github/workflows/test_gfortran_gO3.yml deleted file mode 100644 index fd353fcb99..0000000000 --- a/.github/workflows/test_gfortran_gO3.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test gfortran, -g, -O3 - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 2-31/4 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - compiler: [gcc] - version: [11, 13] # Too expensive to test all versions - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - testdim: [small] - exclude: - - os: windows-latest - version: 13 # gfortran-13 is not available on Windows as of 20230904 - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - - name: Setup Fortran - id: setup_fortran - uses: awvwgk/setup-fortran@main - with: - compiler: ${{ matrix.compiler }} - version: ${{ matrix.version }} - - - name: Check Fortran compiler - run: | - ${{ env.FC }} --version - ${{ env.CC }} --version - shell: bash - env: - FC: ${{ steps.setup_fortran.outputs.fc }} - CC: ${{ steps.setup_fortran.outputs.cc }} - - - name: Make tools such as grep, make, and git available on Windows - if: runner.os == 'Windows' - run: $env:Path += ";C:\Program Files\Git\usr\bin;C:\Program Files\Git\bin;C:\ProgramData\Chocolatey\bin" - - - name: Miscellaneous setup - shell: bash # Important; otherwise, the following statements do not work on Windows. - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash # Important; otherwise, `<` will not work on Windows. - # Not sure whether the Makefile has bugs, but on Windows the making of gtest always invokes - # the making of gtest_c twice even if the former is up to date after the first making. It - # may lead to errors due to parallel making. To avoid this, we make gtest_c first. - run: | - # 20221212: We skip the linting and extensive test on Windows due to the following - # reasons. The example will still be tested on Windows. - # 1. Windows does not support the symlink of linux, and hence mlint and flint do not work. - # 2. Makefile.common does not work on Windows for the moment due to quotation marks. - if [[ "$RUNNER_OS" != "Windows" ]] ; then - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - cd "$ROOT_DIR"/fortran/tests && export TESTDIM=${{ matrix.testdim }} && make gtest_${{ matrix.ikind }}_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}.${{ matrix.solver }} - fi - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_gfortran_kunpeng_big.yml b/.github/workflows/test_gfortran_kunpeng_big.yml deleted file mode 100644 index 3eaeb71b8b..0000000000 --- a/.github/workflows/test_gfortran_kunpeng_big.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Test gfortran on Kunpeng, big - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 12 2-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: [self-hosted, ARM64, kp] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - #cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -g && bash ./mlint -g # On Kunpeng, perform lintering only for small tests of gfortran - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests - make gtest_${{ matrix.ikind }}_r4_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r4_d1_tst.${{ matrix.solver }} - make gtest_${{ matrix.ikind }}_r8_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r8_d1_tst.${{ matrix.solver }} - export FS=08 - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_gfortran_kunpeng_small.yml b/.github/workflows/test_gfortran_kunpeng_small.yml deleted file mode 100644 index 81d6551699..0000000000 --- a/.github/workflows/test_gfortran_kunpeng_small.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Test gfortran on Kunpeng, small - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 12 1-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: [self-hosted, ARM64, kp] - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -g && bash ./mlint -g # On Kunpeng, perform lintering only for small tests of gfortran - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_r4_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r4_d1_tst.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_r8_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r8_d1_tst.${{ matrix.solver }} - export FS=08 - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_gfortran_pi32_big.yml b/.github/workflows/test_gfortran_pi32_big.yml deleted file mode 100644 index f86e70480b..0000000000 --- a/.github/workflows/test_gfortran_pi32_big.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Test gfortran on Raspberry Pi32, big - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 2-31/2 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: [self-hosted, ARM, pi32] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - #cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -g && bash ./mlint -g - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests - make gtest_${{ matrix.ikind }}_r4_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r4_d1_tst.${{ matrix.solver }} - make gtest_${{ matrix.ikind }}_r8_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r8_d1_tst.${{ matrix.solver }} - export FS=18 - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_gfortran_pi32_small.yml b/.github/workflows/test_gfortran_pi32_small.yml deleted file mode 100644 index 5fcf7834b1..0000000000 --- a/.github/workflows/test_gfortran_pi32_small.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Test gfortran on Raspberry Pi32, small - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 1-31/2 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: [self-hosted, ARM, pi32] - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -g && bash ./mlint -g # On Raspberry Pi, perform lintering only for small tests of gfortran - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_r4_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r4_d1_tst.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_r8_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r8_d1_tst.${{ matrix.solver }} - export FS=18 - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_gfortran_pi64_big.yml b/.github/workflows/test_gfortran_pi64_big.yml deleted file mode 100644 index e075da2118..0000000000 --- a/.github/workflows/test_gfortran_pi64_big.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Test gfortran on Raspberry Pi64, big - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 2-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: [self-hosted, ARM64, pi64] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - #cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -g && bash ./mlint -g - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests - make gtest_${{ matrix.ikind }}_r4_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r4_d1_tst.${{ matrix.solver }} - make gtest_${{ matrix.ikind }}_r8_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r8_d1_tst.${{ matrix.solver }} - export FS=18 - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_gfortran_pi64_small.yml b/.github/workflows/test_gfortran_pi64_small.yml deleted file mode 100644 index b55deb2940..0000000000 --- a/.github/workflows/test_gfortran_pi64_small.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Test gfortran on Raspberry Pi64, small - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 1-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run gfortran tests - runs-on: [self-hosted, ARM64, pi64] - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -g && bash ./mlint -g # On Raspberry Pi, perform lintering only for small tests of gfortran - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_r4_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r4_d1_tst.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/tests && make gtest_${{ matrix.ikind }}_r8_d1_tst_c.${{ matrix.solver }} && make gtest_${{ matrix.ikind }}_r8_d1_tst.${{ matrix.solver }} - export FS=18 - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make gtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - # Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`. - # In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - shell: bash # Important; otherwise, `rm -rf` will not work on Windows. - run: rm -rf ${{ env.TEST_DIR }} diff --git a/.github/workflows/test_ifort.yml b/.github/workflows/test_ifort.yml deleted file mode 100644 index 4a64a2174e..0000000000 --- a/.github/workflows/test_ifort.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Test ifort - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 18 1-31/2 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run ifort tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - # Windows does not work. On Windows, the options for ifort/ifx starts with "/" instead of "-". - os: [ubuntu-latest, macos-latest] - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - exclude: - - os: macos-latest - ikind: i8 - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install Intel oneAPI on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_oneapi_linux.sh - - - name: Install Intel oneAPI on macOS - if: startsWith(matrix.os, 'macos') - run: bash .github/scripts/install_oneapi_macos.sh - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make itest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make itest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_ifx.yml b/.github/workflows/test_ifx.yml deleted file mode 100644 index dfe1de9e4c..0000000000 --- a/.github/workflows/test_ifx.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Test ifx - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 18 2-31/2 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run ifx tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - # Windows does not work. On Windows, the options for ifort/ifx starts with "/" instead of "-". - # As of 202301, ifx is not available on macOS. - #os: [ubuntu-latest, macos-latest] - os: [ubuntu-latest] - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install Intel oneAPI on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/install_oneapi_linux.sh - - - name: Install Intel oneAPI on macOS - if: startsWith(matrix.os, 'macos') - run: bash .github/scripts/install_oneapi_macos.sh - - - name: Miscellaneous setup - shell: bash - run: bash .github/scripts/misc_setup - - - name: Conduct the test - shell: bash - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make xtest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make xtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_llvm b/.github/workflows/test_llvm deleted file mode 100644 index 67610ac715..0000000000 --- a/.github/workflows/test_llvm +++ /dev/null @@ -1,101 +0,0 @@ -name: Test Flang (llvm) - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 4 2-31/3 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run LLVM Flang tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install LLVM - uses: KyleMayes/install-llvm-action@v1.8.3 - with: - version: "16.0.0" - - - name: Check Flang - run: which flang && flang --version - - - name: Symlink libclang.so (Linux) - if: contains(matrix.os, 'ubuntu') - run: sudo ln -s libclang-11.so.1 /lib/x86_64-linux-gnu/libclang.so - working-directory: ${{ env.LLVM_PATH }}/lib - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make ftest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make ftest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_matlab.yml b/.github/workflows/test_matlab.yml deleted file mode 100644 index 07af423854..0000000000 --- a/.github/workflows/test_matlab.yml +++ /dev/null @@ -1,158 +0,0 @@ -name: Test MATLAB - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 1 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - test: - name: Test MATLAB - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04, ubuntu-latest, windows-2019, windows-latest, macos-11, macos-latest] - matlab: [R2020b, R2021a, R2021b, R2022a, R2022b, R2023a, R2023b, latest] - - exclude: - - # Below R2022a, MEX is extremely slow on macOS - - os: macos-11 - matlab: R2020b - - os: macos-11 - matlab: R2021a - - os: macos-11 - matlab: R2021b - - - os: macos-latest - matlab: R2020b - - os: macos-latest - matlab: R2021a - - os: macos-latest - matlab: R2021b - - # Only R2021a/b and R2022a are available on Windows 2019. - - os: windows-2019 - matlab: R2020b - - os: windows-2019 - matlab: R2022b - - os: windows-2019 - matlab: R2023a - - os: windows-2019 - matlab: latest - - # Below R2022a, MEX does not work on windows-latest due to the version of MS Visual Studio; - # R2022a/b should work according to the documentation of MathWorks and GitHub Actions, but - # they do not as of March 2022 - - os: windows-latest - matlab: R2020a - - os: windows-latest - matlab: R2020b - - os: windows-latest - matlab: R2021a - - os: windows-latest - matlab: R2021b - - os: windows-latest - matlab: R2022a - - os: windows-latest - matlab: R2022b - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - submodules: recursive - # ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - # As of 230425, checkout with ssh fails frequently on Windows runners. - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: | - GFVER=${{ env.GFORTRAN_VERSION }} - if [[ "${{ matrix.os }}" = "ubuntu-20.04" ]] ; then - GFVER=11 - fi - if [[ "${{ matrix.matlab }}" = "R2020b" || "${{ matrix.matlab }}" = "R2021a" || "${{ matrix.matlab }}" = "R2021b" ]] ; then - GFVER=9 - fi - bash .github/scripts/link_gfortran "$GFVER" - - - name: Install Intel oneAPI on macOS - if: startsWith(matrix.os, 'macos') - run: bash .github/scripts/install_oneapi_macos.sh - - - name: Install Intel oneAPI on Windows - if: startsWith(matrix.os, 'windows') - run: cmd.exe "/K" '".github\scripts\install_oneapi_windows.bat"' - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - cd(root_dir); - options = struct(); - options.debug=true; - setup(options); - prima('info') - testprima(false, 1.0e-10, 100); - setup - setup path - prima('info') - testprima(false, 1.0e-10, 100); - setup cobyla - setup uobyqa - setup newuoa - setup bobyqa - setup lincoa - setup prima - setup path - setup clean - setup path - setup uninstall - setup path - setup uninstall - cd(fullfile(root_dir, 'matlab', 'tests')); pdv - cd(root_dir); - setup - prima('info') - cd(fullfile(root_dir, 'matlab', 'examples')); rosenbrock_example diff --git a/.github/workflows/test_nagfor.yml b/.github/workflows/test_nagfor.yml deleted file mode 100644 index 9a984189d8..0000000000 --- a/.github/workflows/test_nagfor.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Test nagfor - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 19 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - -jobs: - - test: - name: Run nagfor tests - runs-on: [self-hosted, nagfor] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - export PATH=$PATH:"~/local/bin" - source ~/local/bin/nag_licensing || echo "\n\nNAG licensing failed.\n\n" - # Use $(( )) rather than $(expr ). See https://unix.stackexchange.com/questions/63166/bash-e-exits-when-let-or-expr-evaluates-to-0 - FFLAGS=-O$(($(date +%-d) % 5)) - FFLAGS=${FFLAGS/O0/g} - FFLAGS=${FFLAGS/O4/fast} - export FFLAGS - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make ntest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make ntest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_nvfortran.yml b/.github/workflows/test_nvfortran.yml deleted file mode 100644 index 10ee578af3..0000000000 --- a/.github/workflows/test_nvfortran.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Test nvfortran - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 4 3-31/3 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run nvfortran tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install nvfortran - run: bash .github/scripts/install_nvfortran - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make vtest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make vtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_nvfortran_kunpeng.yml b/.github/workflows/test_nvfortran_kunpeng.yml deleted file mode 100644 index ae1229417e..0000000000 --- a/.github/workflows/test_nvfortran_kunpeng.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Test nvfortran on Kunpeng - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 3-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run nvfortran tests - runs-on: [self-hosted, ARM64, kp] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -v && bash ./mlint -v - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make vtest_${{ matrix.ikind }}.${{ matrix.solver }} - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make vtest - - # - name: Store artifacts - # uses: actions/upload-artifact@v3.1.2 - # if: always() # Always run even if the workflow is canceled manually or due to overtime. - # with: - # path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_nvfortran_pi.yml b/.github/workflows/test_nvfortran_pi.yml deleted file mode 100644 index b25bbc6f7b..0000000000 --- a/.github/workflows/test_nvfortran_pi.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Test nvfortran on Raspberry Pi - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 16 3-31/5 * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run nvfortran tests - runs-on: [self-hosted, ARM64, pi64] - continue-on-error: true - strategy: - fail-fast: false - matrix: - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - fflags: [-O1, -O2, -O3, -g, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - # Without the following lines, flint does not invoke vtest. No idea why. - NVDIR="/opt/nvidia/hpc_sdk/Linux_aarch64/" - if [[ -d "$NVDIR" ]] ; then NVBIN=$(find "$NVDIR" -wholename "*compilers/bin" -type d -print | sort | tail -n 1) ; fi - if [[ -n "$NVBIN" ]] ; then export PATH=$PATH:"$NVBIN" ; fi - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint -v && bash ./mlint -v - # As of nvfortran 23.1, date_and_time() and random_number are not supported on Raspberry Pi - # 4B. Thus we have to disable the extensive tests, trying only the simple example. - #cd "$ROOT_DIR"/fortran/tests && export FFLAGS=${{ matrix.fflags }} && export TESTDIM=${{ matrix.testdim }} && make vtest_${{ matrix.ikind }}.${{ matrix.solver }} - printf "\n\n********************************************************************************" - printf "\nExtensive tests are skipped due to the unavailability of date_and_time() and random_number." - printf "\nSee the comments in the yml file.\nCheck whether they are available now." - printf "\n********************************************************************************\n\n" - cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make vtest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/test_sunf95.yml b/.github/workflows/test_sunf95.yml deleted file mode 100644 index 05b87feeb5..0000000000 --- a/.github/workflows/test_sunf95.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Test Oracle sunf95 - -on: - # Trigger the workflow on push or pull request - #push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - # - cron: '0 7 * * *' - - cron: '0 7 * * *' # Reduce the frequency until NORM is fixed. - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} - - -jobs: - - test: - name: Run sunf95 tests - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - ikind: [i2, i8] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - # As of 20230213, -fast fails often; seems due to stack overflow. How to force sunf95 to use - # heap only? - fflags: [-O1, -O2, -O3, -g] #, -fast] - testdim: [small, big] - - steps: - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Install Oracle sunf95 - run: bash .github/scripts/install_sunf95 - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Conduct the test - run: | - cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all - export FFLAGS=${{ matrix.fflags }} - export TESTDIM=${{ matrix.testdim }} - cd "$ROOT_DIR"/fortran/tests && make stest_${{ matrix.ikind }}.${{ matrix.solver }} - # sunf95 cannot handle matrix indexing with TRUELOC or allocatable characters. - # cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} && make stest - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log - - - name: Remove the test data - if: always() # Always run even if the workflow is canceled manually or due to overtime. - run: rm -rf ${{ env.TEST_DIR }} - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/verify_archiva.yml b/.github/workflows/verify_archiva.yml deleted file mode 100644 index b06ac6f7c3..0000000000 --- a/.github/workflows/verify_archiva.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Verification, archiva - -on: - # Trigger the workflow on push or pull request - #push: - #pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - # - cron: '0 1,9,17 * * *' - - cron: '0 22 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - random-seed: - description: Random Seed (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0} , seed {1}', inputs.git-ref, inputs.random-seed) || '' }} - - -jobs: - test: - name: Verify PRIMA. - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - dim: [small, big, large] - version: [220208, 220227, 220513, 220531,220601,220616,220819,220926,221105,221128,230108,230305,230430,230509,230614,230804] - exclude: - - solver: lincoa - dim: large # very few problems but takes too much time to run - - solver: newuoa - dim: large # very few problems but takes too much time to run - - steps: - - - name: Run `sudo apt update` - run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail - - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - # all of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false # Important, or the runner may be shut down due to memory starvation. - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, '.development/archiva/${{ matrix.version }}/matlab/tests')); - tz = 'Asia/Shanghai'; - dt = datetime('now', 'TimeZone', tz); - DayMonth = day(dt); - options = struct(); - options.verbose = true; - if ~isempty('${{ inputs.random-seed }}') - options.seed = str2num('${{ inputs.random-seed }}'); - else - options.seed = 10000*mod(year(dt), 100) + 100*week(dt) + hour(dt); - end - options.nr = 1; % Since the code will not change along the time, big nr is not needed. - options.no_classical = true; % Starting from 20230212, we do not verify the classical version for the archiva. - options - verify('${{ matrix.solver }}', '${{ matrix.dim }}', 'seq', options); % Zaikun 20230328: Conduct the verification in sequential to avoid the debugging pain. - delete([upper('${{ matrix.solver }}'), '_output.txt']); - delete('fort.6'); - cd(root_dir); setup clean; setup uninstall; - - # The following job check whether the tests were successful or cancelled due to timeout. - # N.B.: Remember to specify `continue-on-error: true` for the job of the tests. - check_success_timeout: - runs-on: ubuntu-latest - if: ${{ !cancelled() }} - needs: test - steps: - - name: Clone the GitHub actions scripts - uses: actions/checkout@v4 - with: - repository: equipez/github_actions_scripts - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - path: scripts - - - name: Check whether the tests were successful or cancelled due to timeout - run: bash scripts/check_success_timeout ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} diff --git a/.github/workflows/verify_big.yml b/.github/workflows/verify_big.yml deleted file mode 100644 index 6a888ec883..0000000000 --- a/.github/workflows/verify_big.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Verification, big - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 21 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - random-seed: - description: Random Seed (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0} , seed {1}', inputs.git-ref, inputs.random-seed) || '' }} - - -jobs: - test: - name: Verify PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - dim: [big] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.verbose = true; - if ~isempty('${{ inputs.random-seed }}') - options.seed = str2num('${{ inputs.random-seed }}'); - else - copyfile('private/year_week.m', cd()); - options.seed = year_week('Asia/Shanghai'); - end - if strcmp('${{ matrix.solver }}', 'bobyqa') || strcmp('${{ matrix.solver }}', 'lincoa'), options.nr = 4; end; - options - verify('${{ matrix.solver }}', '${{ matrix.dim }}', options); - cd(root_dir); setup path; setup clean; setup uninstall % Test that `setup` works properly. - - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_verify_prima/*start* - /tmp/${{ matrix.solver }}_verify_prima/*end* diff --git a/.github/workflows/verify_large.yml b/.github/workflows/verify_large.yml deleted file mode 100644 index 6854d4c2e8..0000000000 --- a/.github/workflows/verify_large.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Verification, large - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 13 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - random-seed: - description: Random Seed (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0} , seed {1}', inputs.git-ref, inputs.random-seed) || '' }} - - -jobs: - test: - name: Verify PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - solver: [newuoa, cobyla, bobyqa, uobyqa] # With the blacklist, there is no large problem for lincoa - dim: [large] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.verbose = true; - options.nr = 5; - if strcmp('${{ matrix.solver }}', 'lincoa'), options.nr = 1; end; - options.no_classical = true; % We do not test the classical mode on "large" problems. - if ~isempty('${{ inputs.random-seed }}') - options.seed = str2num('${{ inputs.random-seed }}'); - else - copyfile('private/year_week.m', cd()); - options.seed = year_week('Asia/Shanghai'); - end - options - verify('${{ matrix.solver }}', '${{ matrix.dim }}', options); - cd(root_dir); setup path; setup clean; setup uninstall % Test that `setup` works properly. - - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_verify_prima/*start* - /tmp/${{ matrix.solver }}_verify_prima/*end* diff --git a/.github/workflows/verify_small.yml b/.github/workflows/verify_small.yml deleted file mode 100644 index f321063390..0000000000 --- a/.github/workflows/verify_small.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: Verification, small - -on: - # Trigger the workflow on push or pull request - push: - pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! - # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. - schedule: - - cron: '0 15 * * *' - # Trigger the workflow manually - workflow_dispatch: - inputs: - git-ref: - description: Git Ref (Optional) - required: false - random-seed: - description: Random Seed (Optional) - required: false - -# Show the git ref in the workflow name if it is invoked manually. -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0} , seed {1}', inputs.git-ref, inputs.random-seed) || '' }} - - -jobs: - test: - name: Verify PRIMA. - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - matlab: [latest] - solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] - dim: [small] - - steps: - - - name: Clone Repository (Latest) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref == '' - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - name: Clone Repository (Custom Ref) - uses: actions/checkout@v4 - if: github.event.inputs.git-ref != '' - with: - ref: ${{ github.event.inputs.git-ref }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - submodules: recursive - - - name: Miscellaneous setup - run: bash .github/scripts/misc_setup - - - name: Clone MatCUTEst - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS - repository: matcutest/matcutest_compiled - path: matcutest - - - name: Link gfortran for MATLAB on Linux - if: startsWith(matrix.os, 'ubuntu') - run: bash .github/scripts/link_gfortran ${{ env.GFORTRAN_VERSION }} - - - name: Check MATLAB - id: check_matlab - run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi - - - name: Cache MATLAB # N.B.: Clear the cache when the `latest` version of MATLAB changes in March and September - uses: actions/cache@v3.3.2 - with: - path: ${{ runner.tool_cache }}/MATLAB - key: ${{ matrix.os }}-${{ matrix.matlab }} - - - name: Set up MATLAB - if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} - uses: matlab-actions/setup-matlab@v2-beta - with: - release: ${{ matrix.matlab }} - - - name: Conduct the test - uses: matlab-actions/run-command@v1.2.1 - with: - command: | - ver; - root_dir = pwd(); - - cd(fullfile(root_dir, 'matcutest')); install(); which macup - - cd(fullfile(root_dir, 'matlab/tests')); - options = struct(); - options.verbose = true; - if ~isempty('${{ inputs.random-seed }}') - options.seed = str2num('${{ inputs.random-seed }}'); - else - copyfile('private/year_week.m', cd()); - options.seed = year_week('Asia/Shanghai'); - end - options - verify('${{ matrix.solver }}', '${{ matrix.dim }}', options); - cd(root_dir); setup path; setup clean; setup uninstall % Test that `setup` works properly. - - - - name: Store artifacts - uses: actions/upload-artifact@v3.1.3 - if: always() # Always run even if the workflow is canceled manually or due to overtime. - with: - path: | - /tmp/${{ matrix.solver }}_verify_prima/*start* - /tmp/${{ matrix.solver }}_verify_prima/*end* diff --git a/c/bobyqa_c.f90 b/c/bobyqa_c.f90 index 7fda8a6402..f495e6f2d5 100644 --- a/c/bobyqa_c.f90 +++ b/c/bobyqa_c.f90 @@ -13,7 +13,8 @@ module bobyqa_c_mod contains -subroutine bobyqa_c(cobj_ptr, data_ptr, n, x, f, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, info) bind(C) +subroutine bobyqa_c(cobj_ptr, data_ptr, callback_ptr, n, x, f, xl, xu, nf, rhobeg, rhoend, & + & ftarget, maxfun, npt, iprint, info) bind(C) use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_FUNPTR, C_PTR use, non_intrinsic :: cintrf_mod, only : COBJ use, non_intrinsic :: consts_mod, only : RP, IK @@ -23,6 +24,7 @@ subroutine bobyqa_c(cobj_ptr, data_ptr, n, x, f, xl, xu, nf, rhobeg, rhoend, fta ! Compulsory arguments type(C_FUNPTR), intent(IN), value :: cobj_ptr type(C_PTR), intent(in), value :: data_ptr +type(C_FUNPTR), intent(in), value :: callback_ptr integer(C_INT), intent(in), value :: n ! We cannot use assumed-shape arrays for C interoperability real(C_DOUBLE), intent(inout) :: x(n) @@ -65,7 +67,7 @@ subroutine bobyqa_c(cobj_ptr, data_ptr, n, x, f, xl, xu, nf, rhobeg, rhoend, fta ! Call the Fortran code call bobyqa(calfun, x_loc, f_loc, xl=xl_loc, xu=xu_loc, nf=nf_loc, rhobeg=rhobeg_loc, rhoend=rhoend_loc, & - & ftarget=ftarget_loc, maxfun=maxfun_loc, npt=npt_loc, iprint=iprint_loc, info=info_loc) + & ftarget=ftarget_loc, maxfun=maxfun_loc, npt=npt_loc, iprint=iprint_loc, callbck=calcb, info=info_loc) ! Write the outputs x = real(x_loc, kind(x)) @@ -89,6 +91,26 @@ subroutine calfun(x_sub, f_sub) call evalcobj(cobj_ptr, data_ptr, x_sub, f_sub) end subroutine calfun + +subroutine calcb(x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +use, non_intrinsic :: consts_mod, only : RP, IK +use, non_intrinsic :: cintrf_mod, only : evalcallback +use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_ASSOCIATED +implicit none +real(RP), intent(in) :: x_sub(:) +real(RP), intent(in) :: f_sub +integer(IK), intent(in) :: nf_sub +integer(IK), intent(in) :: tr_sub +real(RP), intent(in) :: cstrv_sub +real(RP), intent(in) :: nlconstr_sub(:) +logical, intent(out) :: terminate_sub +terminate_sub = .false. +if (C_ASSOCIATED(callback_ptr)) then + call evalcallback(callback_ptr, x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +end if +end subroutine calcb + + end subroutine bobyqa_c diff --git a/c/cintrf.f90 b/c/cintrf.f90 index f837dcc9f7..08c4ec86c9 100644 --- a/c/cintrf.f90 +++ b/c/cintrf.f90 @@ -7,7 +7,7 @@ module cintrf_mod implicit none private -public :: COBJ, COBJCON, evalcobj, evalcobjcon +public :: COBJ, COBJCON, evalcobj, evalcobjcon, evalcallback abstract interface @@ -31,6 +31,22 @@ subroutine COBJCON(x, f, constr, data_ptr) bind(c) type(C_PTR), intent(in), value :: data_ptr end subroutine COBJCON + subroutine CCALLBACK(n, x, f, nf, tr, cstrv, m_nlcon, nlconstr, terminate) bind(c) + use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_BOOL, C_INT + implicit none + integer(C_INT), intent(in), value :: n + ! We cannot use assumed-shape arrays for C interoperability + real(C_DOUBLE), intent(in) :: x(*) + real(C_DOUBLE), intent(in), value :: f + integer(C_INT), intent(in), value :: nf + integer(C_INT), intent(in), value :: tr + real(C_DOUBLE), intent(in), value :: cstrv + integer(C_INT), intent(in), value :: m_nlcon + real(C_DOUBLE), intent(in) :: nlconstr(*) + logical(C_BOOL), intent(out) :: terminate + end subroutine CCALLBACK + + end interface @@ -93,4 +109,48 @@ subroutine evalcobjcon(cobjcon_ptr, data_ptr, x, f, constr) end subroutine evalcobjcon + +subroutine evalcallback(fcb_ptr, x, f, nf, tr, cstrv, nlconstr, terminate) +use, non_intrinsic :: consts_mod, only : RP, IK +use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_FUNPTR, C_F_PROCPOINTER, C_BOOL, C_INT +implicit none +type(C_FUNPTR), intent(in) :: fcb_ptr +real(RP), intent(in) :: x(:) +real(RP), intent(in) :: f +integer(IK), intent(in) :: nf +integer(IK), intent(in) :: tr +real(RP), intent(in) :: cstrv +real(RP), intent(in) :: nlconstr(:) +logical, intent(out) :: terminate + +! Local variables +procedure(CCALLBACK), pointer :: cb_ptr +integer(C_INT) :: n_loc +real(C_DOUBLE) :: x_loc(size(x)) +real(C_DOUBLE) :: f_loc +integer(C_INT) :: nf_loc +integer(C_INT) :: tr_loc +real(C_DOUBLE) :: cstrv_loc +real(C_DOUBLE) :: nlconstr_loc(size(nlconstr)) +logical(C_BOOL) :: terminate_loc + +! Read the inputs and convert them to the types specified in CCALLBACK +n_loc = size(x) +x_loc = real(x, kind(x_loc)) +f_loc = real(f, kind(f_loc)) +nf_loc = int(nf, kind(nf_loc)) +tr_loc = int(tr, kind(tr_loc)) +cstrv_loc = real(cstrv, kind(cstrv_loc)) +nlconstr_loc = real(nlconstr, kind(nlconstr_loc)) +call C_F_PROCPOINTER(fcb_ptr, cb_ptr) + +! Call the C objective function +call cb_ptr(n_loc, x_loc, f_loc, nf_loc, tr_loc, cstrv_loc, size(nlconstr_loc), nlconstr_loc, terminate_loc) + +! Write the output +terminate = logical(terminate_loc, kind(terminate)) + +end subroutine evalcallback + + end module cintrf_mod diff --git a/c/cobyla_c.f90 b/c/cobyla_c.f90 index 3a39e1dd7b..2143af23ce 100644 --- a/c/cobyla_c.f90 +++ b/c/cobyla_c.f90 @@ -12,8 +12,8 @@ module cobyla_c_mod contains -subroutine cobyla_c(m_nlcon, cobjcon_ptr, data_ptr, n, x, f, cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, & - & nf, rhobeg, rhoend, ftarget, maxfun, iprint, info) bind(C) +subroutine cobyla_c(m_nlcon, cobjcon_ptr, data_ptr, callback_ptr, n, x, f, cstrv, nlconstr, & + & m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, iprint, info) bind(C) use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_FUNPTR, C_PTR use, non_intrinsic :: cintrf_mod, only : COBJCON use, non_intrinsic :: consts_mod, only : RP, IK @@ -24,6 +24,7 @@ subroutine cobyla_c(m_nlcon, cobjcon_ptr, data_ptr, n, x, f, cstrv, nlconstr, m_ integer(C_INT), intent(in), value :: m_nlcon type(C_FUNPTR), intent(in), value :: cobjcon_ptr type(C_PTR), intent(in), value :: data_ptr +type(C_FUNPTR), intent(in), value :: callback_ptr integer(C_INT), intent(in), value :: n ! We cannot use assumed-shape arrays for C interoperability real(C_DOUBLE), intent(inout) :: x(n) @@ -88,7 +89,7 @@ subroutine cobyla_c(m_nlcon, cobjcon_ptr, data_ptr, n, x, f, cstrv, nlconstr, m_ & Aineq=Aineq_loc, bineq=bineq_loc, Aeq=Aeq_loc, beq=beq_loc, & & xl=xl_loc, xu=xu_loc, nf=nf_loc, & & rhobeg=rhobeg_loc, rhoend=rhoend_loc, ftarget=ftarget_loc, maxfun=maxfun_loc, & - & iprint=iprint_loc, info=info_loc) + & iprint=iprint_loc, callbck=calcb, info=info_loc) ! Write the outputs x = real(x_loc, kind(x)) @@ -115,6 +116,26 @@ subroutine calcfc(x_sub, f_sub, constr_sub) call evalcobjcon(cobjcon_ptr, data_ptr, x_sub, f_sub, constr_sub) end subroutine calcfc + +subroutine calcb(x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +use, non_intrinsic :: consts_mod, only : RP, IK +use, non_intrinsic :: cintrf_mod, only : evalcallback +use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_ASSOCIATED +implicit none +real(RP), intent(in) :: x_sub(:) +real(RP), intent(in) :: f_sub +integer(IK), intent(in) :: nf_sub +integer(IK), intent(in) :: tr_sub +real(RP), intent(in) :: cstrv_sub +real(RP), intent(in) :: nlconstr_sub(:) +logical, intent(out) :: terminate_sub +terminate_sub = .false. +if (C_ASSOCIATED(callback_ptr)) then + call evalcallback(callback_ptr, x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +end if +end subroutine calcb + + end subroutine cobyla_c diff --git a/c/examples/bobyqa/bobyqa_example.c b/c/examples/bobyqa/bobyqa_example.c index 21c6a64610..c3ec536d2c 100644 --- a/c/examples/bobyqa/bobyqa_example.c +++ b/c/examples/bobyqa/bobyqa_example.c @@ -12,6 +12,15 @@ static void fun(const double x[], double *f, const void *data) (void)data; } +static void callback(int n, const double x[], double f, int nf, int tr, double cstrv, const int m_nlcon, const double nlconstr[], _Bool *terminate) +{ + (void)n; + printf("progress: x=[%g;%g] f=%g cstrv=%g nf=%d tr=%d\n", x[0], x[1], f, cstrv, nf, tr); + *terminate = 0; + (void)m_nlcon; + (void)nlconstr; +} + int main(int argc, char * argv[]) { (void)argc; @@ -29,7 +38,7 @@ int main(int argc, char * argv[]) const int npt = 2*n+1; int nf = 0; void *data = NULL; - const int rc = prima_bobyqa(&fun, data, n, x, &f, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint); + const int rc = prima_bobyqa(&fun, data, n, x, &f, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &callback); const char *msg = prima_get_rc_string(rc); printf("x*={%g, %g} rc=%d msg='%s' evals=%d\n", x[0], x[1], rc, msg, nf); return (fabs(x[0]-3)>2e-2 || fabs(x[1]-2)>2e-2); diff --git a/c/examples/cobyla/cobyla_example.c b/c/examples/cobyla/cobyla_example.c index 087fb70d5c..4048d6821f 100644 --- a/c/examples/cobyla/cobyla_example.c +++ b/c/examples/cobyla/cobyla_example.c @@ -14,6 +14,17 @@ static void fun(const double x[], double *f, double constr[], const void *data) (void)data; } + +static void callback(const int n, const double x[], const double f, const int nf, const int tr, const double cstrv, const int m_nlcon, const double nlconstr[], _Bool *terminate) +{ + (void)n; + printf("progress: x=[%g;%g] f=%g cstrv=%g nf=%d tr=%d\n", x[0], x[1], f, cstrv, nf, tr); + *terminate = 0; + (void)m_nlcon; + (void)nlconstr; +} + + int main(int argc, char * argv[]) { (void)argc; @@ -44,7 +55,7 @@ int main(int argc, char * argv[]) const int maxfun = 200*n; int nf = 0; void *data = NULL; - const int rc = prima_cobyla(m_nlcon, &fun, data, n, x, &f, &cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, iprint); + const int rc = prima_cobyla(m_nlcon, &fun, data, n, x, &f, &cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, iprint, &callback); const char *msg = prima_get_rc_string(rc); printf("x*={%g, %g} f*=%g cstrv=%g nlconstr=%g rc=%d msg='%s' evals=%d\n", x[0], x[1], f, cstrv, nlconstr[0], rc, msg, nf); return (fabs(x[0]-3)>2e-2 || fabs(x[1]-2)>2e-2); diff --git a/c/examples/lincoa/lincoa_example.c b/c/examples/lincoa/lincoa_example.c index a44dff92db..4b1de6ae14 100644 --- a/c/examples/lincoa/lincoa_example.c +++ b/c/examples/lincoa/lincoa_example.c @@ -12,6 +12,15 @@ static void fun(const double x[], double *f, const void *data) (void)data; } +static void callback(int n, const double x[], double f, int nf, int tr, double cstrv, int m_nlcon, const double nlconstr[], _Bool *terminate) +{ + (void)n; + printf("progress: x=[%g;%g] f=%g cstrv=%g nf=%d tr=%d\n", x[0], x[1], f, cstrv, nf, tr); + (void)m_nlcon; + (void)nlconstr; + *terminate = 0; +} + int main(int argc, char * argv[]) { (void)argc; @@ -41,7 +50,7 @@ int main(int argc, char * argv[]) const int npt = 2*n+1; int nf = 0; void *data = NULL; - const int rc = prima_lincoa(&fun, data, n, x, &f, &cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint); + const int rc = prima_lincoa(&fun, data, n, x, &f, &cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &callback); const char *msg = prima_get_rc_string(rc); printf("x*={%g, %g} f*=%g cstrv=%g rc=%d msg='%s' evals=%d\n", x[0], x[1], f, cstrv, rc, msg, nf); return (fabs(x[0]-3)>2e-2 || fabs(x[1]-2)>2e-2); diff --git a/c/examples/newuoa/newuoa_example.c b/c/examples/newuoa/newuoa_example.c index f844c3202b..5eaae7a1dd 100644 --- a/c/examples/newuoa/newuoa_example.c +++ b/c/examples/newuoa/newuoa_example.c @@ -12,6 +12,15 @@ static void fun(const double x[], double *f, const void *data) (void)data; } +static void callback(int n, const double x[], double f, int nf, int tr, double cstrv, int m_nlcon, const double nlconstr[], _Bool *terminate) +{ + (void)n; + printf("progress: x=[%g;%g] f=%g cstrv=%g nf=%d tr=%d\n", x[0], x[1], f, cstrv, nf, tr); + (void)m_nlcon; + (void)nlconstr; + *terminate = 0; +} + int main(int argc, char * argv[]) { (void)argc; @@ -27,7 +36,7 @@ int main(int argc, char * argv[]) const int npt = 2*n+1; int nf = 0; void *data = NULL; - const int rc = prima_newuoa(&fun, data, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint); + const int rc = prima_newuoa(&fun, data, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &callback); const char *msg = prima_get_rc_string(rc); printf("x*={%g, %g} rc=%d msg='%s' evals=%d\n", x[0], x[1], rc, msg, nf); return (fabs(x[0]-3)>2e-2 || fabs(x[1]-2)>2e-2); diff --git a/c/examples/uobyqa/uobyqa_example.c b/c/examples/uobyqa/uobyqa_example.c index d58f74ce00..75ec24cb83 100644 --- a/c/examples/uobyqa/uobyqa_example.c +++ b/c/examples/uobyqa/uobyqa_example.c @@ -12,6 +12,15 @@ static void fun(const double x[], double *f, const void *data) (void)data; } +static void callback(int n, const double x[], double f, int nf, int tr, double cstrv, const int m_nlcon, const double nlconstr[], _Bool *terminate) +{ + (void)n; + printf("progress: x=[%g;%g] f=%g cstrv=%g nf=%d tr=%d\n", x[0], x[1], f, cstrv, nf, tr); + *terminate = 0; + (void)m_nlcon; + (void)nlconstr; +} + int main(int argc, char * argv[]) { (void)argc; @@ -26,7 +35,7 @@ int main(int argc, char * argv[]) const int maxfun = 200*n; int nf = 0; void *data = NULL; - const int rc = prima_uobyqa(&fun, data, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, iprint); + const int rc = prima_uobyqa(&fun, data, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, iprint, &callback); const char *msg = prima_get_rc_string(rc); printf("x*={%g, %g} rc=%d msg='%s' evals=%d\n", x[0], x[1], rc, msg, nf); return (fabs(x[0]-3)>2e-2 || fabs(x[1]-2)>2e-2); diff --git a/c/include/prima/prima.h b/c/include/prima/prima.h index 6fce39387a..9d13b4970e 100644 --- a/c/include/prima/prima.h +++ b/c/include/prima/prima.h @@ -3,6 +3,8 @@ #ifndef PRIMA_H #define PRIMA_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -49,6 +51,7 @@ typedef enum PRIMA_NO_SPACE_BETWEEN_BOUNDS = 6, PRIMA_DAMAGING_ROUNDING = 7, PRIMA_ZERO_LINEAR_CONSTRAINT = 8, + PRIMA_USER_STOP = 9, PRIMA_INVALID_INPUT = 100, PRIMA_ASSERTION_FAILS = 101, PRIMA_VALIDATION_FAILS = 102, @@ -62,7 +65,7 @@ PRIMAC_API const char *prima_get_rc_string(int rc); /* - * A function as required by solvers + * The objective function as required by solvers * * x : on input, then vector of variables (should not be modified) * f : on output, the value of the function @@ -75,6 +78,22 @@ const char *prima_get_rc_string(int rc); typedef void (*prima_obj)(const double x[], double *f, const void *data); typedef void (*prima_objcon)(const double x[], double *f, double constr[], const void *data); +/* + * An optional callback function to report algorithm progress + * + * n : number of variables + * x : the current best point + * f : the function value of the best point + * nf : number of objective function calls + * tr : iteration number + * cstrv : the constraint value verified by the current best point + * m_nlcon : number of non-linear constraints (cobyla only) + * nlconstr : non-linear constraints values verified by the current best point (cobyla only) + * terminate : a boolean to ask from early optimization exit +*/ +typedef void (*prima_callback)(const int n, const double x[], const double f, int nf, int tr, + const double cstrv, int m_nlcon, const double nlconstr[], _Bool *terminate); + /* * calfun : function to minimize (see prima_obj) * data : user-data, will be passed through the objective function callback @@ -90,6 +109,7 @@ typedef void (*prima_objcon)(const double x[], double *f, double constr[], const * maxfun : maximum number of function evaluations * npt : number of points in the interpolation set, n+2<=npt<=(n+1)(n+2)/2, recommended: 2*n+1 * iprint : verbosity level, see the prima_message enum + * callback : progress and termination callback * m_nlcon : number of non-linear constraints (>=0) * calcfc : function to minimize and constraints (see prima_objcon) * cstrv : constraint violation (output) @@ -108,15 +128,18 @@ typedef void (*prima_objcon)(const double x[], double *f, double constr[], const PRIMAC_API int prima_bobyqa(const prima_obj calfun, const void *data, const int n, double x[], double *f, const double xl[], const double xu[], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, + const int npt, const int iprint, const prima_callback callback); PRIMAC_API int prima_newuoa(const prima_obj calfun, const void *data, const int n, double x[], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, + const int npt, const int iprint, const prima_callback callback); PRIMAC_API int prima_uobyqa(const prima_obj calfun, const void *data, const int n, double x[], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, + const int iprint, const prima_callback callback); PRIMAC_API int prima_cobyla(const int m_nlcon, const prima_objcon calcfc, const void *data, const int n, double x[], double *f, @@ -124,7 +147,8 @@ int prima_cobyla(const int m_nlcon, const prima_objcon calcfc, const void *data, const int m_ineq, const double Aineq[], const double bineq[], const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, + const int iprint, const prima_callback callback); PRIMAC_API int prima_lincoa(const prima_obj calfun, const void *data, const int n, double x[], double *f, @@ -132,7 +156,8 @@ int prima_lincoa(const prima_obj calfun, const void *data, const int n, double x const int m_ineq, const double Aineq[], const double bineq[], const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, + const int iprint, const prima_callback callback); #ifdef __cplusplus } diff --git a/c/lincoa_c.f90 b/c/lincoa_c.f90 index 72e99ef7a0..60830be860 100644 --- a/c/lincoa_c.f90 +++ b/c/lincoa_c.f90 @@ -13,7 +13,7 @@ module lincoa_c_mod contains -subroutine lincoa_c(cobj_ptr, data_ptr, n, x, f, cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, & +subroutine lincoa_c(cobj_ptr, data_ptr, callback_ptr, n, x, f, cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, & & nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, info) bind(C) use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_FUNPTR, C_PTR use, non_intrinsic :: cintrf_mod, only : COBJ @@ -24,6 +24,7 @@ subroutine lincoa_c(cobj_ptr, data_ptr, n, x, f, cstrv, m_ineq, Aineq, bineq, m_ ! Compulsory arguments type(C_FUNPTR), intent(IN), value :: cobj_ptr type(C_PTR), intent(in), value :: data_ptr +type(C_FUNPTR), intent(in), value :: callback_ptr integer(C_INT), intent(in), value :: n ! We cannot use assumed-shape arrays for C interoperability real(C_DOUBLE), intent(inout) :: x(n) @@ -87,7 +88,8 @@ subroutine lincoa_c(cobj_ptr, data_ptr, n, x, f, cstrv, m_ineq, Aineq, bineq, m_ & Aineq=Aineq_loc, bineq=bineq_loc, Aeq=Aeq_loc, beq=beq_loc, & & xl=xl_loc, xu=xu_loc, nf=nf_loc, & & rhobeg=rhobeg_loc, rhoend=rhoend_loc, & - & ftarget=ftarget_loc, maxfun=maxfun_loc, npt=npt_loc, iprint=iprint_loc, info=info_loc) + & ftarget=ftarget_loc, maxfun=maxfun_loc, npt=npt_loc, & + & iprint=iprint_loc, callbck=calcb, info=info_loc) ! Write the outputs x = real(x_loc, kind(x)) @@ -112,6 +114,26 @@ subroutine calfun(x_sub, f_sub) call evalcobj(cobj_ptr, data_ptr, x_sub, f_sub) end subroutine calfun + +subroutine calcb(x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +use, non_intrinsic :: consts_mod, only : RP, IK +use, non_intrinsic :: cintrf_mod, only : evalcallback +use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_ASSOCIATED +implicit none +real(RP), intent(in) :: x_sub(:) +real(RP), intent(in) :: f_sub +real(RP), intent(in) :: cstrv_sub +real(RP), intent(in) :: nlconstr_sub(:) +integer(IK), intent(in) :: nf_sub +integer(IK), intent(in) :: tr_sub +logical, intent(out) :: terminate_sub +terminate_sub = .false. +if (C_ASSOCIATED(callback_ptr)) then + call evalcallback(callback_ptr, x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +end if +end subroutine calcb + + end subroutine lincoa_c diff --git a/c/newuoa_c.f90 b/c/newuoa_c.f90 index b2497750e7..07b51b24a9 100644 --- a/c/newuoa_c.f90 +++ b/c/newuoa_c.f90 @@ -12,7 +12,7 @@ module newuoa_c_mod contains -subroutine newuoa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, info) bind(C) +subroutine newuoa_c(cobj_ptr, data_ptr, callback_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, info) bind(C) use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_FUNPTR, C_PTR use, non_intrinsic :: cintrf_mod, only : COBJ use, non_intrinsic :: consts_mod, only : RP, IK @@ -22,6 +22,7 @@ subroutine newuoa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, ma ! Compulsory arguments type(C_FUNPTR), intent(IN), value :: cobj_ptr type(C_PTR), intent(in), value :: data_ptr +type(C_FUNPTR), intent(in), value :: callback_ptr integer(C_INT), intent(in), value :: n ! We cannot use assumed-shape arrays for C interoperability real(C_DOUBLE), intent(inout) :: x(n) @@ -58,7 +59,7 @@ subroutine newuoa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, ma ! Call the Fortran code call newuoa(calfun, x_loc, f_loc, nf=nf_loc, rhobeg=rhobeg_loc, rhoend=rhoend_loc, ftarget=ftarget_loc, & - & maxfun=maxfun_loc, npt=npt_loc, iprint=iprint_loc, info=info_loc) + & maxfun=maxfun_loc, npt=npt_loc, iprint=iprint_loc, callbck=calcb, info=info_loc) ! Write the outputs x = real(x_loc, kind(x)) @@ -82,6 +83,25 @@ subroutine calfun(x_sub, f_sub) call evalcobj(cobj_ptr, data_ptr, x_sub, f_sub) end subroutine calfun + +subroutine calcb(x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +use, non_intrinsic :: consts_mod, only : RP, IK +use, non_intrinsic :: cintrf_mod, only : evalcallback +use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_ASSOCIATED +implicit none +real(RP), intent(in) :: x_sub(:) +real(RP), intent(in) :: f_sub +integer(IK), intent(in) :: nf_sub +integer(IK), intent(in) :: tr_sub +real(RP), intent(in) :: cstrv_sub +real(RP), intent(in) :: nlconstr_sub(:) +logical, intent(out) :: terminate_sub +terminate_sub = .false. +if (C_ASSOCIATED(callback_ptr)) then + call evalcallback(callback_ptr, x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +end if +end subroutine calcb + end subroutine newuoa_c diff --git a/c/prima.c b/c/prima.c index 101fd0af10..1ee4b0c23f 100644 --- a/c/prima.c +++ b/c/prima.c @@ -3,18 +3,19 @@ #include "prima/prima.h" /* implemented in fortran (*_c.f90) */ -int cobyla_c(const int m_nlcon, const prima_objcon calcfc, const void *data, const int n, double x[], double *f, double *cstrv, double nlconstr[], +int cobyla_c(const int m_nlcon, const prima_objcon calcfc, const void *data, const prima_callback callback, const int n, double x[], double *f, double *cstrv, double nlconstr[], const int m_ineq, const double Aineq[], const double bineq[], const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[], int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, int *info); -int bobyqa_c(prima_obj calfun, const void *data, const int n, double x[], double *f, const double xl[], const double xu[], +int bobyqa_c(prima_obj calfun, const void *data, const prima_callback callback, const int n, double x[], double *f, const double xl[], const double xu[], + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, + const int iprint, int *info); +int newuoa_c(prima_obj calfun, const void *data, const prima_callback callback, const int n, double x[], double *f, int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, int *info); -int newuoa_c(prima_obj calfun, const void *data, const int n, double x[], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, int *info); -int uobyqa_c(prima_obj calfun, const void *data, const int n, double x[], double *f, +int uobyqa_c(prima_obj calfun, const void *data, const prima_callback callback, const int n, double x[], double *f, int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, int *info); -int lincoa_c(prima_obj calfun, const void *data, const int n, double x[], double *f, +int lincoa_c(prima_obj calfun, const void *data, const prima_callback callback, const int n, double x[], double *f, double *cstrv, const int m_ineq, const double Aineq[], const double bineq[], const int m_eq, const double Aeq[], const double beq[], @@ -26,34 +27,37 @@ int prima_cobyla(const int m_nlcon, const prima_objcon calcfc, const void *data, const int m_ineq, const double Aineq[], const double bineq[], const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, + const int iprint, const prima_callback callback) { int info = 0; - cobyla_c(m_nlcon, calcfc, data, n, x, f, cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, iprint, &info); + cobyla_c(m_nlcon, calcfc, data, callback, n, x, f, cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, iprint, &info); return info; } int prima_bobyqa(const prima_obj calfun, const void *data, const int n, double x[], double *f, const double xl[], const double xu[], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, + const int iprint, const prima_callback callback) { int info = 0; - bobyqa_c(calfun, data, n, x, f, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); + bobyqa_c(calfun, data, callback, n, x, f, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); return info; } int prima_newuoa(const prima_obj calfun, const void *data, const int n, double x[], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, + const int iprint, const prima_callback callback) { int info = 0; - newuoa_c(calfun, data, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); + newuoa_c(calfun, data, callback, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); return info; } int prima_uobyqa(const prima_obj calfun, const void *data, const int n, double x[], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const prima_callback callback) { int info = 0; - uobyqa_c(calfun, data, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, iprint, &info); + uobyqa_c(calfun, data, callback, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, iprint, &info); return info; } @@ -61,10 +65,11 @@ int prima_lincoa(const prima_obj calfun, const void *data, const int n, double x const int m_ineq, const double Aineq[], const double bineq[], const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, + const int iprint, const prima_callback callback) { int info = 0; - lincoa_c(calfun, data, n, x, f, cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); + lincoa_c(calfun, data, callback, n, x, f, cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); return info; } @@ -94,6 +99,8 @@ const char *prima_get_rc_string(const int rc) return "Rounding errors are becoming damaging"; case PRIMA_ZERO_LINEAR_CONSTRAINT: return "One of the linear constraints has a zero gradient"; + case PRIMA_USER_STOP: + return "User requested end of optimization"; case PRIMA_INVALID_INPUT: return "Invalid input"; case PRIMA_ASSERTION_FAILS: diff --git a/c/tests/data.c b/c/tests/data.c index decb35e0bc..29f5844563 100644 --- a/c/tests/data.c +++ b/c/tests/data.c @@ -93,23 +93,23 @@ int main(int argc, char * argv[]) int rc = 0; if(strcmp(algo, "bobyqa") == 0) { - rc = prima_bobyqa(&fun, data_ref, n, x, &f, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint); + rc = prima_bobyqa(&fun, data_ref, n, x, &f, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint, NULL); } else if(strcmp(algo, "cobyla") == 0) { - rc = prima_cobyla(m_nlcon, &fun_con, data_ref, n, x, &f, &cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, iprint); + rc = prima_cobyla(m_nlcon, &fun_con, data_ref, n, x, &f, &cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, iprint, NULL); } else if(strcmp(algo, "lincoa") == 0) { - rc = prima_lincoa(&fun, data_ref, n, x, &f, &cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint); + rc = prima_lincoa(&fun, data_ref, n, x, &f, &cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint, NULL); } else if(strcmp(algo, "newuoa") == 0) { - rc = prima_newuoa(&fun, data_ref, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint); + rc = prima_newuoa(&fun, data_ref, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint, NULL); } else if(strcmp(algo, "uobyqa") == 0) { - rc = prima_uobyqa(&fun, data_ref, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, iprint); + rc = prima_uobyqa(&fun, data_ref, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, iprint, NULL); } else { diff --git a/c/tests/stress.c b/c/tests/stress.c index 60662220d0..85f6b107dd 100644 --- a/c/tests/stress.c +++ b/c/tests/stress.c @@ -95,6 +95,7 @@ int main(int argc, char * argv[]) const double ftarget = -INFINITY; const int iprint = PRIMA_MSG_RHO; const int maxfun = 500*n_max; + prima_callback callback = NULL; for (int j = 0; j < m_ineq_max; ++ j) bineq[j] = random_gen(-1.0, 1.0); @@ -113,29 +114,29 @@ int main(int argc, char * argv[]) if(strcmp(algo, "bobyqa") == 0) { n = 1600; - rc = prima_bobyqa(&fun, NULL, n, x, &f, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint); + rc = prima_bobyqa(&fun, NULL, n, x, &f, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint, NULL); } else if(strcmp(algo, "cobyla") == 0) { n = 800; m_ineq = 600; - rc = prima_cobyla(m_nlcon, &fun_con, NULL, n, x, &f, &cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, iprint); + rc = prima_cobyla(m_nlcon, &fun_con, NULL, n, x, &f, &cstrv, nlconstr, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, iprint, callback); } else if(strcmp(algo, "lincoa") == 0) { n = 1000; m_ineq = 1000; - rc = prima_lincoa(&fun, NULL, n, x, &f, &cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint); + rc = prima_lincoa(&fun, NULL, n, x, &f, &cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint, callback); } else if(strcmp(algo, "newuoa") == 0) { n = 1600; - rc = prima_newuoa(&fun, NULL, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint); + rc = prima_newuoa(&fun, NULL, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, 2*n+1, iprint, NULL); } else if(strcmp(algo, "uobyqa") == 0) { n = 100; - rc = prima_uobyqa(&fun, NULL, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, iprint); + rc = prima_uobyqa(&fun, NULL, n, x, &f, &nf, rhobeg, rhoend, ftarget, maxfun, iprint, NULL); } else { diff --git a/c/uobyqa_c.f90 b/c/uobyqa_c.f90 index af9b6da88a..7086e9dbb0 100644 --- a/c/uobyqa_c.f90 +++ b/c/uobyqa_c.f90 @@ -12,7 +12,7 @@ module uobyqa_c_mod contains -subroutine uobyqa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, iprint, info) bind(C) +subroutine uobyqa_c(cobj_ptr, data_ptr, callback_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, iprint, info) bind(C) use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_FUNPTR, C_PTR use, non_intrinsic :: cintrf_mod, only : COBJ use, non_intrinsic :: consts_mod, only : RP, IK @@ -22,6 +22,7 @@ subroutine uobyqa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, ma ! Compulsory arguments type(C_FUNPTR), intent(IN), value :: cobj_ptr type(C_PTR), intent(in), value :: data_ptr +type(C_FUNPTR), intent(in), value :: callback_ptr integer(C_INT), intent(in), value :: n ! We cannot use assumed-shape arrays for C interoperability real(C_DOUBLE), intent(inout) :: x(n) @@ -55,7 +56,7 @@ subroutine uobyqa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, ma ! Call the Fortran code call uobyqa(calfun, x_loc, f_loc, nf=nf_loc, rhobeg=rhobeg_loc, rhoend=rhoend_loc, ftarget=ftarget_loc, & - & maxfun=maxfun_loc, iprint=iprint_loc, info=info_loc) + & maxfun=maxfun_loc, iprint=iprint_loc, callbck=calcb, info=info_loc) ! Write the outputs x = real(x_loc, kind(x)) @@ -79,6 +80,26 @@ subroutine calfun(x_sub, f_sub) call evalcobj(cobj_ptr, data_ptr, x_sub, f_sub) end subroutine calfun + +subroutine calcb(x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +use, non_intrinsic :: consts_mod, only : RP, IK +use, non_intrinsic :: cintrf_mod, only : evalcallback +use, intrinsic :: iso_c_binding, only : C_DOUBLE, C_INT, C_ASSOCIATED +implicit none +real(RP), intent(in) :: x_sub(:) +real(RP), intent(in) :: f_sub +integer(IK), intent(in) :: nf_sub +integer(IK), intent(in) :: tr_sub +real(RP), intent(in) :: cstrv_sub +real(RP), intent(in) :: nlconstr_sub(:) +logical, intent(out) :: terminate_sub +terminate_sub = .false. +if (C_ASSOCIATED(callback_ptr)) then + call evalcallback(callback_ptr, x_sub, f_sub, nf_sub, tr_sub, cstrv_sub, nlconstr_sub, terminate_sub) +end if +end subroutine calcb + + end subroutine uobyqa_c diff --git a/fortran/bobyqa/bobyqa.f90 b/fortran/bobyqa/bobyqa.f90 index 297109a872..28fd113be4 100644 --- a/fortran/bobyqa/bobyqa.f90 +++ b/fortran/bobyqa/bobyqa.f90 @@ -38,7 +38,7 @@ module bobyqa_mod subroutine bobyqa(calfun, x, f, & & xl, xu, & - & nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, & + & nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, callbck, & & eta1, eta2, gamma1, gamma2, xhist, fhist, maxhist, honour_x0, info) !--------------------------------------------------------------------------------------------------! ! Among all the arguments, only CALFUN, X, and F are obligatory. The others are OPTIONAL and you can @@ -198,7 +198,7 @@ subroutine bobyqa(calfun, x, f, & use, non_intrinsic :: infos_mod, only : NO_SPACE_BETWEEN_BOUNDS use, non_intrinsic :: linalg_mod, only : trueloc use, non_intrinsic :: memory_mod, only : safealloc -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: preproc_mod, only : preproc use, non_intrinsic :: string_mod, only : num2str @@ -213,6 +213,7 @@ subroutine bobyqa(calfun, x, f, & real(RP), intent(out) :: f ! Optional inputs +procedure(CALLBACK), optional :: callbck integer(IK), intent(in), optional :: iprint integer(IK), intent(in), optional :: maxfun integer(IK), intent(in), optional :: maxhist @@ -414,7 +415,7 @@ subroutine bobyqa(calfun, x, f, & !-------------------- Call BOBYQB, which performs the real calculations. --------------------------! -call bobyqb(calfun, iprint_loc, maxfun_loc, npt_loc, eta1_loc, eta2_loc, ftarget_loc, & +call bobyqb(calfun, iprint_loc, callbck, maxfun_loc, npt_loc, eta1_loc, eta2_loc, ftarget_loc, & & gamma1_loc, gamma2_loc, rhobeg_loc, rhoend_loc, xl_loc, xu_loc, x, nf_loc, f, & & fhist_loc, xhist_loc, info_loc) !--------------------------------------------------------------------------------------------------! diff --git a/fortran/bobyqa/bobyqb.f90 b/fortran/bobyqa/bobyqb.f90 index d7cb78362a..6f59af4f0e 100644 --- a/fortran/bobyqa/bobyqb.f90 +++ b/fortran/bobyqa/bobyqb.f90 @@ -43,7 +43,7 @@ module bobyqb_mod contains -subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamma2, rhobeg, rhoend, & +subroutine bobyqb(calfun, iprint, callbck, maxfun, npt, eta1, eta2, ftarget, gamma1, gamma2, rhobeg, rhoend, & & xl, xu, x, nf, f, fhist, xhist, info) !--------------------------------------------------------------------------------------------------! ! This subroutine performs the major calculations of BOBYQA. @@ -82,10 +82,10 @@ subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm use, non_intrinsic :: evaluate_mod, only : evaluate use, non_intrinsic :: history_mod, only : savehist, rangehist use, non_intrinsic :: infnan_mod, only : is_nan, is_finite, is_posinf -use, non_intrinsic :: infos_mod, only : INFO_DFT, SMALL_TR_RADIUS, MAXTR_REACHED +use, non_intrinsic :: infos_mod, only : INFO_DFT, SMALL_TR_RADIUS, MAXTR_REACHED, USER_STOP use, non_intrinsic :: linalg_mod, only : norm use, non_intrinsic :: message_mod, only : retmsg, rhomsg, fmsg -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: powalg_mod, only : quadinc, calden, calvlag!, errquad use, non_intrinsic :: ratio_mod, only : redrat use, non_intrinsic :: redrho_mod, only : redrho @@ -103,6 +103,7 @@ subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm ! Inputs procedure(OBJ) :: calfun ! N.B.: INTENT cannot be specified if a dummy procedure is not a POINTER +procedure(CALLBACK), optional :: callbck integer(IK), intent(in) :: iprint integer(IK), intent(in) :: maxfun integer(IK), intent(in) :: npt @@ -150,6 +151,7 @@ subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm logical :: reduce_rho logical :: shortd logical :: small_trrad +logical :: terminate logical :: trfail logical :: ximproved real(RP) :: bmat(size(x), npt + size(x)) @@ -168,6 +170,7 @@ subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm real(RP) :: hq(size(x), size(x)) real(RP) :: moderr real(RP) :: moderr_rec(size(dnorm_rec)) +real(RP) :: nlconstr(0) real(RP) :: pq(npt) real(RP) :: qred real(RP) :: ratio @@ -271,6 +274,7 @@ subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm ! model but the geometry step is not invoked. Thus the following MAXTR is unlikely to be reached. maxtr = max(maxfun, 2_IK * maxfun) ! MAX: precaution against overflow, which will make 2*MAXFUN < 0. info = MAXTR_REACHED +terminate = .false. ! Begin the iterative procedure. ! After solving a trust-region subproblem, we use three boolean variables to control the workflow. @@ -570,6 +574,16 @@ subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm call shiftbase(kopt, xbase, xpt, zmat, bmat, pq, hq) xbase = max(xl, min(xu, xbase)) end if + + ! report progress, and ask early exit + if (present(callbck)) then + call callbck(x, f, nf, tr, 0.0_RP, nlconstr, terminate) + if (terminate) then + info = USER_STOP + exit + end if + end if + end do ! End of DO TR = 1, MAXTR. The iterative procedure ends. ! Return from the calculation, after trying the Newton-Raphson step if it has not been tried yet. diff --git a/fortran/cobyla/cobyla.f90 b/fortran/cobyla/cobyla.f90 index 01bce03cd2..68363f51f0 100644 --- a/fortran/cobyla/cobyla.f90 +++ b/fortran/cobyla/cobyla.f90 @@ -59,7 +59,7 @@ subroutine cobyla(calcfc, m_nlcon, x, f, & & Aeq, beq, & & xl, xu, & & f0, nlconstr0, & - & nf, rhobeg, rhoend, ftarget, ctol, cweight, maxfun, iprint, eta1, eta2, gamma1, gamma2, & + & nf, rhobeg, rhoend, ftarget, ctol, cweight, maxfun, iprint, callbck, eta1, eta2, gamma1, gamma2, & & xhist, fhist, chist, nlchist, maxhist, maxfilt, info) !--------------------------------------------------------------------------------------------------! ! Among all the arguments, only CALCFC, M_NLCON, X, and F are obligatory. The others are @@ -198,6 +198,9 @@ subroutine cobyla(calcfc, m_nlcon, x, f, & ! be appended to the end of this file if it already exists. ! Note that IPRINT = +/-3 can be costly in terms of time and/or space. ! +! CALLBCK +! Input, function to report progress and request termination. +! ! ETA1, ETA2, GAMMA1, GAMMA2 ! Input, REAL(RP) scalars, default: ETA1 = 0.1, ETA2 = 0.7, GAMMA1 = 0.5, and GAMMA2 = 2. ! ETA1, ETA2, GAMMA1, and GAMMA2 are parameters in the updating scheme of the trust-region radius @@ -250,6 +253,7 @@ subroutine cobyla(calcfc, m_nlcon, x, f, & ! NAN_INF_MODEL: NaN or Inf occurs in the model; ! TRSUBP_FAILED: a trust region step failed to reduce the model ! !--------------------------------------------------------------------------! +! !--------------------------------------------------------------------------------------------------! ! Common modules @@ -264,7 +268,7 @@ subroutine cobyla(calcfc, m_nlcon, x, f, & use, non_intrinsic :: infos_mod, only : INVALID_INPUT use, non_intrinsic :: linalg_mod, only : trueloc, matprod use, non_intrinsic :: memory_mod, only : safealloc -use, non_intrinsic :: pintrf_mod, only : OBJCON +use, non_intrinsic :: pintrf_mod, only : OBJCON, CALLBACK use, non_intrinsic :: selectx_mod, only : isbetter use, non_intrinsic :: preproc_mod, only : preproc use, non_intrinsic :: string_mod, only : num2str @@ -281,6 +285,7 @@ subroutine cobyla(calcfc, m_nlcon, x, f, & integer(IK), intent(in) :: m_nlcon ! Optional inputs +procedure(CALLBACK), optional :: callbck integer(IK), intent(in), optional :: iprint integer(IK), intent(in), optional :: maxfilt integer(IK), intent(in), optional :: maxfun @@ -601,7 +606,7 @@ subroutine cobyla(calcfc, m_nlcon, x, f, & !-------------------- Call COBYLB, which performs the real calculations. --------------------------! !call cobylb(calcfc_internal, iprint_loc, maxfilt_loc, maxfun_loc, ctol_loc, cweight_loc, eta1_loc, eta2_loc, & -call cobylb(calcfc, iprint_loc, maxfilt_loc, maxfun_loc, amat, bvec, ctol_loc, cweight_loc, & +call cobylb(calcfc, iprint_loc, callbck, maxfilt_loc, maxfun_loc, amat, bvec, ctol_loc, cweight_loc, & & eta1_loc, eta2_loc, ftarget_loc, gamma1_loc, gamma2_loc, rhobeg_loc, rhoend_loc, constr_loc, & & f, x, nf_loc, chist_loc, conhist_loc, cstrv_loc, fhist_loc, xhist_loc, info_loc) !--------------------------------------------------------------------------------------------------! diff --git a/fortran/cobyla/cobylb.f90 b/fortran/cobyla/cobylb.f90 index a5e5541009..1b8188b551 100644 --- a/fortran/cobyla/cobylb.f90 +++ b/fortran/cobyla/cobylb.f90 @@ -28,13 +28,13 @@ module cobylb_mod contains -subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, eta1, eta2, ftarget, & +subroutine cobylb(calcfc, iprint, callbck, maxfilt, maxfun, amat, bvec, ctol, cweight, eta1, eta2, ftarget, & & gamma1, gamma2, rhobeg, rhoend, constr, f, x, nf, chist, conhist, cstrv, fhist, xhist, info) !--------------------------------------------------------------------------------------------------! ! This subroutine performs the actual calculations of COBYLA. ! ! IPRINT, MAXFILT, MAXFUN, MAXHIST, CTOL, CWEIGHT, ETA1, ETA2, FTARGET, GAMMA1, GAMMA2, RHOBEG, -! RHOEND, X, NF, F, XHIST, FHIST, CHIST, CONHIST, CSTRV and INFO are identical to the corresponding +! RHOEND, X, NF, F, XHIST, FHIST, CHIST, CONHIST, CSTRV, INFO and CALLBCK are identical to the corresponding ! arguments in subroutine COBYLA. !--------------------------------------------------------------------------------------------------! @@ -46,10 +46,10 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et use, non_intrinsic :: evaluate_mod, only : evaluate use, non_intrinsic :: history_mod, only : savehist, rangehist use, non_intrinsic :: infnan_mod, only : is_nan, is_posinf -use, non_intrinsic :: infos_mod, only : INFO_DFT, MAXTR_REACHED, SMALL_TR_RADIUS, DAMAGING_ROUNDING +use, non_intrinsic :: infos_mod, only : INFO_DFT, MAXTR_REACHED, SMALL_TR_RADIUS, DAMAGING_ROUNDING, USER_STOP use, non_intrinsic :: linalg_mod, only : inprod, matprod, norm use, non_intrinsic :: message_mod, only : retmsg, rhomsg, fmsg -use, non_intrinsic :: pintrf_mod, only : OBJCON +use, non_intrinsic :: pintrf_mod, only : OBJCON, CALLBACK use, non_intrinsic :: ratio_mod, only : redrat use, non_intrinsic :: redrho_mod, only : redrho use, non_intrinsic :: selectx_mod, only : savefilt, selectx, isbetter @@ -69,6 +69,7 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et integer(IK), intent(in) :: maxfun real(RP), intent(in) :: amat(:, :) ! AMAT(N, M_LCON) real(RP), intent(in) :: bvec(:) ! BVEC(M_LCON) +procedure(CALLBACK), optional :: callbck real(RP), intent(in) :: ctol real(RP), intent(in) :: cweight real(RP), intent(in) :: eta1 @@ -119,6 +120,7 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et logical :: improve_geo logical :: reduce_rho logical :: shortd +logical :: terminate logical :: trfail logical :: ximproved real(RP) :: A(size(x), size(constr)) ! A contains the approximate gradient for the constraints @@ -295,6 +297,7 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et ! fails but the geometry step is not invoked. Thus the following MAXTR is unlikely to be reached. maxtr = max(maxfun, 2_IK * maxfun) ! MAX: precaution against overflow, which will make 2*MAXFUN < 0. info = MAXTR_REACHED +terminate = .false. ! Begin the iterative procedure. ! After solving a trust-region subproblem, we use three boolean variables to control the workflow. @@ -304,6 +307,7 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et ! REDUCE_RHO - Will we reduce rho after the trust-region iteration? ! COBYLA never sets IMPROVE_GEO and REDUCE_RHO to TRUE simultaneously. do tr = 1, maxtr + ! Increase the penalty parameter CPEN, if needed, so that PREREM = PREREF + CPEN * PREREC > 0. ! This is the first (out of two) update of CPEN, where CPEN increases or remains the same. ! N.B.: CPEN and the merit function PHI = FVAL + CPEN*CVAL are used at three places only. @@ -587,6 +591,15 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et end if end if ! End of IF (REDUCE_RHO). The procedure of reducing RHO ends. + ! report progress, and ask early exit + if (present(callbck)) then + call callbck(x, f, nf, tr, cstrv, constr, terminate) + if (terminate) then + info = USER_STOP + exit + end if + end if + end do ! End of DO TR = 1, MAXTR. The iterative procedure ends. ! Return from the calculation, after trying the last trust-region step if it has not been tried yet. diff --git a/fortran/common/infos.f90 b/fortran/common/infos.f90 index 72698fd48f..95344a4664 100644 --- a/fortran/common/infos.f90 +++ b/fortran/common/infos.f90 @@ -25,12 +25,12 @@ module infos_mod public :: DAMAGING_ROUNDING public :: NO_SPACE_BETWEEN_BOUNDS public :: ZERO_LINEAR_CONSTRAINT +public :: USER_STOP public :: INVALID_INPUT public :: ASSERTION_FAILS public :: VALIDATION_FAILS public :: MEMORY_ALLOCATION_FAILS - integer(IK), parameter :: INFO_DFT = 0 integer(IK), parameter :: SMALL_TR_RADIUS = 0 integer(IK), parameter :: FTARGET_ACHIEVED = 1 @@ -43,6 +43,7 @@ module infos_mod integer(IK), parameter :: NO_SPACE_BETWEEN_BOUNDS = 6 integer(IK), parameter :: DAMAGING_ROUNDING = 7 integer(IK), parameter :: ZERO_LINEAR_CONSTRAINT = 8 +integer(IK), parameter :: USER_STOP = 9 ! Stop-codes. ! The following codes are used by ERROR STOP as stop-codes, which should be default integers. diff --git a/fortran/common/pintrf.f90 b/fortran/common/pintrf.f90 index 8a610e0c60..3eb05f359f 100644 --- a/fortran/common/pintrf.f90 +++ b/fortran/common/pintrf.f90 @@ -15,7 +15,7 @@ module pintrf_mod implicit none private -public :: OBJ, OBJCON +public :: OBJ, OBJCON, CALLBACK abstract interface @@ -36,6 +36,18 @@ subroutine OBJCON(x, f, constr) real(RP), intent(out) :: constr(:) end subroutine OBJCON + subroutine CALLBACK(x, f, nf, tr, cstrv, nlconstr, terminate) + use consts_mod, only : RP, IK + implicit none + real(RP), intent(in) :: x(:) + real(RP), intent(in) :: f + integer(IK), intent(in) :: nf + integer(IK), intent(in) :: tr + real(RP), intent(in) :: cstrv + real(RP), intent(in) :: nlconstr(:) + logical, intent(out) :: terminate + end subroutine CALLBACK + end interface diff --git a/fortran/lincoa/lincoa.f90 b/fortran/lincoa/lincoa.f90 index 04198b4a8f..7776f7b5c2 100644 --- a/fortran/lincoa/lincoa.f90 +++ b/fortran/lincoa/lincoa.f90 @@ -52,7 +52,7 @@ subroutine lincoa(calfun, x, f, & & Aineq, bineq, & & Aeq, beq, & & xl, xu, & - & nf, rhobeg, rhoend, ftarget, ctol, cweight, maxfun, npt, iprint, eta1, eta2, gamma1, gamma2, & + & nf, rhobeg, rhoend, ftarget, ctol, cweight, maxfun, npt, iprint, callbck, eta1, eta2, gamma1, gamma2, & & xhist, fhist, chist, maxhist, maxfilt, info) !--------------------------------------------------------------------------------------------------! ! Among all the arguments, only CALFUN, X, and F are obligatory. The others are OPTIONAL and you can @@ -168,6 +168,9 @@ subroutine lincoa(calfun, x, f, & ! be appended to the end of this file if it already exists. ! Note that IPRINT = +/-3 can be costly in terms of time and/or space. ! +! CALLBCK +! Input, function to report progress and request termination. +! ! ETA1, ETA2, GAMMA1, GAMMA2 ! Input, REAL(RP) scalars, default: ETA1 = 0.1, ETA2 = 0.7, GAMMA1 = 0.5, and GAMMA2 = 2. ! ETA1, ETA2, GAMMA1, and GAMMA2 are parameters in the updating scheme of the trust-region radius @@ -224,7 +227,7 @@ subroutine lincoa(calfun, x, f, & use, non_intrinsic :: history_mod, only : prehist use, non_intrinsic :: infnan_mod, only : is_nan, is_finite, is_posinf use, non_intrinsic :: memory_mod, only : safealloc -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: preproc_mod, only : preproc use, non_intrinsic :: selectx_mod, only : isbetter use, non_intrinsic :: string_mod, only : num2str @@ -240,6 +243,7 @@ subroutine lincoa(calfun, x, f, & real(RP), intent(out) :: f ! Optional inputs +procedure(CALLBACK), optional :: callbck integer(IK), intent(in), optional :: iprint integer(IK), intent(in), optional :: maxfilt integer(IK), intent(in), optional :: maxfun @@ -508,7 +512,7 @@ subroutine lincoa(calfun, x, f, & call get_lincon(Aeq_loc, Aineq_loc, beq_loc, bineq_loc, rhoend_loc, xl_loc, xu_loc, x, amat, bvec) !-------------------- Call LINCOB, which performs the real calculations. --------------------------! -call lincob(calfun, iprint_loc, maxfilt_loc, maxfun_loc, npt_loc, Aeq_loc, Aineq_loc, amat, & +call lincob(calfun, iprint_loc, callbck, maxfilt_loc, maxfun_loc, npt_loc, Aeq_loc, Aineq_loc, amat, & & beq_loc, bineq_loc, bvec, ctol_loc, cweight_loc, eta1_loc, eta2_loc, ftarget_loc, gamma1_loc, & & gamma2_loc, rhobeg_loc, rhoend_loc, xl_loc, xu_loc, x, nf_loc, chist_loc, cstrv_loc, & & f, fhist_loc, xhist_loc, info_loc) diff --git a/fortran/lincoa/lincob.f90 b/fortran/lincoa/lincob.f90 index 61cbe245eb..2292e6f3d7 100644 --- a/fortran/lincoa/lincob.f90 +++ b/fortran/lincoa/lincob.f90 @@ -26,7 +26,7 @@ module lincob_mod contains -subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, bineq, bvec, & +subroutine lincob(calfun, iprint, callbck, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, bineq, bvec, & & ctol, cweight, eta1, eta2, ftarget, gamma1, gamma2, rhobeg, rhoend, xl, xu, x, nf, chist, & & cstrv, f, fhist, xhist, info) !--------------------------------------------------------------------------------------------------! @@ -78,11 +78,11 @@ subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, b use, non_intrinsic :: evaluate_mod, only : evaluate use, non_intrinsic :: history_mod, only : savehist, rangehist use, non_intrinsic :: infnan_mod, only : is_nan, is_posinf -use, non_intrinsic :: infos_mod, only : INFO_DFT, MAXTR_REACHED, SMALL_TR_RADIUS +use, non_intrinsic :: infos_mod, only : INFO_DFT, MAXTR_REACHED, SMALL_TR_RADIUS, USER_STOP use, non_intrinsic :: linalg_mod, only : matprod, maximum, eye, trueloc, linspace, norm, trueloc use, non_intrinsic :: memory_mod, only : safealloc use, non_intrinsic :: message_mod, only : fmsg, rhomsg, retmsg -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: powalg_mod, only : quadinc, omega_mul, hess_mul, updateh use, non_intrinsic :: ratio_mod, only : redrat use, non_intrinsic :: redrho_mod, only : redrho @@ -99,6 +99,7 @@ subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, b ! Inputs procedure(OBJ) :: calfun ! N.B.: INTENT cannot be specified if a dummy procedure is not a POINTER +procedure(CALLBACK), optional :: callbck integer(IK), intent(in) :: iprint integer(IK), intent(in) :: maxfilt integer(IK), intent(in) :: maxfun @@ -169,6 +170,7 @@ subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, b logical :: reduce_rho logical :: shortd logical :: small_trrad +logical :: terminate logical :: trfail logical :: ximproved real(RP) :: b(size(bvec)) @@ -190,6 +192,7 @@ subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, b real(RP) :: hq(size(x), size(x)) real(RP) :: moderr real(RP) :: moderr_alt +real(RP) :: nlconstr(0) real(RP) :: pq(npt) real(RP) :: pqalt(npt) real(RP) :: qfac(size(x), size(x)) @@ -340,6 +343,7 @@ subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, b ! model but the geometry step is not invoked. Thus the following MAXTR is unlikely to be reached. maxtr = max(maxfun, 2_IK * maxfun) ! MAX: precaution against overflow, which will make 2*MAXFUN < 0. info = MAXTR_REACHED +terminate = .false. ! Begin the iterative procedure. ! After solving a trust-region subproblem, we use three boolean variables to control the workflow. @@ -633,6 +637,16 @@ subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, b pqalt = omega_mul(idz, zmat, fval - fval(kopt)) galt = matprod(bmat(:, 1:npt), fval - fval(kopt)) + hess_mul(xpt(:, kopt), xpt, pqalt) end if + + ! report progress, and ask early exit + if (present(callbck)) then + call callbck(x, f, nf, tr, cstrv, nlconstr, terminate) + if (terminate) then + info = USER_STOP + exit + end if + end if + end do ! End of DO TR = 1, MAXTR. The iterative procedure ends. ! Return from the calculation, after trying the Newton-Raphson step if it has not been tried yet. diff --git a/fortran/newuoa/newuoa.f90 b/fortran/newuoa/newuoa.f90 index 0c1556fe70..bae6ea2c0a 100644 --- a/fortran/newuoa/newuoa.f90 +++ b/fortran/newuoa/newuoa.f90 @@ -34,7 +34,7 @@ module newuoa_mod subroutine newuoa(calfun, x, f, & - & nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, & + & nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, callbck, & & eta1, eta2, gamma1, gamma2, xhist, fhist, maxhist, info) !--------------------------------------------------------------------------------------------------! ! Among all the arguments, only CALFUN, X, and F are obligatory. The others are OPTIONAL and you can @@ -117,6 +117,9 @@ subroutine newuoa(calfun, x, f, & ! be appended to the end of this file if it already exists. ! Note that IPRINT = +/-3 can be costly in terms of time and/or space. ! +! CALLBCK +! Input, function to report progress and request termination. +! ! ETA1, ETA2, GAMMA1, GAMMA2 ! Input, REAL(RP) scalars, default: ETA1 = 0.1, ETA2 = 0.7, GAMMA1 = 0.5, and GAMMA2 = 2. ! ETA1, ETA2, GAMMA1, and GAMMA2 are parameters in the updating scheme of the trust-region radius @@ -169,7 +172,7 @@ subroutine newuoa(calfun, x, f, & use, non_intrinsic :: history_mod, only : prehist use, non_intrinsic :: infnan_mod, only : is_nan, is_finite, is_posinf use, non_intrinsic :: memory_mod, only : safealloc -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: preproc_mod, only : preproc use, non_intrinsic :: string_mod, only : num2str @@ -182,6 +185,7 @@ subroutine newuoa(calfun, x, f, & procedure(OBJ) :: calfun ! N.B.: INTENT cannot be specified if a dummy procedure is not a POINTER real(RP), intent(inout) :: x(:) real(RP), intent(out) :: f +procedure(CALLBACK), optional :: callbck integer(IK), intent(out), optional :: nf real(RP), intent(in), optional :: rhobeg real(RP), intent(in), optional :: rhoend @@ -328,7 +332,7 @@ subroutine newuoa(calfun, x, f, & !-------------------- Call NEWUOB, which performs the real calculations. --------------------------! -call newuob(calfun, iprint_loc, maxfun_loc, npt_loc, eta1_loc, eta2_loc, ftarget_loc, gamma1_loc, & +call newuob(calfun, iprint_loc, callbck, maxfun_loc, npt_loc, eta1_loc, eta2_loc, ftarget_loc, gamma1_loc, & & gamma2_loc, rhobeg_loc, rhoend_loc, x, nf_loc, f, fhist_loc, xhist_loc, info_loc) !--------------------------------------------------------------------------------------------------! diff --git a/fortran/newuoa/newuob.f90 b/fortran/newuoa/newuob.f90 index 01482865d8..1f1b338505 100644 --- a/fortran/newuoa/newuob.f90 +++ b/fortran/newuoa/newuob.f90 @@ -19,7 +19,7 @@ module newuob_mod contains -subroutine newuob(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamma2, rhobeg, & +subroutine newuob(calfun, iprint, callbck, maxfun, npt, eta1, eta2, ftarget, gamma1, gamma2, rhobeg, & & rhoend, x, nf, f, fhist, xhist, info) !--------------------------------------------------------------------------------------------------! ! This subroutine performs the actual calculations of NEWUOA. @@ -57,10 +57,10 @@ subroutine newuob(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm use, non_intrinsic :: evaluate_mod, only : evaluate use, non_intrinsic :: history_mod, only : savehist, rangehist use, non_intrinsic :: infnan_mod, only : is_nan, is_posinf -use, non_intrinsic :: infos_mod, only : INFO_DFT, MAXTR_REACHED, SMALL_TR_RADIUS +use, non_intrinsic :: infos_mod, only : INFO_DFT, MAXTR_REACHED, SMALL_TR_RADIUS, USER_STOP use, non_intrinsic :: linalg_mod, only : norm use, non_intrinsic :: message_mod, only : retmsg, rhomsg, fmsg -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: powalg_mod, only : quadinc, updateh use, non_intrinsic :: ratio_mod, only : redrat use, non_intrinsic :: redrho_mod, only : redrho @@ -76,6 +76,7 @@ subroutine newuob(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm ! Inputs procedure(OBJ) :: calfun ! N.B.: INTENT cannot be specified if a dummy procedure is not a POINTER +procedure(CALLBACK), optional :: callbck integer(IK), intent(in) :: iprint integer(IK), intent(in) :: maxfun integer(IK), intent(in) :: npt @@ -121,6 +122,7 @@ subroutine newuob(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm logical :: reduce_rho logical :: shortd logical :: small_trrad +logical :: terminate logical :: trfail logical :: ximproved real(RP) :: bmat(size(x), npt + size(x)) @@ -137,6 +139,7 @@ subroutine newuob(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm real(RP) :: hq(size(x), size(x)) real(RP) :: moderr real(RP) :: moderr_rec(size(dnorm_rec)) +real(RP) :: nlconstr(0) real(RP) :: pq(npt) real(RP) :: qred real(RP) :: ratio @@ -243,6 +246,7 @@ subroutine newuob(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm ! model but the geometry step is not invoked. Thus the following MAXTR is unlikely to be reached. maxtr = max(maxfun, 2_IK * maxfun) ! MAX: precaution against overflow, which will make 2*MAXFUN < 0. info = MAXTR_REACHED +terminate = .false. ! Begin the iterative procedure. ! After solving a trust-region subproblem, we use three boolean variables to control the workflow. @@ -574,6 +578,16 @@ subroutine newuob(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm if (sum(xpt(:, kopt)**2) >= 1.0E2_RP * delta**2) then ! 1.0E2 works better than 1.0E3 on 20230227. call shiftbase(kopt, xbase, xpt, zmat, bmat, pq, hq, idz) end if + + ! report progress, and ask early exit + if (present(callbck)) then + call callbck(x, f, nf, tr, 0.0_RP, nlconstr, terminate) + if (terminate) then + info = USER_STOP + exit + end if + end if + end do ! End of DO TR = 1, MAXTR. The iterative procedure ends. ! Return from the calculation, after trying the Newton-Raphson step if it has not been tried yet. diff --git a/fortran/uobyqa/uobyqa.f90 b/fortran/uobyqa/uobyqa.f90 index 5d71145f84..f9646f87c6 100644 --- a/fortran/uobyqa/uobyqa.f90 +++ b/fortran/uobyqa/uobyqa.f90 @@ -31,7 +31,7 @@ module uobyqa_mod subroutine uobyqa(calfun, x, f, & - & nf, rhobeg, rhoend, ftarget, maxfun, iprint, eta1, eta2, gamma1, gamma2, & + & nf, rhobeg, rhoend, ftarget, maxfun, iprint, callbck, eta1, eta2, gamma1, gamma2, & & xhist, fhist, maxhist, info) !--------------------------------------------------------------------------------------------------! ! Among all the arguments, only CALFUN, X, and F are obligatory. The others are OPTIONAL and you can @@ -109,6 +109,9 @@ subroutine uobyqa(calfun, x, f, & ! be appended to the end of this file if it already exists. ! Note that IPRINT = +/-3 can be costly in terms of time and/or space. ! +! CALLBCK +! Input, function to report progress and request termination. +! ! ETA1, ETA2, GAMMA1, GAMMA2 ! Input, REAL(RP) scalars, default: ETA1 = 0.1, ETA2 = 0.7, GAMMA1 = 0.5, and GAMMA2 = 2. ! ETA1, ETA2, GAMMA1, and GAMMA2 are parameters in the updating scheme of the trust-region radius @@ -161,7 +164,7 @@ subroutine uobyqa(calfun, x, f, & use, non_intrinsic :: history_mod, only : prehist use, non_intrinsic :: infnan_mod, only : is_nan, is_finite use, non_intrinsic :: memory_mod, only : safealloc -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: preproc_mod, only : preproc use, non_intrinsic :: string_mod, only : num2str @@ -172,6 +175,7 @@ subroutine uobyqa(calfun, x, f, & ! Arguments procedure(OBJ) :: calfun ! N.B.: INTENT cannot be specified if a dummy procedure is not a POINTER +procedure(CALLBACK), optional :: callbck real(RP), intent(inout) :: x(:) ! X(N) real(RP), intent(out) :: f integer(IK), intent(out), optional :: nf @@ -311,7 +315,7 @@ subroutine uobyqa(calfun, x, f, & !-------------------- Call UOBYQB, which performs the real calculations. --------------------------! -call uobyqb(calfun, iprint_loc, maxfun_loc, eta1_loc, eta2_loc, ftarget_loc, gamma1_loc, & +call uobyqb(calfun, iprint_loc, callbck, maxfun_loc, eta1_loc, eta2_loc, ftarget_loc, gamma1_loc, & & gamma2_loc, rhobeg_loc, rhoend_loc, x, nf_loc, f, fhist_loc, xhist_loc, info_loc) !--------------------------------------------------------------------------------------------------! diff --git a/fortran/uobyqa/uobyqb.f90 b/fortran/uobyqa/uobyqb.f90 index 2917434841..78f2516d48 100644 --- a/fortran/uobyqa/uobyqb.f90 +++ b/fortran/uobyqa/uobyqb.f90 @@ -19,7 +19,7 @@ module uobyqb_mod contains -subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, rhobeg, rhoend, & +subroutine uobyqb(calfun, iprint, callbck, maxfun, eta1, eta2, ftarget, gamma1, gamma2, rhobeg, rhoend, & & x, nf, f, fhist, xhist, info) !--------------------------------------------------------------------------------------------------! ! This subroutine performs the major calculations of UOBYQA. @@ -50,11 +50,11 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r use, non_intrinsic :: evaluate_mod, only : evaluate use, non_intrinsic :: history_mod, only : savehist, rangehist use, non_intrinsic :: infnan_mod, only : is_nan, is_posinf -use, non_intrinsic :: infos_mod, only : INFO_DFT, SMALL_TR_RADIUS, MAXTR_REACHED +use, non_intrinsic :: infos_mod, only : INFO_DFT, SMALL_TR_RADIUS, MAXTR_REACHED, USER_STOP use, non_intrinsic :: linalg_mod, only : vec2smat, smat_mul_vec, norm use, non_intrinsic :: memory_mod, only : safealloc use, non_intrinsic :: message_mod, only : fmsg, rhomsg, retmsg -use, non_intrinsic :: pintrf_mod, only : OBJ +use, non_intrinsic :: pintrf_mod, only : OBJ, CALLBACK use, non_intrinsic :: powalg_mod, only : quadinc use, non_intrinsic :: ratio_mod, only : redrat use, non_intrinsic :: redrho_mod, only : redrho @@ -70,6 +70,7 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r ! Inputs procedure(OBJ) :: calfun ! N.B.: INTENT cannot be specified if a dummy procedure is not a POINTER +procedure(CALLBACK), optional :: callbck integer(IK), intent(in) :: iprint integer(IK), intent(in) :: maxfun real(RP), intent(in) :: eta1 @@ -112,6 +113,7 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r logical :: reduce_rho logical :: shortd logical :: small_trrad +logical :: terminate logical :: trfail logical :: ximproved real(RP) :: crvmin @@ -128,6 +130,7 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r real(RP) :: h(size(x), size(x)) real(RP) :: moderr real(RP) :: moderr_rec(size(dnorm_rec)) +real(RP) :: nlconstr(0) real(RP) :: pq(size(distsq) - 1) real(RP) :: qred real(RP) :: ratio @@ -220,6 +223,7 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r ! model but the geometry step is not invoked. Thus the following MAXTR is unlikely to be reached. maxtr = max(maxfun, 2_IK * maxfun) ! MAX: precaution against overflow, which will make 2*MAXFUN < 0. info = MAXTR_REACHED +terminate = .false. ! Begin the iterative procedure. ! After solving a trust-region subproblem, we use three boolean variables to control the workflow. @@ -458,6 +462,15 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r if (sum(xpt(:, kopt)**2) >= 1.0E3_RP * delta**2) then call shiftbase(kopt, pl, pq, xbase, xpt) end if + + ! report progress, and ask early exit + if (present(callbck)) then + call callbck(x, f, nf, tr, 0.0_RP, nlconstr, terminate) + if (terminate) then + info = USER_STOP + exit + end if + end if end do ! End of DO TR = 1, MAXTR. The iterative procedure ends. ! Deallocate PL. F2003 automatically deallocate local ALLOCATABLE variables at exit, yet we prefer