* INTC Contribution to the O-RAN F Release for O-DU Low
[o-du/phy.git] / docs / build_prerequisite.rst
1 ..    Copyright (c) 2019-2022 Intel
2 ..
3 ..  Licensed under the Apache License, Version 2.0 (the "License");
4 ..  you may not use this file except in compliance with the License.
5 ..  You may obtain a copy of the License at
6 ..
7 ..      http://www.apache.org/licenses/LICENSE-2.0
8 ..
9 ..  Unless required by applicable law or agreed to in writing, software
10 ..  distributed under the License is distributed on an "AS IS" BASIS,
11 ..  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 ..  See the License for the specific language governing permissions and
13 ..  limitations under the License.
14
15 .. |br| raw:: html
16
17    <br />
18
19 Build Prerequisite
20 ====================
21
22 .. contents::
23     :depth: 3
24     :local:
25     
26 This section describes how to install and build the required components needed to build the FHI Library, WLS Library and the 5G FAPI TM modules.
27 For the f release the ICC compiler is optional and support will be discontinued in future releases
28
29 Download and Install oneAPI
30 ---------------------------
31 Download and install the Intel®  oneAPI Base Toolkit by issuing the following commands from yor Linux
32 Console:
33
34 wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18673/l_BaseKit_p_2022.2.0.262_offline.sh
35
36 sudo sh ./l_BaseKit_p_2022.2.0.262_offline.sh
37
38 Then follow the instructions on the installer.
39 Additional information available from
40
41 https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html?operatingsystem=linux&distributions=webdownload&options=offline
42
43 Install ICC and System Studio
44 -----------------------------
45 Intel® C++ Compiler and System Studio v19.0.3 is used for the test application and system integration with L1,available from the following link 
46 https://registrationcenter-download.intel.com/akdlm/irc_nas/emb/15322/system_studio_2019_update_3_composer_edition_offline.tar.gz
47
48 The Intel® C++ Compiler can be used with a community license generated from the text below save it to a file named license.lic
49
50 PACKAGE IF1C22FFF INTEL 2023.0331 4F89A5B28D2F COMPONENTS="CCompL \
51         Comp-CA Comp-CL Comp-OpenMP Comp-PointerChecker MKernL \
52         PerfPrimL ThreadBB" OPTIONS=SUITE ck=209 SIGN=9661868C5C80
53 INCREMENT IF1C22FFF INTEL 2023.0331 31-mar-2023 uncounted \
54         90F19E3889A3 VENDOR_STRING="SUPPORT=COM \
55         https://registrationcenter.intel.com" HOSTID=ID=07472690 \
56         PLATFORMS="i86_n i86_r i86_re amd64_re x64_n" ck=175 \
57         SN=SMSAJ7B6G8WS TS_OK SIGN=920966B67D16
58 PACKAGE IF1C22FFF INTEL 2023.0331 4F89A5B28D2F COMPONENTS="CCompL \
59         Comp-CA Comp-CL Comp-OpenMP Comp-PointerChecker MKernL \
60         PerfPrimL ThreadBB" OPTIONS=SUITE ck=209 SIGN=9661868C5C80
61 INCREMENT IF1C22FFF INTEL 2023.0331 31-mar-2023 uncounted \
62         32225D03FBAA VENDOR_STRING="SUPPORT=COM \
63         https://registrationcenter.intel.com" HOSTID=ID=07472690 \
64         PLATFORMS="i86_n i86_r i86_re amd64_re x64_n" ck=80 \
65         SN=SMSAJ7B6G8WS SIGN=2577A4F65138
66 PACKAGE IF1C22FFF INTEL 2023.0331 4F89A5B28D2F COMPONENTS="CCompL \
67         Comp-CA Comp-CL Comp-OpenMP Comp-PointerChecker MKernL \
68         PerfPrimL ThreadBB" OPTIONS=SUITE ck=209 SIGN=9661868C5C80
69 INCREMENT IF1C22FFF INTEL 2023.0331 31-mar-2023 uncounted \
70         90F19E3889A3 VENDOR_STRING="SUPPORT=COM \
71         https://registrationcenter.intel.com" HOSTID=ID=07472690 \
72         PLATFORMS="i86_n i86_r i86_re amd64_re x64_n" ck=175 \
73         SN=SMSAJ7B6G8WS TS_OK SIGN=920966B67D16
74 PACKAGE IF1C22FFF INTEL 2023.0331 4F89A5B28D2F COMPONENTS="CCompL \
75         Comp-CA Comp-CL Comp-OpenMP Comp-PointerChecker MKernL \
76         PerfPrimL ThreadBB" OPTIONS=SUITE ck=209 SIGN=9661868C5C80
77 INCREMENT IF1C22FFF INTEL 2023.0331 31-mar-2023 uncounted \
78         32225D03FBAA VENDOR_STRING="SUPPORT=COM \
79         https://registrationcenter.intel.com" HOSTID=ID=07472690 \
80         PLATFORMS="i86_n i86_r i86_re amd64_re x64_n" ck=80 \
81         SN=SMSAJ7B6G8WS SIGN=2577A4F65138
82 PACKAGE I4BB00C7C INTEL 2023.0331 8D6186E5077C COMPONENTS="Comp-CA \
83         Comp-CL Comp-OpenMP Comp-PointerChecker MKernL PerfPrimL \
84         ThreadBB" OPTIONS=SUITE ck=131 SIGN=7BB6EE06F9A6
85 INCREMENT I4BB00C7C INTEL 2023.0331 31-mar-2023 uncounted \
86         F1765BD5FCB4 VENDOR_STRING="SUPPORT=COM \
87         https://registrationcenter.intel.com" HOSTID=ID=07472690 \
88         PLATFORMS="i86_mac x64_mac" ck=114 SN=SMSAJ7B6G8WS \
89         SIGN=4EC364AC3576 
90     
91 Then copy license file to the build directory under license.lic ::
92
93          COPY license.lic $BUILD_DIR/license.lic
94     
95 *Note: Use serial number CG7X-J7B6G8WS*
96
97
98 You can follow the installation guide from above website to download Intel System Studio and install. Intel® Math Kernel Library, Intel® Integrated Performance Primitives and Intel® C++ Compiler are mandatory components.
99 Here we are using the Linux* Host,Linux* Target and standalone installer as one example, below link might need update based on the website ::
100
101          #wget https://registrationcenter-download.intel.com/akdlm/irc_nas/emb/15322/system_studio_2019_update_3_composer_edition_offline.tar.gz
102          #cd /opt && mkdir intel && cp $BUILD_DIR/license.lic intel/license.lic
103          #tar -zxvf $BUILD_DIR/system_studio_2019_update_3_composer_edition_offline.tar.gz
104
105 Edit system_studio_2019_update_3_composer_edition_offline/silent.cfg to accept the EULA file as below example::
106   
107          ACCEPT_EULA=accept
108          PSET_INSTALL_DIR=opt/intel
109          ACTIVATION_LICENSE_FILE=/opt/intel/license.lic
110          ACTIVATION_TYPE=license_file
111     
112 Silent installation::
113
114          #./install.sh -s silent.cfg
115
116 Set env for oneAPI or ICC:
117          Check for your installation path. The following is an example for ICC.
118          
119          #source /opt/intel_2019/system_studio_2019/compiler_and_libraries_2019.3.206/linux/bin/iccvars.sh intel64
120          #export PATH=/opt/intel_2019/system_studio_2019/compiler_and_libraries_2019.3.206/linux/bin/:$PATH
121
122
123 Download and Build DPDK
124 -----------------------
125    - download DPDK::
126      
127          #wget http://static.dpdk.org/rel/dpdk-20.11.3.tar.x
128          #tar -xf dpdk-20.11.3.tar.xz
129          #export RTE_TARGET=x86_64-native-linuxapp-icc
130          #export RTE_SDK=Intallation_DIR/dpdk-20.11.3
131
132    - patch DPDK for O-RAN FHI lib, this patch is specific for O-RAN FHI to reduce the data transmission latency of Intel NIC. This may not be needed for some NICs, please refer to |br| O-RAN FHI Lib Introduction -> setup configuration -> A.2 prerequisites
133
134    - SW FEC was enabled by default, to enable HW FEC with specific accelerator card, you need to get the associated driver and build steps from the accelerator card vendors.
135
136
137    - build DPDK
138         This release uses DPDK version 20.11.3 so the build procedure for the DPDK is the following
139  
140         Setup compiler environment
141         
142         if [ $oneapi -eq 1 ]; then
143            export RTE_TARGET=x86_64-native-linuxapp-icx
144            export WIRELESS_SDK_TOOLCHAIN=icx
145            export SDK_BUILD=build-${WIRELESS_SDK_TARGET_ISA}-icc
146            source /opt/intel/oneapi/setvars.sh
147            export PATH=$PATH:/opt/intel/oneapi/compiler/2022.0.1/linux/bin-llvm/
148            echo "Changing the toolchain to GCC 8.3.1 20190311 (Red Hat 8.3.1-3)"
149            source /opt/rh/devtoolset-8/enable
150            
151         else
152            export RTE_TARGET=x86_64-native-linuxapp-icc
153            export WIRELESS_SDK_TOOLCHAIN=icc
154            export SDK_BUILD=build-${WIRELESS_SDK_TARGET_ISA}-icc
155            source /opt/intel/system_studio_2019/bin/iccvars.sh intel64 -platform linux
156            
157         fi
158   
159
160         The build procedure uses meson and ninja so if not present in your system please install before the next step
161         
162         Then at the root of the DPDK folder issue::
163         
164            meson build
165            cd build
166            ninja
167         
168     - set DPDK path
169        DPDK path is needed during build and run lib/app::
170
171         #export RTE_SDK=Installation_DIR/dpdk-20.11.3
172         #export DESTDIR=Installation_DIR/dpdk-20.11.3
173
174
175 Install google test
176 -------------------
177 Download google test from https://github.com/google/googletest/releases 
178    - Example build and installation commands::
179
180         #tar -xvf googletest-release-1.7.0.tar.gz
181         #mv googletest-release-1.7.0 gtest-1.7.0
182         #export GTEST_DIR=YOUR_DIR/gtest-1.7.0
183         #export GTEST_ROOT= $GTEST_DIR
184         #cd ${GTEST_DIR}
185         #g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} -pthread -c ${GTEST_DIR}/src/gtest-all.cc
186         #ar -rv libgtest.a gtest-all.o
187         #cd ${GTEST_DIR}/build-aux
188         #cmake ${GTEST_DIR}
189         #make
190         #cd ${GTEST_DIR}
191         #ln -s build-aux/libgtest_main.a libgtest_main.a
192
193 - Set the google test Path
194    this path should be always here when you build and run O-RAN FH lib unit test::
195
196         #export DIR_ROOT_GTEST="your google test path"
197
198
199 Configure FEC card
200 --------------------
201 For the F Release either a SW FEC, or an FPGA FEC (Vista Creek N3000) or an ASIC FEC (Mount Bryce ACC100) can be used.
202 The procedure to configure the HW based FECs is explained below.
203
204 Customize a setup environment shell script
205 ------------------------------------------
206 Using as an example the provided in the folder phy\\setupenv.sh as the starting point
207 customize this script to provide the paths to the tools and libraries that
208 are used building and running the code.
209 You can add for example the following entries based on your particular installation and the
210 following illustration is just an example (use icx for oneApi instead of icc)::
211                                                                            
212 - export DIR_ROOT=/home/                                                           
213 - #set the L1 binary root DIR                                                      
214 - export DIR_ROOT_L1_BIN=$DIR_ROOT/FlexRAN                                         
215 - #set the phy root DIR                                                            
216 - export DIR_ROOT_PHY=$DIR_ROOT/phy                                                
217 - #set the DPDK root DIR                                                           
218 - #export DIR_ROOT_DPDK=/home/dpdk-20.11.3                                           
219 - #set the GTEST root DIR                                                          
220 - #export DIR_ROOT_GTEST=/home/gtest/gtest-1.7.0                                                                                                                   
221 - export DIR_WIRELESS_TEST_5G=$DIR_ROOT_L1_BIN/testcase                            
222 - export DIR_WIRELESS_SDK=$DIR_ROOT_L1_BIN/sdk/build-avx512-icc                    
223 - export DIR_WIRELESS_TABLE_5G=$DIR_ROOT_L1_BIN/l1/bin/nr5g/gnb/l1/table           
224 - #source /opt/intel/system_studio_2019/bin/iccvars.sh intel64 -platform linux     
225 - export XRAN_DIR=$DIR_ROOT_PHY/fhi_lib                                            
226 - export XRAN_LIB_SO=true                                                          
227 - export RTE_TARGET=x86_64-native-linuxapp-icc                                     
228 - #export RTE_SDK=$DIR_ROOT_DPDK                                                   
229 - #export DESTDIR=""                                                                                                                                              
230 - #export GTEST_ROOT=$DIR_ROOT_GTEST                                                                                                                             
231 - export ORAN_5G_FAPI=true                                                         
232 - export DIR_WIRELESS_WLS=$DIR_ROOT_PHY/wls_lib                                    
233 - export DEBUG_MODE=true                                                           
234 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DIR_WIRELESS_WLS:$XRAN_DIR/lib/build    
235 - export DIR_WIRELESS=$DIR_ROOT_L1_BIN/l1                                          
236 - export DIR_WIRELESS_ORAN_5G_FAPI=$DIR_ROOT_PHY/fapi_5g                           
237 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DIR_ROOT_L1_BIN/libs/cpa/bin        
238
239 Then issue::
240
241 - source ./setupenv.sh
242
243 This sets up the correct environment to build the code
244
245 Then build the wls_lib, FHI_Lib, 5G FAPI TM prior to running the code with the steps described in the Run L1 section
246                                                                                  
247
248
249
250
251
252
253