Commit 97c55d14 authored by mir's avatar mir

TASK_MANAGER_UE_SIM NOT tested. Compiles

parent d8eed492
...@@ -500,7 +500,6 @@ void init_task_manager(task_manager_t* man, size_t num_threads) ...@@ -500,7 +500,6 @@ void init_task_manager(task_manager_t* man, size_t num_threads)
pthread_attr_t attr = {0}; pthread_attr_t attr = {0};
/*
int ret=pthread_attr_init(&attr); int ret=pthread_attr_init(&attr);
assert(ret == 0); assert(ret == 0);
ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
...@@ -510,10 +509,14 @@ void init_task_manager(task_manager_t* man, size_t num_threads) ...@@ -510,10 +509,14 @@ void init_task_manager(task_manager_t* man, size_t num_threads)
struct sched_param sparam={0}; struct sched_param sparam={0};
sparam.sched_priority = 94; sparam.sched_priority = 94;
ret=pthread_attr_setschedparam(&attr, &sparam); ret=pthread_attr_setschedparam(&attr, &sparam);
*/
int rc = pthread_create(&man->t_arr[i], &attr, worker_thread, args); int rc = pthread_create(&man->t_arr[i], &attr, worker_thread, args);
assert(rc == 0 && "Error creating a thread"); if(rc != 0){
printf("[MIR]: %s \n", strerror(rc));
printf("[MIR]: Could not create the pthread with attributtes, trying without attributes\n" );
rc = pthread_create(&man->t_arr[i], NULL, worker_thread, args);
assert(rc == 0 && "Error creating a thread");
}
} }
man->index = 0; man->index = 0;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
//#define TASK_MANAGER_UE //#define TASK_MANAGER_UE
#define TASK_MANAGER_UE_DECODING #define TASK_MANAGER_UE_DECODING
//#define TASK_MANAGER_SIM #define TASK_MANAGER_SIM
//#define TASK_MANAGER_LTE //#define TASK_MANAGER_LTE
#include "task.h" #include "task.h"
......
...@@ -729,9 +729,7 @@ typedef struct PHY_VARS_gNB_s { ...@@ -729,9 +729,7 @@ typedef struct PHY_VARS_gNB_s {
void *scopeData; void *scopeData;
/// structure for analyzing high-level RT measurements /// structure for analyzing high-level RT measurements
rt_L1_profiling_t rt_L1_profiling; rt_L1_profiling_t rt_L1_profiling;
#if defined(TASK_MANAGER_DECODING) && defined(TASK_MANAGER_CODING) && defined(TASK_MANAGER_DEMODULATION) && defined(TASK_MANAGER_RU) && defined(TASK_MANAGER_SIM) #if defined(TASK_MANAGER_DECODING) || defined(TASK_MANAGER_CODING) || defined(TASK_MANAGER_DEMODULATION) || defined(TASK_MANAGER_RU) || !defined(TASK_MANAGER_SIM)
task_manager_t man;
#elif !defined(TASK_MANAGER_DECODING) || !defined(TASK_MANAGER_CODING) || !defined(TASK_MANAGER_DEMODULATION) || !defined(TASK_MANAGER_RU) || !defined(TASK_MANAGER_SIM)
task_manager_t man; task_manager_t man;
tpool_t threadPool; tpool_t threadPool;
#else #else
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#include "executables/nr-uesoftmodem.h" #include "executables/nr-uesoftmodem.h"
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
#include "common/utils/thread_pool/task_manager.h"
//#define DEBUG_NR_DLSCHSIM //#define DEBUG_NR_DLSCHSIM
THREAD_STRUCT thread_struct; THREAD_STRUCT thread_struct;
...@@ -372,9 +374,14 @@ int main(int argc, char **argv) ...@@ -372,9 +374,14 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB)); RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0]; gNB = RC.gNB[0];
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool"); #ifdef TASK_MANAGER_SIM
initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool"); int const num_threads = parse_num_threads(gNBthreads);
//gNB_config = &gNB->gNB_config; init_task_manager(&gNB->man, num_threads);
init_task_manager(&nrUE_params.man, max(dlsch_threads, 1));
#endif
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 = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx; frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx; frame_parms->nb_antennas_rx = n_rx;
...@@ -644,6 +651,12 @@ int main(int argc, char **argv) ...@@ -644,6 +651,12 @@ int main(int argc, char **argv)
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list); free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list);
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list); free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list);
#ifdef TASK_MANAGER_SIM
void (*clean)(task_t*) = NULL;
free_task_manager(&gNB->man, clean);
free_task_manager(&nrUE_params.man, clean);
#endif
phy_free_nr_gNB(gNB); phy_free_nr_gNB(gNB);
free(RC.gNB[0]); free(RC.gNB[0]);
free(RC.gNB); free(RC.gNB);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
#include "common/utils/var_array.h" #include "common/utils/var_array.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/utils/thread_pool/task_manager.h"
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "LAYER2/NR_MAC_UE/mac_defs.h" #include "LAYER2/NR_MAC_UE/mac_defs.h"
#include "LAYER2/NR_MAC_UE/mac_extern.h" #include "LAYER2/NR_MAC_UE/mac_extern.h"
...@@ -855,9 +857,12 @@ int main(int argc, char **argv) ...@@ -855,9 +857,12 @@ int main(int argc, char **argv)
unsigned char *test_input_bit; unsigned char *test_input_bit;
unsigned int errors_bit = 0; unsigned int errors_bit = 0;
#ifdef TASK_MANAGER_SIM
init_task_manager(&nrUE_params.man, max(dlsch_threads, 1));
#else
initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool"); initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool");
#endif
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
// generate signal // generate signal
...@@ -884,7 +889,13 @@ int main(int argc, char **argv) ...@@ -884,7 +889,13 @@ int main(int argc, char **argv)
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels; //NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
int n_errs = 0; int n_errs = 0;
#ifdef TASK_MANAGER_SIM
int const num_threads = parse_num_threads(gNBthreads);
init_task_manager(&gNB->man, num_threads);
#else
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool"); initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
#endif
initNotifiedFIFO(&gNB->L1_tx_free); initNotifiedFIFO(&gNB->L1_tx_free);
initNotifiedFIFO(&gNB->L1_tx_filled); initNotifiedFIFO(&gNB->L1_tx_filled);
initNotifiedFIFO(&gNB->L1_tx_out); initNotifiedFIFO(&gNB->L1_tx_out);
...@@ -1290,6 +1301,12 @@ int main(int argc, char **argv) ...@@ -1290,6 +1301,12 @@ int main(int argc, char **argv)
free(r_im[i]); free(r_im[i]);
} }
#ifdef TASK_MANAGER_SIM
void (*clean)(task_t*) = NULL;
free_task_manager(&nrUE_params.man, clean);
free_task_manager(&gNB->man, clean);
#endif
free(s_re); free(s_re);
free(s_im); free(s_im);
free(r_re); free(r_re);
......
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