实验环境:win10 wsl
ubuntu 18.04

附:简洁版安装教程(只包含主要命令,以2024版HPC toolkit为例)移步链接

一、intel官方教程

我选择的安装方法为:linux离线安装,且使用非交互式命令行安装(教程)
在这里插入图片描述

二、安装过程

2.1 下载

(下载地址是从网页中提取的)因此只需要在linux中输入下面的命令
我当时安装的是2021.1.0.2659,和下面这个版本不一样,但是安装流程是一样的,替换下命令就好

$ wget https://registrationcenter-download.intel.com/akdlm/irc_nas/17769/l_BaseKit_p_2021.2.0.2883_offline.sh

安装完成后,目录下可以看到l_BaseKit_p_2021.1.0.2659_offline.shl_BaseKit_p_2021.2.0.2883_offline.sh)这个文件

查看相关命令参数:

bash l_BaseKit_p_2021.2.0.2883_offline.sh --help

2.2 安装方法

方法一 全家桶安装

需要预留30g左右的磁盘空间,否则会安装失败

sudo sh ./l_BaseKit_p_2021.1.0.2659_offline.sh -s -a --silent --eula accept

安装过程中的参考输出如下所示

lmy@ubuntu-lmy:/media/lmy/Data/ubuntu/ipp$ sudo sh ./l_BaseKit_p_2021.1.0.2659_offline.sh -s -a --silent --eula accept
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Checking system requirements...
Done.
Wait while the installer is preparing...
Done.
Launching the installer...
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Intel® Graphics Compute Runtime for OpenCL™ not found.
For developing and running applications for GPU on this system, the latest version of the Intel® Graphics Driver is required. Please reference the GPU driver section at <a href="https://dgpu-docs.intel.com/installation-guides/index.html">https://dgpu-docs.intel.com/installation-guides/index.html</a> about GPU driver version(s) and installation information.
Start installation flow...
Installed Location: /opt/intel/oneapi
Installation has successfully completed
Log file: /opt/intel/oneapi/logs/installer.install.intel.oneapi.lin.basekit.product,v=2021.1.0-2659.2021.06.19.22.41.16.813721.log

方法二 自定义组件安装(安装目录使用默认)

默认安装路径:
如果使用sudo安装的话,默认路径是/opt/intel/oneapi/
如果使用普通用户权限安装的话,默认路径是 ~/intel/oneapi/

也需要预留一些空间,我安装的这三个组件大概需要6个g
查看所有组件:

sudo sh ./l_BaseKit_p_2021.1.0.2659_offline.sh -a --list-components

对于我来说,我只需要基本的编译器和ipp就够了,即intel.oneapi.lin.dpcpp-cpp-compilerintel.oneapi.lin.dpcpp-libraryintel.oneapi.lin.ipp.devel

注意:不同版本的组件列表不一定相同,比如2021.2.0.2883版本里面没有dpcpp-library这个组件,因此可以修改命令为
sudo sh ./l_BaseKit_p_2021.2.0.2883_offline.sh -a --silent --eula accept --components intel.oneapi.lin.dpcpp-cpp-compiler:intel.oneapi.lin.ipp.devel

如果是其它版本,根据实际情况,从上一步打印的组件列表中选中相应组件即可

参考安装命令如下:

sudo sh ./l_BaseKit_p_2021.1.0.2659_offline.sh  -a --silent --eula accept  --components intel.oneapi.lin.dpcpp-cpp-compiler:intel.oneapi.lin.dpcpp-library:intel.oneapi.lin.ipp.devel

其中,

  • -a表示Arguments
    • 运行该脚本时,首先会解压文件,里面包括一个install.sh,而这个Arguments应该就是在向它传递参数。
    • -a后面不加参数时,将使用默认参数,默认为--action install --cli --components all --eula decline,即默认以交互方式安装所有组件
    • sudo bash l_BaseKit_p_2021.1.0.2659_offline.sh --help可以看到更详细的说明)
  • --silent 表示静默安装(不使用交互式安装)
  • --eula accept,表示接受用户协议
  • 参数--components 后跟了三个组件名,intel.oneapi.lin.dpcpp-cpp-compilerintel.oneapi.lin.dpcpp-libraryintel.oneapi.lin.ipp.devel

