summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Phinikarides2023-08-12 20:49:58 +0300
committerAlexander Phinikarides2023-08-12 20:49:58 +0300
commitc28f8e5bafeb878d048e2b076cc814d5c78120f6 (patch)
tree5643352b00794eda28aed4c8a24dbd4e50656a53
parentd3ccaa77240a34f6fd64facf25a48b2f89137ed5 (diff)
downloadaur-c28f8e5bafeb878d048e2b076cc814d5c78120f6.tar.gz
update deps and build
-rw-r--r--.SRCINFO24
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD111
-rwxr-xr-xmklvars.sh229
-rwxr-xr-xvars.sh270
5 files changed, 346 insertions, 292 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b101fe366f92..92927a2d8ac8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,17 @@
pkgbase = r-mkl
pkgdesc = Language and environment for statistical computing and graphics, linked to the Intel(R) MKL.
pkgver = 4.3.1
- pkgrel = 3
+ pkgrel = 4
url = http://www.r-project.org/
install = r-mkl.install
arch = x86_64
license = GPL
- makedepends = java-environment
+ makedepends = jdk-openjdk
makedepends = gcc-fortran
- makedepends = texlive-latex
makedepends = texlive-latexrecommended
+ makedepends = texlive-fontsrecommended
makedepends = tk
- depends = intel-mkl
+ depends = intel-oneapi-mkl
depends = bzip2
depends = curl
depends = icu
@@ -27,10 +27,11 @@ pkgbase = r-mkl
depends = perl
depends = readline
depends = unzip
+ depends = which
depends = xz
depends = zip
depends = zlib
- optdepends = texlive-bin: LaTeX sty files
+ optdepends = texlive-latex: LaTeX sty files
optdepends = gcc-fortran: needed to compile some CRAN packages
optdepends = tk: tcl-tk interface
provides = r=4.3.1
@@ -46,11 +47,12 @@ pkgbase = r-mkl
source = r.desktop
source = r.png
source = R.conf
- source = mklvars.sh
- sha1sums = bf5d4d3d9f8dd6380a6a4e17c5732db94de301a0
- sha1sums = dd214eee232b7aced7366722ad416b6b39be8e1b
- sha1sums = af80774f5a8d0e669e8ff90662638a0f4e1105d7
- sha1sums = 43668da6cfd1b4455a99f23e79e2059294dddac9
- sha1sums = 2cc0e30ca5de872ea7f5af417b8cac988f3e9f8e
+ source = vars.sh
+ sha256sums = 8dd0bf24f1023c6f618c3b317383d291b4a494f40d73b983ac22ffea99e4ba99
+ sha256sums = 25b01ea93fa704884b65ba002d44d4e99725bd826997e8c73b6467df9f23c798
+ sha256sums = 82e3f55f9954dd89700605362fea8bb3589ff09fa9a442b09cbd5f249407e7e0
+ sha256sums = b7833166041b06f716b6a79095d27d4abd83549816dc53193213827139eae6ef
+ sha256sums = f14c5efb017f970363ddc7509960b7f04f9942074d82ef7567ecd41313bf0aeb
pkgname = r-mkl
+ provides = r=4.3.1
diff --git a/.gitignore b/.gitignore
index c001a21f8f37..5466c9a8e446 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
*.gz
*.xz
*.lzo
-
+*.zst
+src/
+pkg/
diff --git a/PKGBUILD b/PKGBUILD
index c336556a6ca5..aa13508286b8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,14 +5,14 @@
pkgname=r-mkl
pkgver=4.3.1
-pkgrel=3
+pkgrel=4
pkgdesc="Language and environment for statistical computing and graphics, linked to the Intel(R) MKL."
arch=('x86_64')
license=('GPL')
url='http://www.r-project.org/'
provides=("r=${pkgver}")
conflicts=('r' 'microsoft-r-open')
-depends=('intel-mkl'
+depends=('intel-oneapi-mkl'
'bzip2'
'curl'
'icu'
@@ -28,15 +28,16 @@ depends=('intel-mkl'
'perl'
'readline'
'unzip'
+ 'which'
'xz'
'zip'
'zlib')
-makedepends=('java-environment'
+makedepends=('jdk-openjdk'
'gcc-fortran'
- 'texlive-latex'
'texlive-latexrecommended'
+ 'texlive-fontsrecommended'
'tk')
-optdepends=('texlive-bin: LaTeX sty files'
+optdepends=('texlive-latex: LaTeX sty files'
'gcc-fortran: needed to compile some CRAN packages'
'tk: tcl-tk interface')
backup=('etc/R/Makeconf'
@@ -51,23 +52,22 @@ source=("http://cran.r-project.org/src/base/R-${pkgver%%.*}/R-${pkgver}.tar.gz"
'r.desktop'
'r.png'
'R.conf'
- 'mklvars.sh')
+ 'vars.sh')
-sha1sums=('bf5d4d3d9f8dd6380a6a4e17c5732db94de301a0'
- 'dd214eee232b7aced7366722ad416b6b39be8e1b'
- 'af80774f5a8d0e669e8ff90662638a0f4e1105d7'
- '43668da6cfd1b4455a99f23e79e2059294dddac9'
- '2cc0e30ca5de872ea7f5af417b8cac988f3e9f8e')
+sha256sums=('8dd0bf24f1023c6f618c3b317383d291b4a494f40d73b983ac22ffea99e4ba99'
+ '25b01ea93fa704884b65ba002d44d4e99725bd826997e8c73b6467df9f23c798'
+ '82e3f55f9954dd89700605362fea8bb3589ff09fa9a442b09cbd5f249407e7e0'
+ 'b7833166041b06f716b6a79095d27d4abd83549816dc53193213827139eae6ef'
+ 'f14c5efb017f970363ddc7509960b7f04f9942074d82ef7567ecd41313bf0aeb')
# Build with the Intel Compiler Suite or GCC/GFortran.
# Comment the following line to build the package with GCC
-# _CC="icc"
+# _CC="icx"
# update dependencies w.r.t the compiler used
-if [[ $_CC = "icc" ]]; then
- depends+=('intel-compiler-base'
- 'intel-fortran-compiler'
- 'intel-openmp')
+if [[ $_CC = "icx" ]]; then
+ depends+=('intel-oneapi-dpcpp-cpp'
+ 'intel-oneapi-openmp')
fi
@@ -75,42 +75,41 @@ prepare() {
cd R-${pkgver}
# set texmf dir correctly in makefile
sed -i 's|$(rsharedir)/texmf|${datarootdir}/texmf|' share/Makefile.in
- # align mklvars.sh with Arch Linux intel-mkl
+ # align vars.sh with Arch Linux intel-oneapi-mkl
cd ..
- sed -i 's|CPRO_PATH=/opt/intel/compilers.*$|CPRO_PATH=/opt/intel|g' mklvars.sh
+ sed -i 's|CPRO_PATH=/opt/intel/compilers.*$|CPRO_PATH=/opt/intel|g' vars.sh
}
build() {
cd R-${pkgver}
- # https://software.intel.com/sites/products/mkl/mkl_link_line_advisor.htm
+ # https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html
# Interface Layer: LP64 (R uses 32-bit integers)
_intel_arch=intel64
- _intel_lib=mkl_intel_lp64
- _gfortran_lib=mkl_gf_lp64
+ _mkl_interface=lp64
+ _intel_lib=mkl_intel_${_mkl_interface}
+ _gfortran_lib=mkl_gf_${_mkl_interface}
# Set up the environment for MKL
+ source /etc/profile.d/intel-oneapi-mkl.sh
if [ -z ${MKLROOT+x} ]; then
echo -e "\nError: MKLROOT is unset\n"
exit
fi
- if [ -f /opt/intel/mkl/bin/mklvars.sh ]; then
- echo "Sourcing /opt/intel/mkl/bin/mklvars.sh"
- source /opt/intel/mkl/bin/mklvars.sh ${_intel_arch}
- elif [ -f /usr/bin/mklvars.sh ]; then
- echo "Sourcing /usr/bin/mklvars.sh"
- source /usr/bin/mklvars.sh ${_intel_arch}
+ if [ -f ${MKLROOT}/env/vars.sh ]; then
+ echo "Sourcing ${MKLROOT}/env/vars.sh"
+ source ${MKLROOT}/env/vars.sh ${_intel_arch} ${_mkl_interface} verbose
else
- echo "Sourcing mklvars.sh"
- source ../mklvars.sh ${_intel_arch}
+ echo "Sourcing local vars.sh"
+ source ../vars.sh ${_intel_arch} ${_mkl_interface} verbose
fi
- if [[ $_CC = "icc" ]]; then
- source ${MKLROOT}/../bin/compilervars.sh ${_intel_arch}
- _intel_cc_opt=" -O3 -fPIC -m64 -march=native -fp-model precise -fp-model source -I${MKLROOT}/include"
- # export LDFLAGS=" -qopenmp"
+ if [[ $_CC = "icx" ]]; then
+ source ${MKLROOT}/../../compiler/latest/env/vars.sh ${_intel_arch}
+ _intel_cc_opt=" -O3 -xhost -fPIC -fp-model precise -fp-model source -I${MKLROOT}/include"
+ # export LDFLAGS=" -fiopenmp"
export FLIBS=" -lgfortran -lifcore -lifport"
# Dynamic Linking
@@ -123,18 +122,19 @@ build() {
-lm \
-ldl"
- export CC="icc"
- export CXX="icpc"
+ export CC="icx"
+ export CXX="icpx"
export AR="xiar"
export LD="xild"
- export F77="ifort"
- export FC="ifort"
+ export F77="ifx"
+ export FC="ifx"
export CFLAGS="${_intel_cc_opt}"
export CXXFLAGS="${_intel_cc_opt}"
export FFLAGS="${_intel_cc_opt}"
export FCFLAGS="${_intel_cc_opt}"
else
- _gcc_opt=" -m64 -I${MKLROOT}/include"
+ # -ffat-lto-objects is needed for third-party packages shipping static libraries
+ _gcc_opt=" -m64 -ffat-lto-objects -I${MKLROOT}/include"
# export LDFLAGS=" -fopenmp"
# Dynamic Linking
@@ -171,6 +171,8 @@ build() {
--with-blas="${_mkllibs}" \
--with-lapack \
--enable-R-shlib \
+ --enable-memory-profiling \
+ F77=${F77} \
LIBnn=lib
# Place Intel's basic math library prior to GLIBC libm
@@ -178,6 +180,7 @@ build() {
# Build the package
make
+ make pdf info
# make libRmath.so
cd src/nmath/standalone
@@ -193,7 +196,7 @@ check() {
package() {
cd R-${pkgver}
- make DESTDIR="${pkgdir}" install
+ make DESTDIR="${pkgdir}" install install-pdf install-info
# install libRmath.so
cd src/nmath/standalone
@@ -201,25 +204,31 @@ package() {
# Fix R wrapper scripts.
sed -i "s|${pkgdir} ||" "${pkgdir}/usr/bin/R"
- rm "${pkgdir}/usr/lib/R/bin/R"
- cd "${pkgdir}/usr/lib/R/bin"
+ rm "${pkgdir}"/usr/lib/R/bin/R
+ cd "${pkgdir}"/usr/lib/R/bin
ln -s ../../../bin/R
# install some freedesktop.org compatibility
- install -Dm644 "${srcdir}/r.desktop" \
- "${pkgdir}/usr/share/applications/r.desktop"
- install -Dm644 "${srcdir}/r.png" \
- "${pkgdir}/usr/share/pixmaps/r.png"
+ install -Dm644 "${srcdir}"/r.desktop -t "${pkgdir}"/usr/share/applications
+ install -Dm644 "${srcdir}"/r.png -t "${pkgdir}"/usr/share/pixmaps
# move the config directory to /etc and create symlinks
- install -d "${pkgdir}/etc/R"
- cd "${pkgdir}/usr/lib/R/etc"
- for i in *; do
- mv -f ${i} "${pkgdir}/etc/R"
- ln -s /etc/R/${i} ${i}
+ install -d "${pkgdir}"/etc/R
+ cd "${pkgdir}"/usr/lib/R/etc
+ for _i in *; do
+ mv -f ${_i} "${pkgdir}"/etc/R
+ ln -s /etc/R/${_i} ${_i}
done
# Install ld.so.conf.d file to ensure other applications access the shared lib
- install -Dm644 "${srcdir}/R.conf" "${pkgdir}/etc/ld.so.conf.d/R.conf"
+ install -Dm644 "${srcdir}"/R.conf -t "${pkgdir}"/etc/ld.so.conf.d/R.conf
+
+ # Add provides for bundled packages
+ for _f in "$pkgdir"/usr/lib/R/library/*/DESCRIPTION; do
+ _pkg=$(grep Package: $_f | cut -d' ' -f2 | tr '[:upper:]' '[:lower:]')
+ _ver=$(grep Version $_f | cut -d' ' -f2)
+ _prov="r-$_pkg=${_ver/-/.}"
+ provides+=($_prov)
+ done
}
diff --git a/mklvars.sh b/mklvars.sh
deleted file mode 100755
index eedf91981966..000000000000
--- a/mklvars.sh
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/bin/sh
-#===============================================================================
-# Copyright 2003-2019 Intel Corporation.
-#
-# This software and the related documents are Intel copyrighted materials, and
-# your use of them is governed by the express license under which they were
-# provided to you (License). Unless the License provides otherwise, you may not
-# use, modify, copy, publish, distribute, disclose or transmit this software or
-# the related documents without Intel's prior written permission.
-#
-# This software and the related documents are provided as is, with no express
-# or implied warranties, other than those that are expressly stated in the
-# License.
-#===============================================================================
-
-mkl_help() {
- echo ""
- echo "Syntax:"
- echo " source $__mkl_tmp_SCRIPT_NAME <arch> [MKL_interface] [${__mkl_tmp_MOD_NAME}]"
- echo ""
- echo " <arch> must be one of the following"
- echo " ia32 : Setup for IA-32 architecture"
- echo " intel64 : Setup for Intel(R) 64 architecture"
- echo ""
- echo " ${__mkl_tmp_MOD_NAME} (optional) - set path to Intel(R) MKL F95 modules"
- echo ""
- echo " MKL_interface (optional) - Intel(R) MKL programming interface for intel64"
- echo " Not applicable without ${__mkl_tmp_MOD_NAME}"
- echo " lp64 : 4 bytes integer (default)"
- echo " ilp64 : 8 bytes integer"
- echo ""
- echo "If the arguments to the sourced script are ignored (consult docs for"
- echo "your shell) the alternative way to specify target is environment"
- echo "variables COMPILERVARS_ARCHITECTURE or MKLVARS_ARCHITECTURE to pass"
- echo "<arch> to the script, MKLVARS_INTERFACE to pass <MKL_interface> and"
- echo "MKLVARS_MOD to pass <${__mkl_tmp_MOD_NAME}>"
- echo ""
-}
-
-get_tbb_library_directory() {
- __tbb_tmp_lib_dir="gcc4.1"
- which gcc >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- __tbb_tmp_gcc_version_full=$(gcc --version | grep "gcc" | egrep -o " [0-9]+\.[0-9]+\.[0-9]+.*" | sed -e "s/^\ //")
- if [ $? -eq 0 ]; then
- __tbb_tmp_gcc_version=$(echo "${__tbb_tmp_gcc_version_full}" | egrep -o "^[0-9]+\.[0-9]+\.[0-9]+")
- fi
- if [ -d "${TBBROOT}/lib/${__mkl_tmp_TARGET_ARCH}/gcc4.8" ]; then
- __tbb_tmp_lib_dir="gcc4.8"
- else
- case "${__tbb_tmp_gcc_version}" in
- 4.[7-9]*|[5-9]* )
- __tbb_tmp_lib_dir="gcc4.7";;
- 4.[4-6]* )
- __tbb_tmp_lib_dir="gcc4.4";;
- * )
- __tbb_tmp_lib_dir="gcc4.1";;
- esac
- fi
- fi
- echo ${__tbb_tmp_lib_dir}
-}
-
-set_ld_library_path() {
- __tmp_target_arch_path=$1
- __tmp_ld_library_path="${__compiler_dir}/${__tmp_target_arch_path}:${__mkl_lib_dir}/${__tmp_target_arch_path}"
-
- __tmp_tbb_arch_path=$2
- __tmp_ld_library_path=${__tmp_tbb_arch_path:+"${__tmp_tbb_arch_path}:"}${__tmp_ld_library_path}
-
- echo "${__tmp_ld_library_path}"
-}
-
-set_library_path() {
- __tmp_target_arch_path=$1
- __tmp_tbb_arch_path=$2
-
- if [ "${__tmp_target_arch_path}" = "${__subdir_arch_ia32}" ]; then
- __tmp_library_path="${__compiler_dir}/${__tmp_target_arch_path}:${__mkl_lib_dir}/${__tmp_target_arch_path}"
- __tmp_library_path=${__tmp_tbb_arch_path:+"${__tmp_tbb_arch_path}:"}${__tmp_library_path}
- else
- __tmp_library_path="${__compiler_dir}/${__subdir_arch_intel64}:${__mkl_lib_dir}/${__subdir_arch_intel64}"
- __tmp_library_path=${__tmp_tbb_arch_path:+"${__tmp_tbb_arch_path}:"}${__tmp_library_path}
- fi
-
- echo "${__tmp_library_path}"
-}
-
-set_nls_path() {
- __tmp_target_arch_path=$1
- echo "${__mkl_lib_dir}/${__tmp_target_arch_path}/locale/%l_%t/%N"
-}
-
-set_c_path() {
- __tmp_target_arch_path=$1
- __tmp_target_comp_model=$2
- echo "${CPRO_PATH}/mkl/include/${__tmp_target_arch_path}/${__tmp_target_comp_model}"
-}
-
-set_tbb_path() {
- __tmp_target_arch_path=$1
-
- __tmp_tbb_subdir="/$(get_tbb_library_directory)"
-
- __tmp_tbb_path=${__tbb_lib_dir}/${__tmp_target_arch_path}${__tmp_tbb_subdir}
- echo ${__tmp_tbb_path}
-}
-
-set_mkl_env() {
- CPRO_PATH=/opt/intel/compilers_and_libraries_2020.0.166/linux
- export MKLROOT=${CPRO_PATH}/mkl
-
- __mkl_tmp_SCRIPT_NAME="mklvars.sh"
- __mkl_tmp_MOD_NAME=mod
-
- __mkl_tmp_LP64_ILP64=
- __mkl_tmp_MOD=
- __mkl_tmp_TARGET_ARCH=
- __mkl_tmp_MKLVARS_VERBOSE=
- __mkl_tmp_BAD_SWITCH=
-
- if [ -z "$1" ] ; then
- if [ -n "$MKLVARS_ARCHITECTURE" ] ; then
- __mkl_tmp_TARGET_ARCH="$MKLVARS_ARCHITECTURE"
- elif [ -n "$COMPILERVARS_ARCHITECTURE" ] ; then
- __mkl_tmp_TARGET_ARCH="$COMPILERVARS_ARCHITECTURE"
- fi
- if [ "${__mkl_tmp_TARGET_ARCH}" != "ia32" -a "${__mkl_tmp_TARGET_ARCH}" != "intel64" ] ; then
- __mkl_tmp_TARGET_ARCH=
- fi
- if [ -n "$MKLVARS_INTERFACE" ] ; then
- __mkl_tmp_LP64_ILP64="$MKLVARS_INTERFACE"
- if [ "${__mkl_tmp_LP64_ILP64}" != "lp64" -a "${__mkl_tmp_LP64_ILP64}" != "ilp64" ] ; then
- __mkl_tmp_LP64_ILP64=
- fi
- fi
- if [ -n "$MKLVARS_MOD" ] ; then
- __mkl_tmp_MOD="$MKLVARS_MOD"
- fi
- if [ -n "$MKLVARS_VERBOSE" ] ; then
- __mkl_tmp_MKLVARS_VERBOSE="$MKLVARS_VERBOSE"
- fi
- else
- while [ -n "$1" ]; do
- if [ "$1" = "ia32" ] ; then __mkl_tmp_TARGET_ARCH=ia32;
- elif [ "$1" = "intel64" ] ; then __mkl_tmp_TARGET_ARCH=intel64;
- elif [ "$1" = "lp64" ] ; then __mkl_tmp_LP64_ILP64=lp64;
- elif [ "$1" = "ilp64" ] ; then __mkl_tmp_LP64_ILP64=ilp64;
- elif [ "$1" = "${__mkl_tmp_MOD_NAME}" ] ; then __mkl_tmp_MOD=${__mkl_tmp_MOD_NAME};
- elif [ "$1" = "verbose" ] ; then __mkl_tmp_MKLVARS_VERBOSE=verbose;
- else
- __mkl_tmp_BAD_SWITCH=$1
- break 10
- fi
- shift;
- done
- fi
-
- if [ -n "${__mkl_tmp_BAD_SWITCH}" ] ; then
-
- echo
- echo "ERROR: Unknown option '${__mkl_tmp_BAD_SWITCH}'"
- mkl_help
-
- else
-
- if [ -z "${__mkl_tmp_TARGET_ARCH}" ] ; then
-
- echo
- echo "ERROR: architecture is not defined. Accepted values: ia32, intel64"
- mkl_help
-
- else
- __compiler_dir="${CPRO_PATH}/compiler/lib"
- __mkl_lib_dir="${MKLROOT}/lib"
- __tbb_lib_dir="${CPRO_PATH}/tbb/lib"
- __cpath="${MKLROOT}/include"
-
- __subdir_arch_ia32="ia32_lin"
- __subdir_arch_intel64="intel64_lin"
-
- if [ "${__mkl_tmp_TARGET_ARCH}" = "ia32" ]; then __target_arch_path="${__subdir_arch_ia32}";
- elif [ "${__mkl_tmp_TARGET_ARCH}" = "intel64" ]; then __target_arch_path="${__subdir_arch_intel64}";
- fi
-
- __tbb_path_arch=""
- if [ -z "${TBBROOT}" ]; then
- if [ -d "${__tbb_lib_dir}" ]; then
- if [ "${__target_arch_path}" = "${__subdir_arch_ia32}" ]; then
- __tbb_path_arch=$(set_tbb_path ${__subdir_arch_ia32} )
- else
- __tbb_path_arch=$(set_tbb_path ${__subdir_arch_intel64} )
- fi
- fi
- fi
-
- __ld_library_path=$(set_ld_library_path ${__target_arch_path} ${__tbb_path_arch})
- __library_path=$(set_library_path ${__target_arch_path} ${__tbb_path_arch})
- __nlspath=$(set_nls_path ${__target_arch_path})
-
- if [ "${__mkl_tmp_MOD}" = "${__mkl_tmp_MOD_NAME}" ] ; then
- if [ "${__mkl_tmp_TARGET_ARCH}" = "ia32" ] ; then
- __mkl_tmp_LP64_ILP64=
- else
- if [ -z "$__mkl_tmp_LP64_ILP64" ] ; then
- __mkl_tmp_LP64_ILP64=lp64
- fi
- fi
- __cpath=$(set_c_path ${__target_arch_path} ${__mkl_tmp_LP64_ILP64}):${__cpath}
- fi
-
- export LD_LIBRARY_PATH="${__ld_library_path}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
- export LIBRARY_PATH="${__library_path}${LIBRARY_PATH+:${LIBRARY_PATH}}"
- export NLSPATH="${__nlspath}${NLSPATH+:${NLSPATH}}"
- export CPATH="${__cpath}${CPATH+:${CPATH}}"
- export PKG_CONFIG_PATH="${MKLROOT}/bin/pkgconfig${PKG_CONFIG_PATH+:${PKG_CONFIG_PATH}}"
-
- if [ "${__mkl_tmp_MKLVARS_VERBOSE}" = "verbose" ] ; then
- echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
- echo LIBRARY_PATH=${LIBRARY_PATH}
- echo NLSPATH=${NLSPATH}
- echo CPATH=${CPATH}
- echo PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
- fi
- fi
- fi
-}
-
-set_mkl_env "$@"
diff --git a/vars.sh b/vars.sh
new file mode 100755
index 000000000000..aaa6886aa4f5
--- /dev/null
+++ b/vars.sh
@@ -0,0 +1,270 @@
+#!/bin/sh
+#shellcheck shell=sh
+#===============================================================================
+# Copyright 2003-2022 Intel Corporation.
+#
+# This software and the related documents are Intel copyrighted materials, and
+# your use of them is governed by the express license under which they were
+# provided to you (License). Unless the License provides otherwise, you may not
+# use, modify, copy, publish, distribute, disclose or transmit this software or
+# the related documents without Intel's prior written permission.
+#
+# This software and the related documents are provided as is, with no express
+# or implied warranties, other than those that are expressly stated in the
+# License.
+#===============================================================================
+
+# ############################################################################
+
+# Get absolute path to this script.
+# Uses `readlink` to remove links and `pwd -P` to turn into an absolute path.
+
+# Usage:
+# script_dir=$(get_script_path "$script_rel_path")
+#
+# Inputs:
+# script/relative/pathname/scriptname
+#
+# Outputs:
+# /script/absolute/pathname
+
+# executing function in a *subshell* to localize vars and effects on `cd`
+get_script_path() (
+ script="$1"
+ while [ -L "$script" ] ; do
+ # combining next two lines fails in zsh shell
+ script_dir=$(command dirname -- "$script")
+ script_dir=$(cd "$script_dir" && command pwd -P)
+ script="$(readlink "$script")"
+ case $script in
+ (/*) ;;
+ (*) script="$script_dir/$script" ;;
+ esac
+ done
+ # combining next two lines fails in zsh shell
+ script_dir=$(command dirname -- "$script")
+ script_dir=$(cd "$script_dir" && command pwd -P)
+ printf "%s" "$script_dir"
+)
+
+
+# ############################################################################
+
+# Determine if we are being executed or sourced. Need to detect being sourced
+# within an executed script, which can happen on a CI system. We also must
+# detect being sourced at a shell prompt (CLI). The setvars.sh script will
+# always source this script, but this script can also be called directly.
+
+# We are assuming we know the name of this script, which is a reasonable
+# assumption. This script _must_ be named "vars.sh" or it will not work
+# with the top-level setvars.sh script. Making this assumption simplifies
+# the process of detecting if the script has been sourced or executed. It
+# also simplifies the process of detecting the location of this script.
+
+# Using `readlink` to remove possible symlinks in the name of the script.
+# Also, "ps -o comm=" is limited to a 15 character result, but it works
+# fine here, because we are only looking for the name of this script or the
+# name of the execution shell, both always fit into fifteen characters.
+
+# Edge cases exist when executed by way of "/bin/sh setvars.sh"
+# Most shells detect or fall thru to error message, sometimes ksh does not.
+# This is an odd and unusual situation; not a high priority issue.
+
+_vars_get_proc_name() {
+ if [ -n "${ZSH_VERSION:-}" ] ; then
+ script="$(ps -p "$$" -o comm=)"
+ else
+ script="$1"
+ while [ -L "$script" ] ; do
+ script="$(readlink "$script")"
+ done
+ fi
+ basename -- "$script"
+}
+
+_vars_this_script_name="vars.sh"
+if [ "$_vars_this_script_name" = "$(_vars_get_proc_name "$0")" ] ; then
+ echo " ERROR: Incorrect usage: this script must be sourced."
+ echo " Usage: . path/to/${_vars_this_script_name}"
+ return 255 2>/dev/null || exit 255
+fi
+
+
+# ############################################################################
+
+mkl_help() {
+ __mkl_help=1
+ echo ""
+ echo "oneAPI MKL vars.sh syntax:"
+ echo " source $__mkl_tmp_SCRIPT_NAME [<arch>] [<MKL_interface>] [mod]"
+ echo ""
+ echo " <arch> (optional) - oneAPI MKL architecture: "
+ echo " ia32 : Setup for IA-32 architecture"
+ echo " intel64 : Setup for Intel(R) 64 architecture (default)"
+ echo ""
+ echo " <MKL_interface> (optional) - oneAPI MKL programming interface for intel64"
+ echo " Not applicable without \"mod\""
+ echo " lp64 : 4 bytes integer (default)"
+ echo " ilp64 : 8 bytes integer"
+ echo ""
+ echo " mod (optional) - set path to oneAPI MKL F95 modules"
+ echo ""
+ echo "If the arguments to the sourced script are ignored (consult docs for"
+ echo "your shell) the alternative way to specify target is environment"
+ echo "variables COMPILERVARS_ARCHITECTURE or MKLVARS_ARCHITECTURE to pass"
+ echo "<arch> to the script, MKLVARS_INTERFACE to pass <MKL_interface> and"
+ echo "MKLVARS_MOD to pass \"mod\""
+ echo ""
+}
+
+# ############################################################################
+
+# Extract the name and location of this sourced script.
+
+# Generally, "ps -o comm=" is limited to a 15 character result, but it works
+# fine for this usage, because we are primarily interested in finding the name
+# of the execution shell, not the name of any calling script.
+
+vars_script_name=""
+vars_script_shell="$(ps -p "$$" -o comm=)"
+# ${var:-} needed to pass "set -eu" checks
+# see https://unix.stackexchange.com/a/381465/103967
+# see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
+if [ -n "${ZSH_VERSION:-}" ] && [ -n "${ZSH_EVAL_CONTEXT:-}" ] ; then # zsh 5.x and later
+ # shellcheck disable=2249
+ case $ZSH_EVAL_CONTEXT in (*:file*) vars_script_name="${(%):-%x}" ;; esac ;
+elif [ -n "${KSH_VERSION:-}" ] ; then # ksh, mksh or lksh
+ if [ "$(set | grep -Fq "KSH_VERSION=.sh.version" ; echo $?)" -eq 0 ] ; then # ksh
+ vars_script_name="${.sh.file}" ;
+ else # mksh or lksh or [lm]ksh masquerading as ksh or sh
+ # force [lm]ksh to issue error msg; which contains this script's path/filename, e.g.:
+ # mksh: /home/ubuntu/intel/oneapi/vars.sh[137]: ${.sh.file}: bad substitution
+ vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
+ vars_script_name="$(expr "${vars_script_name:-}" : '^.*sh: \(.*\)\[[0-9]*\]:')" ;
+ fi
+elif [ -n "${BASH_VERSION:-}" ] ; then # bash
+ # shellcheck disable=2128,3028
+ (return 0 2>/dev/null) && vars_script_name="${BASH_SOURCE}" ;
+elif [ "dash" = "$vars_script_shell" ] ; then # dash
+ # force dash to issue error msg; which contains this script's rel/path/filename, e.g.:
+ # dash: 146: /home/ubuntu/intel/oneapi/vars.sh: Bad substitution
+ vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
+ vars_script_name="$(expr "${vars_script_name:-}" : '^.*dash: [0-9]*: \(.*\):')" ;
+elif [ "sh" = "$vars_script_shell" ] ; then # could be dash masquerading as /bin/sh
+ # force a shell error msg; which should contain this script's path/filename
+ # sample error msg shown; assume this file is named "vars.sh"; as required by setvars.sh
+ vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
+ if [ "$(printf "%s" "$vars_script_name" | grep -Eq "sh: [0-9]+: .*vars\.sh: " ; echo $?)" -eq 0 ] ; then # dash as sh
+ # sh: 155: /home/ubuntu/intel/oneapi/vars.sh: Bad substitution
+ vars_script_name="$(expr "${vars_script_name:-}" : '^.*sh: [0-9]*: \(.*\):')" ;
+ fi
+else # unrecognized shell or dash being sourced from within a user's script
+ # force a shell error msg; which should contain this script's path/filename
+ # sample error msg shown; assume this file is named "vars.sh"; as required by setvars.sh
+ vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
+ if [ "$(printf "%s" "$vars_script_name" | grep -Eq "^.+: [0-9]+: .*vars\.sh: " ; echo $?)" -eq 0 ] ; then # dash
+ # .*: 164: intel/oneapi/vars.sh: Bad substitution
+ vars_script_name="$(expr "${vars_script_name:-}" : '^.*: [0-9]*: \(.*\):')" ;
+ else
+ vars_script_name="" ;
+ fi
+fi
+
+if [ "" = "$vars_script_name" ] ; then
+ >&2 echo " ERROR: Unable to proceed: possible causes listed below."
+ >&2 echo " This script must be sourced. Did you execute or source this script?" ;
+ >&2 echo " Unrecognized/unsupported shell (supported: bash, zsh, ksh, m/lksh, dash)." ;
+ >&2 echo " May fail in dash if you rename this script (assumes \"vars.sh\")." ;
+ >&2 echo " Can be caused by sourcing from ZSH version 4.x or older." ;
+ return 255 2>/dev/null || exit 255
+fi
+
+
+# ############################################################################
+
+# Setup environment.
+
+my_script_name=$(basename -- "${vars_script_name:-}")
+my_script_path=$(get_script_path "${vars_script_name:-}")
+MKLROOT=$(dirname -- "${my_script_path}") ; export MKLROOT
+
+__mkl_tmp_SCRIPT_NAME="$my_script_name"
+__mkl_tmp_MOD_NAME=mod
+__mkl_tmp_TARGET_ARCH=intel64
+__mkl_tmp_LP64_ILP64=
+__mkl_tmp_MOD=
+__mkl_tmp_MKLVARS_VERBOSE=
+__mkl_help=
+
+if [ -z "$1" ] ; then
+ if [ -n "$MKLVARS_ARCHITECTURE" ] ; then
+ __mkl_tmp_TARGET_ARCH="$MKLVARS_ARCHITECTURE"
+ elif [ -n "$COMPILERVARS_ARCHITECTURE" ] ; then
+ __mkl_tmp_TARGET_ARCH="$COMPILERVARS_ARCHITECTURE"
+ fi
+ if [ "${__mkl_tmp_TARGET_ARCH}" != "ia32" ] && [ "${__mkl_tmp_TARGET_ARCH}" != "intel64" ] ; then
+ __mkl_tmp_TARGET_ARCH=intel64
+ fi
+ if [ -n "$MKLVARS_INTERFACE" ] ; then
+ __mkl_tmp_LP64_ILP64="$MKLVARS_INTERFACE"
+ if [ "${__mkl_tmp_LP64_ILP64}" != "lp64" ] && [ "${__mkl_tmp_LP64_ILP64}" != "ilp64" ] ; then
+ __mkl_tmp_LP64_ILP64=
+ fi
+ fi
+ if [ -n "$MKLVARS_MOD" ] ; then
+ __mkl_tmp_MOD="$MKLVARS_MOD"
+ fi
+ if [ -n "$MKLVARS_VERBOSE" ] ; then
+ __mkl_tmp_MKLVARS_VERBOSE="$MKLVARS_VERBOSE"
+ fi
+else
+ while [ -n "${1:-}" ]; do
+ if [ "$1" = "ia32" ] ; then __mkl_tmp_TARGET_ARCH=ia32;
+ elif [ "$1" = "intel64" ] ; then __mkl_tmp_TARGET_ARCH=intel64;
+ elif [ "$1" = "lp64" ] ; then __mkl_tmp_LP64_ILP64=lp64;
+ elif [ "$1" = "ilp64" ] ; then __mkl_tmp_LP64_ILP64=ilp64;
+ elif [ "$1" = "${__mkl_tmp_MOD_NAME}" ] ; then __mkl_tmp_MOD=${__mkl_tmp_MOD_NAME};
+ elif [ "$1" = "verbose" ] ; then __mkl_tmp_MKLVARS_VERBOSE=verbose;
+ elif [ "$1" = "help" ] ; then mkl_help;
+ fi
+ shift;
+ done
+fi
+
+if [ -z "${__mkl_help}" ] ; then
+ __mkl_lib_dir="${MKLROOT}/lib"
+ __cpath="${MKLROOT}/include"
+ __mkl_bin_dir="${MKLROOT}/bin"
+
+ __ld_library_path="${__mkl_lib_dir}/${__mkl_tmp_TARGET_ARCH}"
+ __library_path="${__mkl_lib_dir}/${__mkl_tmp_TARGET_ARCH}"
+ __path="${__mkl_bin_dir}/${__mkl_tmp_TARGET_ARCH}"
+ __nlspath="${__mkl_lib_dir}/${__mkl_tmp_TARGET_ARCH}/locale/%l_%t/%N"
+
+ if [ "${__mkl_tmp_MOD}" = "${__mkl_tmp_MOD_NAME}" ] ; then
+ if [ "${__mkl_tmp_TARGET_ARCH}" = "ia32" ] ; then
+ __mkl_tmp_LP64_ILP64=
+ else
+ if [ -z "$__mkl_tmp_LP64_ILP64" ] ; then
+ __mkl_tmp_LP64_ILP64=lp64
+ fi
+ fi
+ __cpath="${MKLROOT}/include/${__mkl_tmp_TARGET_ARCH}/${__mkl_tmp_LP64_ILP64}:${__cpath}"
+ fi
+
+ export LD_LIBRARY_PATH="${__ld_library_path}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
+ export LIBRARY_PATH="${__library_path}${LIBRARY_PATH+:${LIBRARY_PATH}}"
+ export NLSPATH="${__nlspath}${NLSPATH+:${NLSPATH}}"
+ export CPATH="${__cpath}${CPATH+:${CPATH}}"
+ export PATH="${__path}${PATH+:${PATH}}"
+ export PKG_CONFIG_PATH="${MKLROOT}/lib/pkgconfig${PKG_CONFIG_PATH+:${PKG_CONFIG_PATH}}"
+
+ if [ "${__mkl_tmp_MKLVARS_VERBOSE}" = "verbose" ] ; then
+ echo MKLROOT=${MKLROOT}
+ echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
+ echo LIBRARY_PATH=${LIBRARY_PATH}
+ echo NLSPATH=${NLSPATH}
+ echo CPATH=${CPATH}
+ echo PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
+ fi
+fi