Skip to content

Commit

Permalink
230112.005017.CST deprecate some old features in the matlab code
Browse files Browse the repository at this point in the history
Former-commit-id: f2aa1515587b0c13148123ec981d0bf55f919ca7 [formerly 80e1e6a9e60d99b68e15dc17e9e1d3b36c3eadfe]
Former-commit-id: 7df1eb6fdd0eed7a41b8cc75e76deeae85164516
  • Loading branch information
zaikunzhang committed Jan 11, 2023
1 parent 19e77cb commit be75209
Show file tree
Hide file tree
Showing 16 changed files with 132 additions and 155 deletions.
51 changes: 39 additions & 12 deletions .github/scripts/install_oneapi_macos.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,47 @@
#!/bin/bash

# SPDX-FileCopyrightText: 2020 Intel Corporation
# This script installs the Fortran compilers ifort and ifx provided in Intel OneAPI.
# See https://github.com/oneapi-src/oneapi-ci
# https://github.com/oneapi-src/oneapi-ci/blob/master/scripts/install_macos.sh
#
# SPDX-License-Identifier: MIT
# Zaikun Zhang (www.zhangzk.net), January 9, 2023

# URL for the offline installer of Intel OneAPI Fortran compiler. See
# https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html
# Default: 2023.0.0
URL="https://registrationcenter-download.intel.com/akdlm/irc_nas/19106/m_fortran-compiler-classic_p_2023.0.0.25379_offline.dmg"
if [[ $# -ge 1 ]] ; then
if [[ $1 = "2022" ]] ; then
URL="https://registrationcenter-download.intel.com/akdlm/irc_nas/18977/m_HPCKit_p_2022.3.1.15344_offline.dmg"
fi
if [[ $1 = "2021" ]] ; then
URL="https://registrationcenter-download.intel.com/akdlm/irc_nas/18242/m_HPCKit_p_2021.4.0.3389_offline.dmg"
fi
fi

URL=$1
COMPONENTS=$2
# Component to install.
COMPONENTS=intel.oneapi.mac.ifort-compiler

# Download the installer. curl is included by default in macOS.
cd "$TMPDIR" || exit 42
curl --output webimage.dmg --url "$URL" --retry 5 --retry-delay 5
hdiutil attach webimage.dmg
if [ -z "$COMPONENTS" ]; then
sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
installer_exit_code=$?
else
sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --log-dir=.
installer_exit_code=$?
fi

# Install the compiler.
/Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --log-dir=.
installer_exit_code=$?

# Run the script that sets the environment variables.
source /opt/intel/oneapi/setvars.sh

# Show the result of the installation.
echo "The latest ifort installed is:"
ifort --version
echo "The path to ifort is:"
command -v ifort

# Remove the installer
rm webimage.dmg
hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet

# Exit with the installer exit code.
exit $installer_exit_code
53 changes: 41 additions & 12 deletions .github/scripts/install_oneapi_windows.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
REM SPDX-FileCopyrightText: 2020 Intel Corporation
REM
REM SPDX-License-Identifier: MIT
:: This script installs the Fortran compilers ifort and ifx provided in Intel OneAPI.
:: See https://github.com/oneapi-src/oneapi-ci
:: https://github.com/oneapi-src/oneapi-ci/blob/master/scripts/install_windows.bat
::
:: Zaikun Zhang (www.zhangzk.net), January 9, 2023

set URL=%1
set COMPONENTS=%2
:: URL for the offline installer of Intel OneAPI Fortran compiler. See
:: https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html
:: Default version: 2023.0.0
set URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/19107/w_fortran-compiler_p_2023.0.0.25579_offline.exe
if "%1"=="2022" (
set URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18976/w_HPCKit_p_2022.3.1.19755_offline.exe
)
if "%1"=="2021" (
set URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18247/w_HPCKit_p_2021.4.0.3340_offline.exe
)
::set URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17940/w_HPCKit_p_2021.3.0.3227_offline.exe
::set URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17762/w_HPCKit_p_2021.2.0.2901_offline.exe
::set URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17392/w_HPCKit_p_2021.1.0.2682_offline.exe

echo %URL%
echo %COMPONENTS%
:: Component to install.
set COMPONENTS=intel.oneapi.win.ifort-compiler

:: Download the installer. curl is included by default in Windows since Windows 10, version 1803.
::cd %Temp% :: CD does not work if %Temp% is on a different drive.
curl.exe --output webimage.exe --url %URL% --retry 5 --retry-delay 5
start /b /wait webimage.exe -s -x -f webimage_extracted --log extract.log

:: Install the compiler.
webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=.
set installer_exit_code=%ERRORLEVEL%

:: Run the script that sets the environment variables.
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"

:: Show the result of the installation.
echo The path to ifort is:
where ifort.exe
echo The path to ifx is:
where ifx.exe

:: Remove the installer.
del webimage.exe
if "%COMPONENTS%"=="" (
webimage_extracted\bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 --log-dir=.
) else (
webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 --log-dir=.
)
rd /s/q "webimage_extracted"

:: Exit with the installer exit code.
exit /b %installer_exit_code%
2 changes: 1 addition & 1 deletion .github/workflows/time → .github/workflows/schedule
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ profile_lincoa_small.yml: - push
primalib/PRIMA:
profile_all.yml: - cron: '0 16 * * *'
verify_base.yml: - cron: '0 17 * * *'
test_matlab.yml: - cron: '0 1, * * *'
test_matlab.yml: - cron: '0 1, * * *', push
test_g95.yml: - cron: '0 5 * * *'
test_sunf95.yml: - cron: '0 7 * * *'
test_aflang.yml: - cron: '0 4 1-31/3 * *'
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test_ifx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ jobs:
if [[ "$RUNNER_OS" != "Windows" ]]; then
cd "$ROOT"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all
cd $ROOT/fortran/tests
if [[ -f test_bobyqa.f90 ]]; then
sed -i 's|800|400|g' test_bobyqa.f90
fi
sed -i 's|800|500|g' test_*.f90
sed -i 's|800|400|g' test_*.f90
export FFLAGS=${{ matrix.fflags }} && export TESTDIM=${{ matrix.testdim }} && make xtest_${{ matrix.ikind }}.${{ matrix.solver }}
fi
cd $ROOT/fortran/examples/${{ matrix.solver }} && make xtest
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/test_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test MATLAB

on:
# Trigger the workflow on push or pull request
#push:
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:
Expand All @@ -12,20 +12,7 @@ on:

env:
MATLAB_RELEASE: latest
MACOS_FORTRAN_COMPONENTS: intel.oneapi.mac.ifort-compiler
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
# The following version specifications work for MATLAB 2022b. Do not change them until they stop working.
# See https://github.com/matlab-actions/setup-matlab/issues/29#issuecomment-1048390901
# https://www.mathworks.com/support/requirements/supported-compilers.html
# https://github.com/zequipe/test_matlab/actions/workflows/test_compiler.yml
# For Linux
GFORTRAN_VERSION: 11
# For macOS
MACOS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18341/m_HPCKit_p_2022.1.0.86_offline.dmg
#https://registrationcenter-download.intel.com/akdlm/IRC_NAS/19086/m_HPCKit_p_2023.0.0.25440_offline.dmg
# For Windows 2019
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18497/w_BaseKit_p_2022.1.2.154_offline.exe
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18529/w_HPCKit_p_2022.1.2.116_offline.exe

jobs:
test:
Expand All @@ -35,7 +22,6 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2019] # MEX Fortran does not work on windows-latest yet
bitness: [32, 64]

steps:
- name: Check out repository
Expand Down
51 changes: 0 additions & 51 deletions matlab/interfaces/private/mystrjoin.m

This file was deleted.

2 changes: 1 addition & 1 deletion matlab/interfaces/private/package_info.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
if (length(callstack) == 1 || ~ismember(callstack(2).name, invoker_list))
% Private/unexpected error
error(sprintf('%s:InvalidInvoker', funname), ...
'%s: UNEXPECTED ERROR: %s should only be called by %s.', funname, funname, mystrjoin(invoker_list, ', '));
'%s: UNEXPECTED ERROR: %s should only be called by %s.', funname, funname, strjoin(invoker_list, ', '));
else
invoker = callstack(2).name; % Name of the function who calls this function
end
Expand Down
8 changes: 4 additions & 4 deletions matlab/interfaces/private/postprima.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
if (length(callstack) == 1) || ~ismember(callstack(2).name, invoker_list)
% Private/unexpected error
error(sprintf('%s:InvalidInvoker', funname), ...
'%s: UNEXPECTED ERROR: %s should only be called by %s.', funname, funname, mystrjoin(invoker_list, ', '));
'%s: UNEXPECTED ERROR: %s should only be called by %s.', funname, funname, strjoin(invoker_list, ', '));
else
invoker = callstack(2).name; % Name of the function who calls this function
end
Expand All @@ -74,7 +74,7 @@
if ~isempty(missing_fields)
% Public/unexpected error
error(sprintf('%s:InvalidProbinfo', invoker),...
'%s: UNEXPECTED ERROR: probinfo misses the %s field(s).', invoker, mystrjoin(missing_fields, ', '));
'%s: UNEXPECTED ERROR: probinfo misses the %s field(s).', invoker, strjoin(missing_fields, ', '));
end

