Skip to content

Instantly share code, notes, and snippets.

@scivision
Last active February 26, 2026 21:10
Show Gist options
  • Select an option

  • Save scivision/196cfa0df761ad4fcace8ff269128f7b to your computer and use it in GitHub Desktop.

Select an option

Save scivision/196cfa0df761ad4fcace8ff269128f7b to your computer and use it in GitHub Desktop.
oneAPI source scripts for Linux, macOS and Windows

tiny scripts to load oneAPI environment

For PowerShell and Unix-like shells, here are example scripts to load and use Intel oneAPI on Windows and Linux.

Optionally, the version can be specified.

  • Linux: source oneapi.sh or source oneapi.sh 2025.3
  • Windows . .\oneapi.sh or . .\oneapi.sh 2025.3

Windows example output

If the lines ending in "vars.bat" below aren't seen, probably oneAPI is not correctly installed. Ensure that before installing oneAPI that Visual Studio Desktop Development with C++ workload was installed. If needed, do that, then "Repair" the oneAPI install.

> . .\oneapi.ps1

:: initializing oneAPI environment...
   Initializing Visual Studio command-line environment...
   Visual Studio version 18.3.0 environment configured.
   "C:\Program Files\Microsoft Visual Studio\18\Community\"
   Visual Studio command-line environment initialized for: 'x64'
:  compiler -- latest
:  dev-utilities -- latest
:  dpl -- latest
:  mkl -- latest
:  mpi -- latest
:  ocloc -- latest
:  tbb -- latest
:  umf -- latest
:: oneAPI environment initialized ::

Note oneAPI works on ARM64 on Windows via Prism, and will report Intel CPU arch

param(
[string]$version = "2025.3"
)
$basedir = "${Env:ProgramFiles(x86)}\Intel\oneAPI"
if (-not (Test-Path -Path $basedir)) {
Write-Error "The Intel oneAPI install base directory does not exist: $basedir"
exit 1
}
$verdir = Join-Path -Path $basedir -ChildPath $version
if (-not (Test-Path -Path $verdir)) {
Write-Error "The specified Intel oneAPI version directory does not exist: $verdir"
exit 1
}
$Env:CC="icx"
$Env:FC="ifx"
$Env:CXX="icx"
& $Env:COMSPEC /c "`"${verdir}\oneapi-vars.bat`" && pwsh"
version=${1:-2025.3}
basedir=/opt/intel/oneapi
[[ -d ${basedir} ]] || { echo "OneAPI base directory ${basedir} not found"; exit 1; }
verdir=${basedir}/${version}
[[ -d ${verdir} ]] || { echo "OneAPI version directory ${verdir} not found"; exit 1; }
source ${verdir}/oneapi-vars.sh
export CC=$CMPLR_ROOT/bin/icx CXX=$CMPLR_ROOT/bin/icpx FC=$CMPLR_ROOT/bin/ifx
export MPI_ROOT=$I_MPI_ROOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment