simplify thread pool configuration

fix segv

fix bug redeclaration of same struct in phy sim

Apply 1 suggestion(s) to 1 file(s)

code reveiw comments
This commit is contained in:
laurent
2022-09-02 11:36:47 +02:00
parent 8229f00d0e
commit aa2a36768c
63 changed files with 81 additions and 153 deletions
+10 -2
View File
@@ -48,6 +48,7 @@
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "executables/nr-uesoftmodem.h"
//#define DEBUG_NR_DLSCHSIM
@@ -73,6 +74,13 @@ openair0_config_t openair0_cfg[MAX_CARDS];
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
nrUE_params_t nrUE_params={0};
nrUE_params_t *get_nrUE_params(void) {
return &nrUE_params;
}
int main(int argc, char **argv)
{
char c;
@@ -344,7 +352,6 @@ int main(int argc, char **argv)
if (snr1set == 0)
snr1 = snr0 + 10;
init_dlsch_tpool(dlsch_threads);
if (ouput_vcd)
vcd_signal_dumper_init("/tmp/openair_dump_nr_dlschsim.vcd");
@@ -363,7 +370,8 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
initTpool(gNBthreads, &gNB->threadPool, true);
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool");
//gNB_config = &gNB->gNB_config;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx;
+5 -13
View File
@@ -73,6 +73,7 @@
#include <executables/softmodem-common.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include <executables/nr-uesoftmodem.h>
const char *__asan_default_options()
{
@@ -362,12 +363,6 @@ void nr_dlsim_preprocessor(module_id_t module_id,
AssertFatal(current_BWP->mcsTableIdx >= 0 && current_BWP->mcsTableIdx <= 2, "invalid mcsTableIdx %d\n", current_BWP->mcsTableIdx);
}
typedef struct {
uint64_t optmask; //mask to store boolean config options
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
tpool_t Tpool; // thread pool
} nrUE_params_t;
nrUE_params_t nrUE_params;
nrUE_params_t *get_nrUE_params(void) {
@@ -475,7 +470,7 @@ int main(int argc, char **argv)
FILE *scg_fd=NULL;
while ((c = getopt (argc, argv, "f:hA:pf:g:i:n:s:S:t:x:y:z:M:N:F:GR:dPI:L:Ea:b:d:e:m:w:T:U:q:X:Y")) != -1) {
while ((c = getopt (argc, argv, "f:hA:pf:g:i:n:s:S:t:x:y:z:M:N:F:GR:d:PI:L:Ea:b:e:m:w:T:U:q:X:Y")) != -1) {
switch (c) {
case 'f':
scg_fd = fopen(optarg,"r");
@@ -642,7 +637,7 @@ int main(int argc, char **argv)
g_rbSize = atoi(optarg);
break;
case 'D':
case 'd':
dlsch_threads = atoi(optarg);
break;
@@ -748,8 +743,6 @@ int main(int argc, char **argv)
if (snr1set==0)
snr1 = snr0+10;
init_dlsch_tpool(dlsch_threads);
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = (PHY_VARS_gNB*) malloc(sizeof(PHY_VARS_gNB ));
@@ -1001,7 +994,7 @@ int main(int argc, char **argv)
unsigned char *test_input_bit;
unsigned int errors_bit = 0;
initTpool("N", &(nrUE_params.Tpool), false);
initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool");
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
@@ -1042,7 +1035,7 @@ int main(int argc, char **argv)
snrRun = 0;
int n_errs = 0;
initTpool(gNBthreads, &gNB->threadPool, true);
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
initNotifiedFIFO(&gNB->L1_tx_free);
initNotifiedFIFO(&gNB->L1_tx_filled);
initNotifiedFIFO(&gNB->L1_tx_out);
@@ -1268,7 +1261,6 @@ int main(int argc, char **argv)
phy_procedures_nrUE_RX(UE,
&UE_proc,
0,
dlsch_threads,
&phy_pdcch_config,
NULL);
+7
View File
@@ -50,6 +50,7 @@
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include "openair1/PHY/MODULATION/nr_modulation.h"
#include <executables/softmodem-common.h>
#include <executables/nr-uesoftmodem.h>
//#define DEBUG_NR_PBCHSIM
PHY_VARS_gNB *gNB;
@@ -72,6 +73,12 @@ softmodem_params_t *get_softmodem_params(void) {
return &softmodem_params;
}
nrUE_params_t nrUE_params={0};
nrUE_params_t *get_nrUE_params(void) {
return &nrUE_params;
}
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
int nr_ue_pdcch_procedures(uint8_t gNB_id,
+1 -6
View File
@@ -54,6 +54,7 @@
#include <openair2/RRC/NR_UE/rrc_defs.h>
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "executables/nr-uesoftmodem.h"
#define NR_PRACH_DEBUG 1
#define PRACH_WRITE_OUTPUT_DEBUG 1
@@ -223,12 +224,6 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
return 0;
}
typedef struct {
uint64_t optmask; //mask to store boolean config options
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
tpool_t Tpool; // thread pool
} nrUE_params_t;
nrUE_params_t nrUE_params;
nrUE_params_t *get_nrUE_params(void) {
+8
View File
@@ -47,6 +47,7 @@
#include "openair1/SIMULATION/RF/rf.h"
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include "executables/nr-uesoftmodem.h"
THREAD_STRUCT thread_struct;
PHY_VARS_gNB *gNB;
@@ -66,6 +67,13 @@ PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}};
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
nrUE_params_t nrUE_params={0};
nrUE_params_t *get_nrUE_params(void) {
return &nrUE_params;
}
int main(int argc, char **argv)
{
char c;
+9 -2
View File
@@ -48,6 +48,7 @@
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include "common/utils/threadPool/thread-pool.h"
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "executables/nr-uesoftmodem.h"
//#define DEBUG_NR_ULSCHSIM
@@ -109,6 +110,13 @@ int nr_postDecode_sim(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
ulsch->last_iteration_cnt = rdata->decodeIterations;
return 0;
}
nrUE_params_t nrUE_params;
nrUE_params_t *get_nrUE_params(void) {
return &nrUE_params;
}
int main(int argc, char **argv)
{
char c;
@@ -387,8 +395,7 @@ int main(int argc, char **argv)
gNB = RC.gNB[0];
//gNB_config = &gNB->gNB_config;
char tp_param[] = "n";
initTpool(tp_param, &gNB->threadPool, true);
initTpool("n", &gNB->threadPool, true);
initNotifiedFIFO(&gNB->respDecode);
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->N_RB_DL = N_RB_DL;
+3 -17
View File
@@ -67,6 +67,7 @@
#include <executables/softmodem-common.h>
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "executables/nr-uesoftmodem.h"
//#define DEBUG_ULSIM
const char *__asan_default_options()
@@ -254,12 +255,6 @@ int nr_derive_key(int alg_type, uint8_t alg_id,
return 0;
}
typedef struct {
uint64_t optmask; //mask to store boolean config options
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
tpool_t Tpool; // thread pool
} nrUE_params_t;
void processSlotTX(void *arg) {}
nrUE_params_t nrUE_params;
@@ -700,18 +695,9 @@ int main(int argc, char **argv)
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX;
char tp_param[80];
if (threadCnt>0)
sprintf(tp_param,"-1");
else
tp_param[0]='n';
int s_offset = 0;
for (int icpu=1; icpu<threadCnt; icpu++) {
sprintf(tp_param+2+s_offset,",-1");
s_offset += 3;
}
initNotifiedFIFO(&gNB->respDecode);
initTpool(tp_param, &gNB->threadPool, false);
initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool");
initNotifiedFIFO(&gNB->respDecode);
initNotifiedFIFO(&gNB->L1_tx_free);
initNotifiedFIFO(&gNB->L1_tx_filled);