% Read and verify options
Expand All @@ -88,7 +88,7 @@
if ~isempty(missing_fields)
% Public/unexpected error
error(sprintf('%s:InvalidOptions', invoker),...
'%s: UNEXPECTED ERROR: options misses the %s field(s).', invoker, mystrjoin(missing_fields, ', '));
'%s: UNEXPECTED ERROR: options misses the %s field(s).', invoker, strjoin(missing_fields, ', '));
end
end

Expand Down Expand Up @@ -127,7 +127,7 @@
if ~isempty(missing_fields)
% Public/unexpected error
error(sprintf('%s:InvalidOutput', invoker),...
'%s: UNEXPECTED ERROR: %s returns an output that misses the %s field(s).', invoker, solver, mystrjoin(missing_fields, ', '));
'%s: UNEXPECTED ERROR: %s returns an output that misses the %s field(s).', invoker, solver, strjoin(missing_fields, ', '));
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
20 changes: 10 additions & 10 deletions matlab/interfaces/private/preprima.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
if (length(callstack) == 1 || ~ismember(callstack(2).name, invoker_list))
% Private/unexpected error
error(sprintf('%s:InvalidInvoker', funname), ...
'%s: UNEXPECTED ERROR: %s should only be called by %s.', funname, funname, mystrjoin(invoker_list, ', '));
'%s: UNEXPECTED ERROR: %s should only be called by %s.', funname, funname, strjoin(invoker_list, ', '));
else
invoker = callstack(2).name; % Name of the function who calls this function
end
Expand Down Expand Up @@ -367,7 +367,7 @@
% again, even though it should have been checked in function preprima
% Private/unexpcted error
error(sprintf('%s:InvalidInvoker', funname), ...
'%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, mystrjoin(invoker_list, ', '));
'%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, strjoin(invoker_list, ', '));
end

if ~isa(problem, 'struct')
Expand All @@ -385,7 +385,7 @@
if ~isempty(missing_fields)
% Public/normal error
error(sprintf('%s:InvalidProb', invoker), ...
'%s: PROBLEM misses the %s field(s).', invoker, mystrjoin(missing_fields, ', '));
'%s: PROBLEM misses the %s field(s).', invoker, strjoin(missing_fields, ', '));
end
x0 = problem.x0;

