From 40a9792fef1ef5336e42b3283f4953899b5c166f Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Fri, 24 Dec 2021 21:36:06 +0100 Subject: [PATCH] build_oai flag to turn off AVX512 generation on machines that have it. Needed for caracal at EURECOM because of CUDA compiler which doesn't like the flag. Added creation of threadpool in nr_ulsim to test channel decoding parallelization on different high CPU count machines --- cmake_targets/CMakeLists.txt | 3 ++- cmake_targets/build_oai | 8 ++++++++ cmake_targets/phy_simulators/CMakeLists.txt | 1 + openair1/SIMULATION/NR_PHY/ulsim.c | 16 +++++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 88f9a3bb8e..90db856c50 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -301,7 +301,8 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") if(EXISTS "/proc/cpuinfo") file(STRINGS "/proc/cpuinfo" CPUINFO REGEX flags LIMIT_COUNT 1) - if (CPUINFO MATCHES "avx512bw") + message("NOAVX512 is ${NOAVX512}") + if (CPUINFO MATCHES "avx512bw" AND "${NOAVX512}" STREQUAL "False") set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx512bw -march=skylake-avx512 -mtune=skylake-avx512 " ) set(COMPILATION_AVX2 "True") else() diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index b427b161e5..2ef0c31210 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -62,6 +62,7 @@ CMAKE_CMD="$CMAKE" UE_AUTOTEST_TRACE="False" UE_DEBUG_TRACE="False" UE_TIMING_TRACE="False" +NOAVX512="False" USRP_REC_PLAY="False" BUILD_ECLIPSE=0 NR="False" @@ -161,6 +162,8 @@ Options Build optional shared library, can be one or several of $OPTIONAL_LIBRARIES or \"all\" --usrp-recplay Build for I/Q record-playback modes +--noavx512 + Build without AVX512 if it is present on CPU -k | --skip-shared-libraries Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes --ittiSIM @@ -417,6 +420,10 @@ function main() { USRP_REC_PLAY="True" echo_info "Enabling USRP record playback mode" shift 1;; + --noavx512) + NOAVX512="True" + echo_info "Disabling AVX512" + shift 1;; -k | --skip-shared-libraries) SKIP_SHARED_LIB_FLAG="True" echo_info "Skipping build of shared libraries, rfsimulator and transport protocol libraries" @@ -614,6 +621,7 @@ function main() { echo "set ( UE_DEBUG_TRACE $UE_DEBUG_TRACE )" >> $cmake_file echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file + echo "set ( NOAVX512 $NOAVX512 )" >> $cmake_file echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file diff --git a/cmake_targets/phy_simulators/CMakeLists.txt b/cmake_targets/phy_simulators/CMakeLists.txt index f8c659959f..b3e4267060 100755 --- a/cmake_targets/phy_simulators/CMakeLists.txt +++ b/cmake_targets/phy_simulators/CMakeLists.txt @@ -15,6 +15,7 @@ set ( UE_AUTOTEST_TRACE False ) set ( UE_DEBUG_TRACE False ) set ( UE_TIMING_TRACE False ) set ( USRP_REC_PLAY False ) +set ( NOAVX512 True ) set ( SKIP_SHARED_LIB_FLAG False ) set ( PHYSIM True) set ( RU 0) diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 97c753d455..d8e3437d03 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -319,6 +319,7 @@ int main(int argc, char **argv) int ibwps=24; int ibwp_rboffset=41; int params_from_file = 0; + int threadCnt=1; if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) { exit_fun("[NR_ULSIM] Error, configuration module init failed\n"); } @@ -329,7 +330,7 @@ int main(int argc, char **argv) /* initialize the sin-cos table */ InitSinLUT(); - while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:p:r:s:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) { + while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:p:r:s:t:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) { printf("handling optarg %c\n",c); switch (c) { @@ -454,7 +455,9 @@ int main(int argc, char **argv) snr0 = atof(optarg); printf("Setting SNR0 to %f\n", snr0); break; - + case 't': + threadCnt = atoi(optarg); + break; case 'u': mu = atoi(optarg); break; @@ -662,7 +665,14 @@ int main(int argc, char **argv) gNB->ofdm_offset_divisor = UINT_MAX; gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - char tp_param[] = "n"; + char tp_param[80]; + sprintf(tp_param,"-1"); + int s_offset = 0; + for (int icpu=1; icputhreadPool, false); initNotifiedFIFO(gNB->respDecode); gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));