Commit 13cbe0d0 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/offload-t1-lib' into integration_2023_w07

parents 07e2e797 972cbd5c
......@@ -140,29 +140,6 @@ set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
project (OpenAirInterface)
##############################################
# Base CUDA setting
##############################################
find_package(CUDA)
if (CUDA_FOUND)
message ("cuda include ${CUDA_INCLUDE_DIRS}")
message ("cuda library ${CUDA_LIBRARY_DIRS}")
add_definitions("-L/usr/local/cuda/lib64")
SET(CUDA_NVCC_FLAGS
"${CUDA_NVCC_FLAGS};-arch=sm_60;")
# Disable warnings for CUDA
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-lpthread;-w;-O3;--default-stream;per-thread;-I/usr/local/cuda/inc;-L/usr/local/cuda/lib -lcutil;-rdc=true;-lcudadevrt")
SET(CUDA_VERBOSE_BUILD ON)
SET(CUDA_SEPARABLE_COMPILATION ON)
else (CUDA_FOUND)
message ("No CUDA tool installed")
endif ()
####################################################
# compilation flags
#############################################
......@@ -618,26 +595,19 @@ target_link_libraries(benetel_5g PRIVATE asn1_nr_rrc asn1_lte_rrc)
# LDPC offload library
##########################################################
# there is no generic way to test for T1 Offload, it simply comes with the
# shared object
if (EXISTS "/usr/local/lib64/librte_pmd_hpac_sdfec_pmd.so")
set(T1_OFFLOAD_FOUND TRUE)
else()
set(T1_OFFLOAD_FOUND FALSE)
add_boolean_option(ENABLE_LDPC_T1 OFF "Build support for LDPC Offload to T1 library")
if (ENABLE_LDPC_T1)
pkg_check_modules(LIBDPDK_T1 REQUIRED libdpdk=20.05.0)
find_library(T1 NAMES rte_pmd_hpac_sdfec_pmd REQUIRED)
if (NOT T1)
message(FATAL_ERROR "Library rte_pmd_hpac_sdfec_pmd for T1 offload not found")
endif()
add_library(ldpc_t1 MODULE ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c)
set_target_properties(ldpc_t1 PROPERTIES COMPILE_FLAGS "-DALLOW_EXPERIMENTAL_API")
target_compile_options(ldpc_t1 PRIVATE ${LIBDPDK_T1_CFLAGS})
target_link_libraries(ldpc_t1 ${LIBDPDK_T1_LDFLAGS} ${T1})
endif()
if(T1_OFFLOAD_FOUND)
message(STATUS "T1 Offload support detected")
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib64/pkgconfig/")
pkg_search_module(LIBDPDK REQUIRED libdpdk=20.05.0)
add_library(ldpc_offload MODULE ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c)
set_target_properties(ldpc_offload PROPERTIES COMPILE_FLAGS "-DALLOW_EXPERIMENTAL_API")
target_compile_options(ldpc_offload PRIVATE ${LIBDPDK_CFLAGS})
target_link_libraries(ldpc_offload ${LIBDPDK_LDFLAGS} rte_pmd_hpac_sdfec_pmd "-Wl,-rpath /usr/local/lib64")
else()
message(STATUS "No T1 Offload support detected")
endif ()
##########################################################
include_directories ("${OPENAIR_DIR}/radio/COMMON")
......@@ -1033,16 +1003,26 @@ add_library(ldpc_cl MODULE ${PHY_LDPC_CL_SRC} )
target_link_libraries(ldpc_cl OpenCL)
add_dependencies(ldpc_cl nrLDPC_decoder_kernels_CL)
if (CUDA_FOUND)
cuda_add_library(ldpc_cuda MODULE ${PHY_LDPC_CUDA_SRC} )
##############################################
# Base CUDA setting
##############################################
add_boolean_option(BUILD_CUDA False "Build support for CUDA")
if (ENABLE_LDPC_CUDA)
find_package(CUDA REQUIRED)
SET(CUDA_NVCC_FLAG "${CUDA_NVCC_FLAGS};-arch=sm_60;")
SET(CUDA_VERBOSE_BUILD ON)
cuda_add_library(ldpc_cuda MODULE ${PHY_LDPC_CUDA_SRC})
set_target_properties(ldpc_cuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
# CUDA_ADD_CUFFT_TO_TARGET(ldpc_cuda)
endif (CUDA_FOUND)
if (NOT CUDA_FOUND)
message(FATAL_ERROR "no CUDA found")
endif()
endif()
add_library(ldpc MODULE ${PHY_LDPC_OPTIM8SEGMULTI_SRC} )
target_link_libraries(ldpc PRIVATE ldpc_gen_HEADERS)
add_library(coding MODULE ${PHY_TURBOSRC} )
target_link_libraries(coding PRIVATE asn1_nr_rrc asn1_lte_rrc)
......@@ -2384,11 +2364,11 @@ target_link_libraries(nr-softmodem PRIVATE ${LIB_LMS_LIBRARIES})
target_link_libraries(nr-softmodem PRIVATE ${T_LIB})
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc asn1_lte_rrc)
add_dependencies( nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc)
add_dependencies(nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc)
if(T1_OFFLOAD_FOUND)
add_dependencies( nr-softmodem ldpc_offload)
endif ()
if (ENABLE_LDPC_T1)
add_dependencies(nr-softmodem ldpc_t1)
endif()
# force the generation of ASN.1 so that we don't need to wait during the build
target_link_libraries(nr-softmodem PRIVATE
......@@ -2451,10 +2431,10 @@ target_link_libraries(nr-uesoftmodem PRIVATE ${T_LIB})
target_link_libraries(nr-uesoftmodem PRIVATE asn1_nr_rrc asn1_lte_rrc)
add_dependencies( nr-uesoftmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
if (CUDA_FOUND)
add_dependencies( nr-uesoftmodem ldpc_cuda)
add_dependencies( nr-softmodem ldpc_cuda)
endif (CUDA_FOUND)
if (ENABLE_LDPC_CUDA)
add_dependencies(nr-uesoftmodem ldpc_cuda)
add_dependencies(nr-softmodem ldpc_cuda)
endif()
# force the generation of ASN.1 so that we don't need to wait during the build
target_link_libraries(nr-uesoftmodem PRIVATE
......@@ -2523,9 +2503,9 @@ add_executable(ldpctest
)
add_dependencies( ldpctest ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
if (CUDA_FOUND)
add_dependencies( ldpctest ldpc_cuda)
endif (CUDA_FOUND)
if (ENABLE_LDPC_CUDA)
add_dependencies(ldpctest ldpc_cuda)
endif()
target_link_libraries(ldpctest PRIVATE
-Wl,--start-group UTIL SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} dl
......@@ -2634,9 +2614,9 @@ add_executable(nr_ulsim
${SHLIB_LOADER_SOURCES}
)
if(T1_OFFLOAD_FOUND)
add_dependencies( nr_ulsim ldpc_offload)
endif ()
if (ENABLE_LDPC_T1)
add_dependencies(nr_ulsim ldpc_t1)
endif()
target_link_libraries(nr_ulsim PRIVATE
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON lte_rrc nr_rrc CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE x2ap SECU_CN ngap NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group
......
......@@ -34,7 +34,7 @@
<mode>TesteNB</mode>
<class>Build_eNB</class>
<desc>Build gNB (USRP)</desc>
<Build_eNB_args>--gNB -w USRP --ninja -c -P</Build_eNB_args>
<Build_eNB_args>--gNB -w USRP --ninja -c -P --build-lib "ldpc_cuda"</Build_eNB_args>
<forced_workspace_cleanup>True</forced_workspace_cleanup>
</testCase>
......
......@@ -55,7 +55,7 @@ CMAKE_BUILD_TYPE="RelWithDebInfo"
CMAKE_CMD="$CMAKE"
BUILD_ECLIPSE=0
NR="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope ldpc_cuda ldpc_t1"
ulfiusdep=$(basename ./`find /usr/lib* -name libulfius.so`)
jssondep=$(basename ./`find /usr/lib* -name libjansson.so`)
if [ "$ulfiusdep" == "libulfius.so" -a "$jssondep" == "libjansson.so" ] ; then
......@@ -392,13 +392,16 @@ function main() {
if [ "$alib" = "$oklib" ] ; then
BUILD_OPTLIB="$BUILD_OPTLIB $alib"
echo_info "Enabling build of lib${alib}.so"
fi
done
done
if [ "${BUILD_OPTLIB## }" != "$2" ] ; then
echo_fatal "Unknown optional library in $2, valid libraries are $OPTIONAL_LIBRARIES"
fi
done
done
if [ "${BUILD_OPTLIB## }" != "$2" ] ; then
echo_fatal "Unknown optional library in $2, valid libraries are $OPTIONAL_LIBRARIES"
fi
fi
for oklib in $BUILD_OPTLIB ; do
CMAKE_CMD="$CMAKE_CMD -DENABLE_${oklib^^}=ON"
done
shift 2;;
--noavx512)
CMAKE_CMD="$CMAKE_CMD -DAVX512=OFF"
......
......@@ -144,7 +144,7 @@ cd cmake_targets
cd ~/openairinterface5g
source oaienv
cd cmake_targets
./build_oai -w USRP --ninja --nrUE --gNB --build-lib all -c
./build_oai -w USRP --ninja --nrUE --gNB --build-lib "telnetsrv nrscope" -c
```
# 4. Run OAI CN5G and OAI gNB
......
......@@ -35,4 +35,4 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 -c
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP --verbose-ci --noavx512 -c
......@@ -35,4 +35,4 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 -c
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP --verbose-ci --noavx512 -c
......@@ -1434,7 +1434,7 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t harq_pid,
argv_re[1] = "-l";
argv_re[2] = "31";
argv_re[3] = "-w";
argv_re[4] = "81:00.0";
argv_re[4] = "b0:00.0";
argv_re[5] = "--file-prefix=b6";
argv_re[6] = "--";
......
......@@ -75,7 +75,7 @@ int load_nrLDPClib_offload(void) {
loader_shlibfunc_t shlib_decoffload_fdesc;
shlib_decoffload_fdesc.fname = "nrLDPC_decod_offload";
int ret=load_module_shlib("ldpc_offload",&shlib_decoffload_fdesc,1,NULL);
int ret=load_module_shlib("ldpc_t1",&shlib_decoffload_fdesc,1,NULL);
AssertFatal( (ret >= 0),"Error loading ldpc decoder offload");
nrLDPC_decoder_offload = (nrLDPC_decoffloadfunc_t)shlib_decoffload_fdesc.fptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment