Intel ICPC Compiler

Intel ICPC是Intel自家的编译器,对自家的CPU架构(特别是服务器端CPU)有着特殊的优化,而且内置TBB和Cilk Plus等线程库,属于高性能计算必备。

注:2020年底已经改名为Intel oneAPI DPC++/C++ Compiler,可通过Linux的apt直接安装,安装指令参见这个页面(安装更为快捷方便),调用变为dpcpp,其他使用基本没有变化。

DPCPP

可以直接通过Linux apt安装,似乎不需要license。

# use wget to fetch the Intel repository public key
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# add to your apt sources keyring so that archives signed with this key will be trusted.
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# remove the public key
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# Configure the APT client to use Intel's repository
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
# install package
sudo apt install intel-basekit
# activate variables (can be added to ~/.bashrc)
. /opt/intel/oneapi/setvars.sh intel64
# remember to add intel64, otherwise will cause the following error
# libsycl.so: cannot open shared object file: No such file or directory

ICPC(旧)

可以在这个网站下载,选择Intel® Parallel Studio XE,里面就包含了C/C++的编译器。

然后在这个页面可以选择免费学生版,需要学校邮箱进行注册。之后按照要求填写完,Intel会发来一封注册邮件(里面有序列号),然后下载安装包即可。注意学生版每年都要更换序列号!!!千万不要因为过了时间忘记重新续期而耽误了工作。

以2020 Update 1为例,下载后会有parallel_studio_xe_2020_update1_cluster_edition.tgz文件,解压后用install.sh安装命令行版,安装过程即会要求填写序列号。

这里可以查看已注册软件,似乎学生账号只能拥有一个序列号,因此重新注册后旧的就会自动失效。

安装后需要激活环境

$ source intel/bin/compilervars.sh intel64
$ icpc --version
icpc (ICC) 19.1.1.217 20200306
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

即完成安装步骤。其余使用与gcc无异。

Intel Parallel Studio XE中也提供了其他一些很好用的工具,比如vtune、gdb-ia,这些可以在官方文档中找到。