# Install Intel C/C++ Compiler (ICC) 2021.4.0
###### tags: `ORAN`, `ICC`
---
:::success
[TOC]
:::
Reference: [Issue in installing ICC](https://stackoverflow.com/questions/69769768/issue-in-installing-icc-from-intel-oneapi-basetoolkit-issue-with-license-file#answer-69878966)
---
## Version
:::info
- For O-DU Emerald version, can use oneapi 2021.4.0
- For O-DU F Version, use 2022.1.0
:::
---
## Background
:::info
- Compile for CPUs, GPUs, and FPGAs with an LLVM technology-based compiler that enables custom accelerator tuning and supports OpenMP for GPU offload.
- Used to compile O-DU software
:::
---
## OneAPI 2021.4.0
### Install Intel oneAPI Base ToolKit
1. Go to [Intel Download Center](https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html?operatingsystem=linux&distributions=webdownload&options=online)

2. Use command line to download installation script
```shell=
[oran@localhost ~]$ wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18236/l_BaseKit_p_2021.4.0.3422.sh
```
3. Execute downloaded script via
```shell=
[oran@localhost ~]$ sudo sh <script-name>.sh -a --silent --eula accept
```
For more options, please refer to [Installation Guide](https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-with-command-line.html)
4. Wait for a while, and the installation will complete

### Install Intel oneAPI HPC ToolKit
1. Go to [Intel Download Center](https://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit-download.html?operatingsystem=linux&distributions=webdownload&options=online)

2. Use command line to download installation script
```shell=
[oran@localhost ~]$ wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18211/l_HPCKit_p_2021.4.0.3347.sh
```
3. Execute downloaded script via
```shell=
[oran@localhost ~]$ sudo sh <script-name>.sh -a --silent --eula accept
```
For more options, please refer to [Installation Guide](https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-with-command-line.html)
4. Wait for a while, and the installation will complete

### Configure Environment Variable
1. Open ==~/.bashrc==
2. Append following environment variable
```shell=
export INTEL_ONEAPI_ROOT=/opt/intel/oneapi
export PATH=$PATH:$INTEL_ONEAPI_ROOT/compiler/2021.4.0/env:$INTEL_ONEAPI_ROOT/compiler/2021.4.0/linux/bin/intel64
```
3. After edit is completed, it will be like

:::warning
Some environment variables will be set in other sections.
Just focus on the variables we set above.
:::
### Create iccvar.sh
* Because we need `iccvars.sh` in other section and the file in current version is called `vars.sh`, we copy `vars.sh` to `iccvars.sh`.
```shell=
[oran@localhost ~]$ sudo cp /opt/intel/oneapi/compiler/2021.4.0/env/vars.sh /opt/intel/oneapi/compiler/2021.4.0/env/iccvars.sh
```
### Verify installation
1. Check `icc`
```shell=
[oran@localhost ~]$ icc --version
icc (ICC) 2021.4.0 20210910
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
```
2. Check `icpc`
```shell=
[oran@localhost ~]$ icpc --version
icpc (ICC) 2021.4.0 20210910
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
```
3. Check `iccvars.sh`
```shell=
[oran@localhost ~]$ which iccvars.sh
/opt/intel/oneapi/compiler/2021.4.0/env/iccvars.sh
```