diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index ffd93d79cf..db51f2647c 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -342,6 +342,8 @@ class Containerize(): if self.ranAllowMerge and forceBaseImageBuild: mySSH.command(self.cli + ' image rm ' + baseImage + ':' + baseTag + ' || true', '\$', 30) mySSH.command(self.cli + ' image rm ran-build:' + imageTag + ' || true','\$', 5) + # Cleaning any created tmp volume + mySSH.command(self.cli + ' volume prune --force || true','\$', 15) mySSH.close() ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.') @@ -595,6 +597,8 @@ class Containerize(): mySSH.command('docker rm -f ' + containerName, '\$', 30) # Forcing the down now to remove the networks and any artifacts mySSH.command('docker-compose --file ci-docker-compose.yml down', '\$', 5) + # Cleaning any created tmp volume + mySSH.command('docker volume prune --force || true', '\$', 20) mySSH.close() @@ -754,6 +758,11 @@ class Containerize(): logging.error('\u001B[1m Undeploying OAI Object(s) FAILED\u001B[0m') return + # Cleaning any created tmp volume + cmd = 'docker volume prune --force || true' + logging.debug(cmd) + deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100) + HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK) logging.info('\u001B[1m Undeploying OAI Object(s) PASS\u001B[0m') diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index f01b85015b..4caa876719 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -346,7 +346,7 @@ class RANManagement(): #reboot USRP if requested in xml if self.USRPIPAddress!='': - logging.debug('USRP '+ self.USRPIPAddress +'reboot request') + logging.debug('USRP '+ self.USRPIPAddress +': reboot request') mySSH.open(lIpAddr, lUserName, lPassWord) cmd2usrp='ssh root@'+self.USRPIPAddress+' reboot' mySSH.command2(cmd2usrp,1) diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml index 9365d7f12e..f1185c08c9 100644 --- a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml @@ -21,21 +21,22 @@ --> - gNB-PHY-Test - Run-gNB-PHY-Test - tasks + gNB-PHY-Test + Run-gNB-PHY-Test + tasks 3 090101 000001 090109 - - - Initialize_eNB - Initialize gNB USRP + + + Initialize_eNB + Initialize gNB USRP -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 --log_config.global_log_options level,nocolor,time NR - + 192.168.30.2 + IdleSleep @@ -44,10 +45,10 @@ - - Terminate_eNB - Terminate gNB + + Terminate_eNB + Terminate gNB NR - + diff --git a/ci-scripts/xml_files/simple_dummy_build.xml b/ci-scripts/xml_files/simple_dummy_build.xml index 75e5f6339a..a3649c210c 100644 --- a/ci-scripts/xml_files/simple_dummy_build.xml +++ b/ci-scripts/xml_files/simple_dummy_build.xml @@ -25,7 +25,7 @@ Build wrench - 010101 + 000001 @@ -38,4 +38,10 @@ 0 + + IdleSleep + Sleep + 5 + + diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index abf9cd1145..f2eda66fc0 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1541,6 +1541,10 @@ set(PHY_LDPC_CL_SRC ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c ) +add_custom_target( nrLDPC_decoder_kernels_CL + COMMAND gcc ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c -dD -DNRLDPC_KERNEL_SOURCE -E -o ${CMAKE_CURRENT_BINARY_DIR}/nrLDPC_decoder_kernels_CL.clc + SOURCES ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c +) set(PHY_NR_CODINGIF ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_load.c; @@ -1551,6 +1555,7 @@ add_library(ldpc_optim MODULE ${PHY_LDPC_OPTIM_SRC} ) add_library(ldpc_optim8seg MODULE ${PHY_LDPC_OPTIM8SEG_SRC} ) 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} ) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 7eeba80920..a23d4eca9d 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -892,20 +892,10 @@ install_asn1c_from_source(){ ################################################ install_nas_tools() { - if [ ! -f .ue.nvram0 ]; then - echo_success "generate .ue_emm.nvram .ue.nvram" - ./nvram --gen -c $1 -o $2 - else - [ ./nvram -nt .ue.nvram0 -o ./nvram -nt .ue_emm.nvram0 ] && ./nvram --gen -c $1 -o $2 - fi - - if [ ! -f .usim.nvram0 ]; then - echo_success "generate .usim.nvram" - ./usim --gen -c $1 -o $2 > "$3" - else - [ ./usim -nt .usim.nvram0 ] && ./usim --gen -c $1 -o $2 - fi - + echo_success "generate .ue_emm.nvram .ue.nvram" + ./nvram --gen -c $1 -o $2 > "$3" + echo_success "generate .usim.nvram" + ./usim --gen -c $1 -o $2 >> "$3" } diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index b961a5db67..d336c1f229 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -224,11 +224,9 @@ configmodule_interface_t *load_configmodule(int argc, cfgparam = getenv("OAI_CONFIGMODULE"); } - /* default different for UE and softmodem because UE doesn't use config file*/ + /* default different for UE and softmodem because UE may run without config file */ /* and -O option is not mandatory for UE */ /* phy simulators behave as UE */ - /* test of exec name would better be replaced by a parameter to the l */ - /* oad_configmodule function */ if (cfgparam == NULL) { tmpflags = tmpflags | CONFIG_NOOOPT; @@ -254,9 +252,14 @@ configmodule_interface_t *load_configmodule(int argc, } cfgptr = calloc(sizeof(configmodule_interface_t),1); + /* argv_info is used to memorize command line options which have been recognized */ + /* and to detect unrecognized command line options which might have been specified */ cfgptr->argv_info = calloc(sizeof(int32_t), argc); + /* argv[0] is the exec name, always Ok */ cfgptr->argv_info[0] |= CONFIG_CMDLINEOPT_PROCESSED; + /* when OoptIdx is >0, -O option has been detected at position OoptIdx + * we must memorize arv[OoptIdx is Ok */ if (OoptIdx >= 0) { cfgptr->argv_info[OoptIdx] |= CONFIG_CMDLINEOPT_PROCESSED; cfgptr->argv_info[OoptIdx+1] |= CONFIG_CMDLINEOPT_PROCESSED; diff --git a/common/utils/LOG/DOC/log.md b/common/utils/LOG/DOC/log.md index 4b3e5981e1..4d97e3845d 100644 --- a/common/utils/LOG/DOC/log.md +++ b/common/utils/LOG/DOC/log.md @@ -8,7 +8,7 @@ By default, this facility is included at build-time and activated at run-time. T ```bash /build_oai --disable-T-Tracer ``` -- To use the the T-Tracer instead of the console logging facility, use the command line option *T_stdout*. *T_stdout* is a boolean option, which, when set to 0 (false) disable the console logging facility. All stdout messages are then sent to the T-Tracer. +- To use the the T-Tracer, use the command line option *T_stdout*. When set to 0, it disables the console logging facility. All stdout messages are then sent to the T-Tracer. When set to 1 (the default), the logs are output to the linux console and no T trace is generated. When set to 2 both console logging and T traces are activated. ## Documentation diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index d644445424..350337b61b 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -428,12 +428,12 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # if T_TRACER /* per component, level dependent macros */ -# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0) -# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0) +# define LOG_E(c, x...) do { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} } while (0) +# define LOG_W(c, x...) do { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)); if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x);} } while (0) # define LOG_A LOG_I -# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) -# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0) -# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0) +# define LOG_I(c, x...) do { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} } while (0) +# define LOG_D(c, x...) do { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} } while (0) +# define LOG_T(c, x...) do { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} } while (0) # define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0) /* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ diff --git a/common/utils/T/T.c b/common/utils/T/T.c index 8ee359b77f..49742bf600 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -217,6 +217,11 @@ void T_Config_Init(void) { sizeof(ttraceparams) / sizeof(paramdef_t), NULL); - if (T_stdout == 0) + if (T_stdout < 0 || T_stdout > 2) { + printf("fatal error: T_stdout = %d but only values 0, 1, or 2 are allowed\n", T_stdout); + exit(1); + } + + if (T_stdout == 0 || T_stdout == 2) T_init(T_port, 1-T_nowait, T_dont_fork); } diff --git a/common/utils/T/T.h b/common/utils/T/T.h index 626dbafd25..0142945054 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -100,7 +100,7 @@ extern int T_stdout; 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__) #define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\ n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n -#define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0) +#define T(...) do { if (T_stdout == 0 || T_stdout == 2) TN(__VA_ARGS__); } while (0) /* type used to send arbitrary buffer data */ typedef struct { @@ -607,7 +607,7 @@ extern int *T_active; {"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:TTRACER_DEFAULT_PORTNUM, TYPE_INT, 0},\ {"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0},\ {"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0},\ - {"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0},\ + {"T_stdout", CONFIG_HLP_STDOUT, 0, iptr:&T_stdout, defintval:1, TYPE_INT, 0},\ } diff --git a/common/utils/utils.h b/common/utils/utils.h index 46ca9b8b2f..5963ae0c8e 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -13,12 +13,12 @@ extern "C" { #include #include - #ifdef MALLOC_TRACE - #define malloc myMalloc - #endif +#ifdef MALLOC_TRACE +#define malloc myMalloc +#endif #define sizeofArray(a) (sizeof(a)/sizeof(*(a))) - + #define cmax(a,b) ((a>b) ? (a) : (b)) #define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c)) #define cmin(a,b) ((aframe_tx, proc->nr_slot_tx); uint8_t gNB_id = 0; + if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) { + /* send tick to RLC and PDCP every ms */ + if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) { + void nr_rlc_tick(int frame, int subframe); + void nr_pdcp_tick(int frame, int subframe); + nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); + nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); + } + } + if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){ if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) { @@ -720,14 +730,6 @@ void processSlotRX(void *arg) { protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); pdcp_run(&ctxt); - - /* send tick to RLC and PDCP every ms */ - if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) { - void nr_rlc_tick(int frame, int subframe); - void nr_pdcp_tick(int frame, int subframe); - nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); - nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); - } } // calling UL_indication to schedule things other than PUSCH (eg, PUCCH) rxtxD->ue_sched_mode = NOT_PUSCH; diff --git a/openair1/PHY/CODING/DOC/LDPCImplementation.md b/openair1/PHY/CODING/DOC/LDPCImplementation.md index c5411540b6..a82c204074 100644 --- a/openair1/PHY/CODING/DOC/LDPCImplementation.md +++ b/openair1/PHY/CODING/DOC/LDPCImplementation.md @@ -24,12 +24,33 @@ loading `libldpc_cl.so` instead of `libldpc.so`: `make ldpc_cl` -`cp ../../../openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl` +This command creates the `libldpc_cl.so` shared library. To perform this build successfully, only the OpenCL header `(/usr/include/CL/opencl.h)` and library `(/usr/lib/x86_64-linux-gnu/libOpenCL.so)`are required, they implement OpenCL API support which is not hardware dependent. + +``` +Scanning dependencies of target nrLDPC_decoder_kernels_CL +Built target nrLDPC_decoder_kernels_CL +Scanning dependencies of target ldpc_cl +Building C object CMakeFiles/ldpc_cl.dir/usr/local/oai/oai-develop/openairinterface5g/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c.o +In file included from /usr/include/CL/cl.h:32, + from /usr/include/CL/opencl.h:38, + from /usr/local/oai/oai-develop/openairinterface5g/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c:49: +/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2) + #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)") + ^~~~~~~ + +Building C object CMakeFiles/ldpc_cl.dir/usr/local/oai/oai-develop/openairinterface5g/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c.o +Linking C shared module libldpc_cl.so +Built target ldpc_cl + +``` + +At runtime, to successfully use hardware acceleration via OpenCL, you need to install vendor specific packages which deliver the required drivers and tools to make use of their GPU (Nvidia, Intel...) , fpga (Xilinx, Intel) or CPU (Intel, AMD, ARM...) through OpenCL. `./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.serveraddr server --sa --log_config.gtpu_log_level info --loader.ldpc.shlibversion _cl` -``` [LOADER] library libldpc_cl.so successfully loaded +``` ------------------------------------------------ +[LOADER] library libldpc_cl.so successfully loaded [HW] Platform 0, OpenCL profile FULL_PROFILE [HW] Platform 0, OpenCL version OpenCL 2.1 LINUX [HW] Device 0 is available @@ -62,8 +83,9 @@ loading `libldpc_cl.so` instead of `libldpc.so`: `./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa -O libconfig:/usr/local/oai/conf/nrue_sim.conf:dbgl5 --nokrnmod --loader.ldpc.shlibversion _cl --log_config.hw_log_level info` -```[CONFIG] shlibversion set to _cl from command line +``` ............................................................ +[CONFIG] shlibversion set to _cl from command line [CONFIG] loader.ldpc 1 options set from command line [LOADER] library libldpc_cl.so successfully loaded [HW] Platform 0, OpenCL profile FULL_PROFILE @@ -94,7 +116,6 @@ loading `libldpc_cl.so` instead of `libldpc.so`: [HW] Device 0, max Work Items size for dimension: 1 512 [HW] Device 0, max Work Items size for dimension: 2 512 ------------------------------------------------------------ -​``` ``` A mechanism to select ldpc implementation is also available in the `ldpctest` phy simulator via the `-v`option, which can be used to specify the version of the ldpc shared library to be used. @@ -103,7 +124,9 @@ A mechanism to select ldpc implementation is also available in the `ldpctest` ph Loading libldpc_cuda.so, the cuda implementation of the ldpc decoder: -```$ ./ldpctest -v _cuda +``` +$ ./ldpctest -v _cuda +ldpctest -v _cuda Initializing random number generator, seed 0 block length 8448: n_trials 1: @@ -119,18 +142,16 @@ log init done [CONFIG] loader.ldpc: 1/2 parameters successfully set [LOADER] library libldpc_cuda.so successfully loaded ................................... -​``` ``` + Loading libldpc_cl.so, the opencl implementation of the ldpc decoder: `make ldpc_cl` -`cp ../../../openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl` -`./ldpctest -v _cl` - -```$ ./ldpctest -v _cl +``` +$ ./ldpctest -v _cl Initializing random number generator, seed 0 block length 8448: n_trials 1: @@ -164,7 +185,6 @@ log init done [HW] Device 0, max Work Items size for dimension: 1 512 [HW] Device 0, max Work Items size for dimension: 2 512 ................................ -​``` ``` @@ -174,6 +194,6 @@ Libraries implementing the LDPC algorithms must be named `libldpc<_version>.so`, `libldpc_cuda.so`has been tested with the `ldpctest` executable, usage from the softmodem's has to be tested. -`libldpc_cl`is under development. +`libldpc_cl.so`is under development. [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index aff707a1d5..371deba3f2 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -514,7 +514,7 @@ int main(int argc, char *argv[]) unsigned char qbits=8; unsigned int decoded_errors[10000]; // initiate the size of matrix equivalent to size of SNR int c,i=0, i1 = 0; - + int loglvl=OAILOG_WARNING; int n_trials = 1; double SNR_step = 0.1; @@ -525,8 +525,11 @@ int main(int argc, char *argv[]) n_iter_stats_t dec_iter[3]; short BG=0,Zc,Kb=0; - - while ((c = getopt (argc, argv, "q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1) + if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) { + exit_fun(" Error, configuration module init failed\n"); + } // must be done before specific options parsing to prevent errasing them + + while ((c = getopt (argc, argv, "q:r:s:S:l:L:G:n:d:i:t:u:hv:")) != -1) switch (c) { case 'q': @@ -544,6 +547,10 @@ int main(int argc, char *argv[]) case 'l': block_length = atoi(optarg); break; + + case 'L': + loglvl = atoi(optarg); + break; case 'G': ldpc_version="_cuda"; @@ -581,10 +588,11 @@ int main(int argc, char *argv[]) printf("BG1 (blocklength > 3840): 1/3, 2/3, 22/25 (8/9) \n"); printf("BG2 (blocklength <= 3840): 1/5, 1/3, 2/3 \n\n"); printf("-h This message\n"); + printf("-L \n"); printf("-q Quantization bits, Default: 8\n"); printf("-r Nominator rate, (1, 2, 22), Default: 1\n"); printf("-d Denominator rate, (3, 5, 25), Default: 1\n"); - printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n"); + printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n"); printf("-G give 1 to run cuda for LDPC, Default: 0\n"); printf("-n Number of simulation trials, Default: 1\n"); //printf("-M MCS2 for TB 2\n"); @@ -603,6 +611,8 @@ int main(int argc, char *argv[]) printf("n_trials %d: \n", n_trials); printf("SNR0 %f: \n", SNR0); + logInit(); + set_glog(loglvl); if (ldpc_version != NULL) load_nrLDPClib(ldpc_version); diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c index 58e6b507af..c60286ab3a 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c @@ -25,15 +25,7 @@ * \version 1.0 * \note initial implem - translation of cuda version */ -/* uses HW component id for log messages ( --log_config.hw_log_level ) */ -#include -#include -#include -#include -#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" -#include "PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h" -#include "assertions.h" -#include "common/utils/LOG/log.h" + #define MAX_ITERATION 2 #define MC 1 @@ -41,16 +33,29 @@ #define MAX_OCLDEV 10 #define MAX_OCLRUNTIME 5 - -#define CLSETKERNELARG(A,B,C,D) \ -rt=clSetKernelArg(A,B,C,D) ;\ -AssertFatal(rt == CL_SUCCESS, "Error %d setting kernel argument index %d\n" , (int)rt, B); - typedef struct{ char x; char y; short value; } h_element; + +#ifdef NRLDPC_KERNEL_SOURCE +#include "nrLDPC_decoder_kernels_CL.c" +#else +/* uses HW component id for log messages ( --log_config.hw_log_level ) */ +#include +#include +#include +#include +#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" +#include "PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h" +#include "assertions.h" +#include "common/utils/LOG/log.h" + +#define CLSETKERNELARG(A,B,C,D) \ +rt=clSetKernelArg(A,B,C,D) ;\ +AssertFatal(rt == CL_SUCCESS, "Error %d setting kernel argument index %d\n" , (int)rt, B); + #include "../nrLDPC_decoder_LYC/bgs/BG1_compact_in_C.h" typedef struct{ @@ -213,20 +218,31 @@ void get_CompilErr(cl_program program, int pltf) { } -size_t load_source(char **source_str) { - int MAX_SOURCE_SIZE=(500*132); +size_t load_source(char **source_str, char *filename) { FILE *fp; + struct stat st ; size_t source_size; - - fp = fopen("nrLDPC_decoder_kernels_CL.cl", "r"); - AssertFatal(fp,"failed to open cl source: %s\n",strerror(errno)); + char *src= NULL; - *source_str = (char*)malloc(MAX_SOURCE_SIZE); - source_size = fread( *source_str, 1, MAX_SOURCE_SIZE, fp); - fclose( fp ); - return source_size; + if (filename == NULL) { + src = "nrLDPC_decoder_kernels_CL.clc"; + } else { + src = filename; + } + fp = fopen(src, "r"); + AssertFatal(fp,"failed to open cl source %s: %s\n",src,strerror(errno)); + + fstat(fileno(fp), &st); + source_size = st.st_size; + *source_str = (char*)malloc(source_size); + source_size = fread( *source_str, 1, source_size, fp); + fclose( fp ); + LOG_I(HW,"Loaded kernel sources from %s %u bytes\n", (filename==NULL)?"embedded cl code":src,(unsigned int)source_size ); + return source_size; } + + /* from here: entry points in decoder shared lib */ int ldpc_autoinit(void) { // called by the library loader cl_platform_id platforms[10]; @@ -284,11 +300,11 @@ int ldpc_autoinit(void) { // called by the library loader ocl.runtime[i].dev_tmp = clCreateBuffer(ocl.runtime[i].context, CL_MEM_READ_ONLY|CL_MEM_HOST_WRITE_ONLY, 68*384, NULL, (cl_int *)&rt); AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_tmp for platform %i \n" , (int)rt, i); char *source_str; - size_t source_size=load_source(&source_str); + size_t source_size=load_source(&source_str,"nrLDPC_decoder_kernels_CL.clc"); cl_program program = clCreateProgramWithSource(ocl.runtime[i].context, 1, (const char **)&source_str, (const size_t *)&source_size, (cl_int *)&rt); AssertFatal(rt == CL_SUCCESS, "Error %d creating program for platform %i \n" , (int)rt, i); - rt = clBuildProgram(program, ocl.runtime[i].num_devices,ocl.runtime[i].devices, NULL, NULL, NULL); + rt = clBuildProgram(program, ocl.runtime[i].num_devices,ocl.runtime[i].devices, NULL /* compile options */, NULL, NULL); if (rt == CL_BUILD_PROGRAM_FAILURE) { get_CompilErr(program,i); } @@ -434,3 +450,4 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_ return MAX_ITERATION; } +#endif //NRLDPC_KERNEL_SOURCE diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.c similarity index 98% rename from openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl rename to openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.c index d5e2fa5695..42b25e41c0 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.c @@ -29,16 +29,7 @@ * \note initial implem - translation of cuda version * \warning */ -#define define MAX_ITERATION 2 -#define MC 1 -#define INT32_MAX 2147483647 - -typedef struct{ - char x; - char y; - short value; -} h_element; //__global char dev_dt [46*68*384]; //__local char *dev_t; @@ -46,7 +37,7 @@ typedef struct{ //__global unsigned char dev_tmp[68*384]; - +#define INT32_MAX 2147483647 //__constant h_element dev_h_compact1[46*19] = {}; // used in kernel 1 //__constant h_element dev_h_compact2[68*30] = {}; // used in kernel 2 @@ -299,4 +290,3 @@ __kernel void pack_decoded_bit(__global unsigned char * dev_llr, __global unsign } } } - diff --git a/openair1/PHY/CODING/nrLDPC_load.c b/openair1/PHY/CODING/nrLDPC_load.c index 23e5032bad..3049070cd6 100644 --- a/openair1/PHY/CODING/nrLDPC_load.c +++ b/openair1/PHY/CODING/nrLDPC_load.c @@ -46,14 +46,14 @@ static loader_shlibfunc_t shlib_fdesc[3]; /* arguments used when called from phy simulators exec's which do not use the config module */ /* arg is used to initialize the config module so that the loader works as expected */ -char *arg[64]={"ldpctest","-O","cmdlineonly::dbgl0",NULL,NULL}; +char *arg[64]={"ldpctest",NULL}; int load_nrLDPClib(char *version) { char *ptr = (char*)config_get_if(); char libname[64]="ldpc"; if ( ptr==NULL ) {// phy simulators, config module possibly not loaded - load_configmodule(0,(char **)NULL,CONFIG_ENABLECMDLINEONLY) ; + load_configmodule(1,arg,CONFIG_ENABLECMDLINEONLY) ; logInit(); } shlib_fdesc[0].fname = "nrLDPC_decod"; diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 347155ed3b..35bc28d9c1 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -250,11 +250,9 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, int Ncp = NFAPI_CP_NORMAL; int mu = cfg->ssb_config.scs_common.value; -#if DISABLE_LOG_X - printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp); -#else + LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp); -#endif + if (Ncp == NFAPI_CP_EXTENDED) AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu); @@ -343,11 +341,8 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + uplink_frequency_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + uplink_frequency_offset); -#if DISABLE_LOG_X - printf("Initializing UE frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp); -#else LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp); -#endif + if (Ncp == NFAPI_CP_EXTENDED) AssertFatal(fp->numerology_index == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, fp->numerology_index); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c index e0cf694fff..67d811b753 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c @@ -49,7 +49,6 @@ void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, uint32_t x1=0, x2=0, s=0; reset = 1; - // x1 is set in lte_gold_generic x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1 for (i=0; i<32; i++) { diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 28dd5ab219..681a9eae16 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1174,7 +1174,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, uint8_t aarx, aatx; uint32_t nb_re_pusch, bwp_start_subcarrier; - int avgs; + int avgs = 0; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 8844a530af..22c8ff0b0e 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -302,7 +302,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, int32_t corr_re[1+frame_parms->nb_antennas_rx][2]; int32_t corr_im[1+frame_parms->nb_antennas_rx][2]; //int32_t no_corr = 0; - int seq_index; + int seq_index = 0; int64_t temp; for(i=0;iC,harq_process->K); - opp_enabled=1; Kr = harq_process->K; // [hna] overwrites this line "Kr = p_decParams->Z*kb" Kr_bytes = Kr>>3; offset = 0; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 0894ae9166..b4edae972a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -379,13 +379,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, len = (pilots==1)? ((config_type==NFAPI_NR_DMRS_TYPE1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12); stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", - frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", - frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#endif + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", + frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); n_tx = dlsch0_harq->Nl; @@ -402,11 +399,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, nb_rb_pdsch); stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#endif + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (first_symbol_flag==1) { if (beamforming_mode==0){ @@ -463,11 +458,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#endif + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); // Now channel compensation @@ -515,11 +507,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, } stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#endif + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (frame_parms->nb_antennas_rx > 1) { @@ -574,11 +564,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, } stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#endif + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); /* Store the valid DL RE's */ pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = len; @@ -657,11 +645,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, } stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); -#endif + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); // Please keep it: useful for debugging #ifdef DEBUG_PDSCH_RX diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 767edf9cc6..2963ad5010 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -353,21 +353,15 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) ) { ret=-1; -#if DISABLE_LOG_X - printf("Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); -#else LOG_E(HW, "Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); -#endif }*/ if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters //#ifdef DEBUG_INITIAL_SYNCH -#if DISABLE_LOG_X - printf("[UE%d] In synch, rx_offset %d samples\n",ue->Mod_id, ue->rx_offset); -#else + LOG_I(PHY, "[UE%d] In synch, rx_offset %d samples\n",ue->Mod_id, ue->rx_offset); -#endif + //#endif if (ue->UE_scan_carrier == 0) { diff --git a/openair1/PHY/TOOLS/lte_enb_scope.c b/openair1/PHY/TOOLS/lte_enb_scope.c index bed507feee..7fde9f244c 100644 --- a/openair1/PHY/TOOLS/lte_enb_scope.c +++ b/openair1/PHY/TOOLS/lte_enb_scope.c @@ -49,9 +49,15 @@ void reset_stats(FL_OBJECT *button, long arg) { int i,j,k; PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; - for (i=0; idlsch[i][0]->Mlimit; j++) { + printf("XXX %d %d %d\n", + sizeofArray(phy_vars_eNB->UE_stats), + sizeofArray( phy_vars_eNB->UE_stats[i].dlsch_NAK), + sizeofArray( *phy_vars_eNB->UE_stats[i].dlsch_NAK) + ); + + for (i=0; iUE_stats); i++) { + for (k=0; kUE_stats[i].dlsch_NAK); k++) { //harq_processes + for (j=0; jUE_stats[i].dlsch_NAK); j++) { phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; @@ -67,7 +73,6 @@ void reset_stats(FL_OBJECT *button, long arg) { } } - static void *scope_thread_eNB(void *arg) { struct sched_param sched_param; int UE_id, CC_id; @@ -75,7 +80,6 @@ static void *scope_thread_eNB(void *arg) { sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; sched_setscheduler(0, SCHED_FIFO,&sched_param); printf("Scope thread has priority %d\n",sched_param.sched_priority); - while (!oai_exit) { ue_cnt=0; diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index 1b62687f7e..353f170434 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -51,24 +51,7 @@ double get_cpu_freq_GHz(void) return cpu_freq_GHz; } -int cpumeas(int action) -{ - switch (action) { - case CPUMEAS_ENABLE: - opp_enabled = 1; - break; - case CPUMEAS_DISABLE: - opp_enabled = 0; - break; - - case CPUMEAS_GETSTATE: - default: - break; - } - - return opp_enabled; -} void print_meas_now(time_stats_t *ts, const char *name, diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index bb2bb3d276..56d8299470 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -115,7 +115,24 @@ static inline uint32_t rdtsc_oai(void) { #define CPUMEAS_DISABLE 0 #define CPUMEAS_ENABLE 1 #define CPUMEAS_GETSTATE 2 -int cpumeas(int action); +static inline int cpumeas(int action) { + switch (action) { + case CPUMEAS_ENABLE: + opp_enabled = 1; + break; + + case CPUMEAS_DISABLE: + opp_enabled = 0; + break; + + case CPUMEAS_GETSTATE: + default: + break; + } + + return opp_enabled; +} + static inline void start_meas(time_stats_t *ts) { if (opp_enabled) { if (ts->meas_flag==0) { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index e403c7410b..b0ad4b4a83 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -855,8 +855,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ } else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); stop_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]); - LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0)); - + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0)); if(first_symbol_flag) { proc->first_symbol_available = 1; } @@ -1031,14 +1031,13 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY, "In %s DL PDU length in bits: %d, in bytes: %d \n", __FUNCTION__, dlsch0->harq_processes[harq_pid]->TBS, dlsch0->harq_processes[harq_pid]->TBS / 8); - - - - stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); - LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n", - (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); - LOG_D(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n", - frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); + stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); + if (cpumeas(CPUMEAS_GETSTATE)) { + LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n", + (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); + LOG_D(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n", + frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); + } if(is_cw1_active) { // start ldpc decode for CW 1 @@ -1090,21 +1089,15 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_T(PHY,"CWW sequential dlsch decoding, ret1 = %d\n", ret1); } - stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); - - LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n", - (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); - LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", - frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); - LOG_D(PHY,"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", - frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); - - LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); + if (cpumeas(CPUMEAS_GETSTATE)) { + LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n", + (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); + LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", + frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); + } + LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); } - - LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ decoded in %d \n", frame_rx, nr_slot_rx, ret); - // send to mac if (ue->if_inst && ue->if_inst->dl_indication) { ue->if_inst->dl_indication(&dl_indication, ul_time_alignment); @@ -1405,8 +1398,8 @@ void *UE_thread_slot1_dl_processing(void *arg) { stop_meas(&ue->ue_front_end_per_slot_stat[proc->thread_id][1]); - LOG_D(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,nr_slot_rx,ue->ue_front_end_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0)); - + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,nr_slot_rx,ue->ue_front_end_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0)); //wait until pdcch is decoded uint32_t wait = 0; @@ -1495,7 +1488,8 @@ void *UE_thread_slot1_dl_processing(void *arg) { //printf("Set available LLR slot1 to 1 AbsSubframe %d.%d \n",frame_rx,nr_slot_rx); stop_meas(&ue->pdsch_procedures_per_slot_stat[proc->thread_id][1]); - LOG_D(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,nr_slot_rx,ue->pdsch_procedures_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0)); + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,nr_slot_rx,ue->pdsch_procedures_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0)); if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" ); @@ -1864,9 +1858,10 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, dlsch_parallel); stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]); - LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); - LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); - + if (cpumeas(CPUMEAS_GETSTATE)) { + LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); + } // deactivate dlsch once dlsch proc is done ue->dlsch[proc->thread_id][gNB_id][0]->active = 0; @@ -1941,6 +1936,8 @@ if (nr_slot_rx==9) { } stop_meas(&ue->generic_stat); +if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0)); #ifdef EMOS phy_procedures_emos_UE_RX(ue,slot,gNB_id); @@ -1950,7 +1947,9 @@ phy_procedures_emos_UE_RX(ue,slot,gNB_id); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); stop_meas(&ue->phy_proc_rx[proc->thread_id]); -LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0)); +if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0)); + //#endif //pdsch diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 84c6c3ee5f..4a0da8eade 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -402,7 +402,7 @@ int main(int argc, char **argv) NR_UE_MAC_INST_t *UE_mac; int cyclic_prefix_type = NFAPI_CP_NORMAL; int run_initial_sync=0; - int loglvl=OAILOG_INFO; + int loglvl=OAILOG_WARNING; //float target_error_rate = 0.01; int css_flag=0; @@ -647,6 +647,7 @@ int main(int argc, char **argv) printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]); printf("-h This message\n"); + printf("-L \n"); //printf("-p Use extended prefix mode\n"); //printf("-d Use TDD\n"); printf("-n Number of frames to simulate\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index db8d54f86d..ceeded145a 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -275,7 +275,7 @@ int main(int argc, char **argv) //unsigned char frame_type = 0; NR_DL_FRAME_PARMS *frame_parms; - int loglvl = OAILOG_INFO; + int loglvl = OAILOG_WARNING; //uint64_t SSB_positions=0x01; uint16_t nb_symb_sch = 12; int start_symbol = 0; @@ -603,6 +603,7 @@ int main(int argc, char **argv) //printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n"); printf("-F Input filename (.txt format) for RX conformance testing\n"); printf("-G Offset of samples to read from file (0 default)\n"); + printf("-L \n"); printf("-M Multiple SSB positions in burst\n"); printf("-N Nid_cell\n"); printf("-O oversampling factor (1,2,4,8,16)\n"); @@ -643,7 +644,7 @@ int main(int argc, char **argv) else if (N_RB_UL == 106) bandwidth = 40; else if (N_RB_UL == 32) bandwidth = 50; else { printf("Add N_RB_UL %d\n",N_RB_UL); exit(-1); } - + LOG_I( PHY,"++++++++++++++++++++++++++++++++++++++++++++++%i+++++++++++++++++++++++++++++++++++++++++",loglvl); if (openair0_cfg[0].threequarter_fs == 1) sampling_frequency*=.75; UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 13945998d7..013e542689 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -820,7 +820,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,""); - //randominit(0); + // we need to call randominit() for telnet server (use gaussdouble=>uniformrand) + randominit(0); set_taus_seed(0); /* look for telnet server, if it is loaded, add the channel modeling commands to it */ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);