方法三 自定义组件、自定义安装目录

wsl中是可以正常访问win10的磁盘的
路径为 /mnt/c/mnt/d/mnt/e等,因此如果要装到d盘,就直接输入--install-dir /mnt/d/路径

可以通过--install-dir命令把ipp安装在其它盘,/mnt/d/ipp_product是我的安装路径
安装命令

sudo sh ./l_BaseKit_p_2021.1.0.2659_offline.sh  -a --silent --install-dir /mnt/d/ipp_product --eula accept  --components intel.oneapi.lin.dpcpp-cpp-compiler:intel.oneapi.lin.dpcpp-library:intel.oneapi.lin.ipp.devel
补充:后续卸载或者安装其他组件的方法
  • 安装其他组件(--action modify或者-a --action modify),注意如果需要添加新组件,必须把之前的组件也加到参数里,否则旧组件会被卸载。(即文档中的:Components that are already installed still must be in the list if remain relevant.)
  • 卸载组件(--action remove

有时候只使用--action modify,会报错Invalid option. Use -a to pass installer arguments, for example: -a --action
示例如下(注意此处版本是2024版,仅作参考)

$ bash ./l_BaseKit_p_2024.0.1.46_offline.sh -a --action modify --silent --eula accept --components intel.oneapi.lin.dpcpp-ct
Extract l_BaseKit_p_2024.0.1.46_offline to /home/xxx/intel/l_BaseKit_p_2024.0.1.46_offline...
[###################################################################################################################################################################]
Extract l_BaseKit_p_2024.0.1.46_offline completed!
Checking system requirements...
Done.
Wait while the installer is preparing...
Done.
Launching the installer...
Start installation flow...
Log files: /tmp/xxx/intel_oneapi_installer/2024.03.09.00.08.43.263
Installation has successfully completed
Remove extracted files: /home/xxx/intel/l_BaseKit_p_2024.0.1.46_offline...

报错记录:如果还按照之前的命令的话会显示已经安装过了

$ bash ./l_BaseKit_p_2024.0.1.46_offline.sh -a --silent --eula accept --components intel.oneapi.lin.dpcpp-ct
Extract l_BaseKit_p_2024.0.1.46_offline to > /home/xxx/intel/l_BaseKit_p_2024.0.1.46_offline...
[##############################################################]
Extract l_BaseKit_p_2024.0.1.46_offline completed!
Checking system requirements...
Done.
Wait while the installer is preparing...
Done.
Launching the installer...
Cannot install 'intel.oneapi.lin.basekit.product,v=2024.0.1+43'. It is already installed.
Remove extracted files: /home/xxx/intel/l_BaseKit_p_2024.0.1.46_offline...

2.3 查询安装情况(也可以跳过)

2.3.1 查看产品id和版本号

使用之前下载的l_BaseKit_p_2021.1.0.2659_offline.sh可以查询产品id和版本号,但是很慢。在安装完成后,可以使用安装后的installer程序来查询(命令文档,也可以使用installer -h来查看)。

先说明一下installer程序的路径
如果是使用sudo安装,路径为/opt/intel/oneapi/installer/installer
如果是使用普通用户安装(即使是指定了安装路径,installer的位置不变),路径为~/intel/oneapi/installer/installer

命令为:

cd installer的路径
sudo ./installer  -s -a --list-products

参考输出:

ubuntu@WZY:/opt/intel/oneapi/installer$ sudo ./installer  -s -a --list-products
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
ID                               Version       Language Installed Name
=============================================================================================
intel.oneapi.lin.basekit.product 2021.1.0-2659          true      Intel® oneAPI Base Toolkit

2.3.2 查看组件安装情况

产品id(product-id)和版本号(product-ver)要和上面一致才行

sudo /opt/intel/oneapi/installer/installer  -s -a  --list-components --product-id=intel.oneapi.lin.basekit.product --product-ver=2021.1.0-2659

参考输出:

# 查看组件安装信息(我一开始全部安装了,所以显示都是true),注意这里的product-id和product-ver和
ubuntu@WZY:/opt/intel/oneapi/installer$ sudo /opt/intel/oneapi/installer/installer  -s -a  --list-components --product-id=intel.oneapi.lin.basekit.product --product-ver=2021.1.0-2659
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ubuntu'
ID                                  Version      Language Installed Name
==========================================================================================================================
intel.oneapi.lin.tbb.devel          2021.1.1-119          true      Intel® oneAPI Threading Building Blocks
intel.oneapi.lin.dpcpp-cpp-compiler 2021.1.1-189          true      Intel® oneAPI DPC++/C++ Compiler
intel.oneapi.lin.dpcpp-library      2021.1.1-189          true      Intel® oneAPI DPC++ Library
intel.oneapi.lin.mkl.devel          2021.1.1-52           false     Intel® oneAPI Math Kernel Library
intel.oneapi.lin.ipp.devel          2021.1.1-47           true      Intel® Integrated Performance Primitives
intel.oneapi.lin.dal.devel          2021.1.1-79           false     Intel® oneAPI Data Analytics Library
intel.oneapi.lin.advisor            2021.1.1-43           false     Intel® Advisor
intel.oneapi.lin.dnnl               2021.1.1-55           false     Intel® oneAPI Deep Neural Network Library
intel.oneapi.lin.ccl.devel          2021.1.1-54           false     Intel® oneAPI Collective Communications Library
intel.oneapi.lin.vtune              2021.1.1-61           false     Intel® VTune(TM) Profiler
intel.oneapi.lin.dpcpp-ct           2021.1.1-59           false     Intel® DPC++ Compatibility Tool
intel.oneapi.lin.python3            2021.1.1-44           false     Intel® Distribution for Python*
intel.oneapi.lin.vpl                2021.1.1-66           false     Intel® oneAPI Video Processing Library
intel.oneapi.lin.ippcp.devel        2021.1.1-54           false     Intel® Integrated Performance Primitives Cryptography
intel.oneapi.lin.dpcpp_dbg          10.0.0-2219           true      Intel® Distribution for GDB*

2.4 设置环境变量

运行命令

$ source /opt/intel/oneapi/setvars.sh

上面那个一次性的(关闭终端重新打开就失效了),如果要让终端启动时自动设置环境变量,运行下列命令:

$ echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bashrc

测试环境变量

icx -v
gdb-oneapi -v

2.5 验证环境

如果提示找不到<stdio.h>的话,就用apt安装一下gcc就好了,我一般用命令sudo apt install build-essential,如果apt下载太慢可以改成ubuntu对应版本的apt国内源。

  • 拷贝GetBilinearTransform.c到wsl中

拷贝的时候,建议不要直接在文件管理器拖来拖去,直接拖可能会出现权限有问题,建议使用linux的cp命令,比如cp /mnt/d/test/GetBilinearTransform.c /home/test,把本机d盘test文件夹里的GetBilinearTransform.c文件拷贝到wsl的/home/目录

  • 使用下面的命令编译GetBilinearTransform.c,目标文件为GetBilinearTransform
$ icx GetBilinearTransform.c -g -o GetBilinearTransform -I$IPPROOT/include -L$IPPROOT/lib/intel64 -lippi -lipps -lippcore
  • 运行GetBilinearTransform
$ ./GetBilinearTransform 
Exit status 0 (ippStsNoErr: No errors)

三、卸载

参考,卸载教程
卸载某个product

$ sudo sh ./installer -s --action remove --product-id intel.oneapi.lin.tbb.product --product-ver 2021.1.1-129
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