Expand All @@ -411,9 +411,9 @@
if ~isempty(unknown_fields)
wid = sprintf('%s:UnknownProbField', invoker);
if length(unknown_fields) == 1
wmsg = sprintf('%s: problem with an unknown field %s; it is ignored.', invoker, mystrjoin(unknown_fields, ', '));
wmsg = sprintf('%s: problem with an unknown field %s; it is ignored.', invoker, strjoin(unknown_fields, ', '));
else
wmsg = sprintf('%s: problem with unknown fields %s; they are ignored.', invoker, mystrjoin(unknown_fields, ', '));
wmsg = sprintf('%s: problem with unknown fields %s; they are ignored.', invoker, strjoin(unknown_fields, ', '));
end
warning(wid, '%s', wmsg);
warnings = [warnings, wmsg];
Expand Down Expand Up @@ -796,7 +796,7 @@
if ~ismember(invoker, invoker_list)
% Private/unexpcted error
error(sprintf('%s:InvalidInvoker', funname), ...
'%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, mystrjoin(invoker_list, ', '));
'%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, strjoin(invoker_list, ', '));
end

% Default values of the options.
Expand Down Expand Up @@ -922,9 +922,9 @@
if ~isempty(unknown_fields)
wid = sprintf('%s:UnknownOption', invoker);
if length(unknown_fields) == 1
wmsg = sprintf('%s: unknown option %s; it is ignored.', invoker, mystrjoin(unknown_fields, ', '));
wmsg = sprintf('%s: unknown option %s; it is ignored.', invoker, strjoin(unknown_fields, ', '));
else
wmsg = sprintf('%s: unknown options %s; they are ignored.', invoker, mystrjoin(unknown_fields, ', '));
wmsg = sprintf('%s: unknown options %s; they are ignored.', invoker, strjoin(unknown_fields, ', '));
end
warning(wid, '%s', wmsg);
warnings = [warnings, wmsg];
Expand Down Expand Up @@ -1685,7 +1685,7 @@
if ~ismember(invoker, invoker_list)
% Private/unexpected error
error(sprintf('%s:InvalidInvoker', funname), ...
'%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, mystrjoin(invoker_list, ', '));
'%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, strjoin(invoker_list, ', '));
end
% After pre_options, options.solver is either a member of solver_list
% or '' (i.e., an empty char array), the second signifying the solver
Expand Down Expand Up @@ -1876,7 +1876,7 @@

if ~ismember(lower(options.solver), solver_list)
% Private/unexpcted error
error(sprintf('%s:InvalidSolver', funname), '%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, mystrjoin(solver_list, ', '));
error(sprintf('%s:InvalidSolver', funname), '%s: UNEXPECTED ERROR: %s serves only %s.', funname, funname, strjoin(solver_list, ', '));
end

if isfield(options, 'honour_x0') && options.honour_x0 % In this case, we respect the user-defined x0 and revise rhobeg
Expand Down
Loading

0 comments on commit be75209

Please sign in to comment.