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)
pthread_attr_t attr = {0};
/*
int ret=pthread_attr_init(&attr);
assert(ret == 0);
ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
......@@ -510,11 +509,15 @@ void init_task_manager(task_manager_t* man, size_t num_threads)
struct sched_param sparam={0};
sparam.sched_priority = 94;
ret=pthread_attr_setschedparam(&attr, &sparam);
*/
int rc = pthread_create(&man->t_arr[i], &attr, worker_thread, args);
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;
......
......@@ -9,7 +9,7 @@
//#define TASK_MANAGER_UE
#define TASK_MANAGER_UE_DECODING
//#define TASK_MANAGER_SIM
#define TASK_MANAGER_SIM
//#define TASK_MANAGER_LTE
#include "task.h"
......
......@@ -729,9 +729,7 @@ typedef struct PHY_VARS_gNB_s {
void *scopeData;
/// structure for analyzing high-level RT measurements
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)
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)
#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;
tpool_t threadPool;
#else
......
......@@ -50,6 +50,8 @@
#include "executables/nr-uesoftmodem.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "common/utils/thread_pool/task_manager.h"
//#define DEBUG_NR_DLSCHSIM
THREAD_STRUCT thread_struct;
......@@ -372,6 +374,11 @@ 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];
#ifdef TASK_MANAGER_SIM
int const num_threads = parse_num_threads(gNBthreads);
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;
......@@ -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);
#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);
free(RC.gNB[0]);
free(RC.gNB);
......
......@@ -30,6 +30,8 @@
#include "common/utils/nr/nr_common.h"
#include "common/utils/var_array.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_UE/mac_defs.h"
#include "LAYER2/NR_MAC_UE/mac_extern.h"
......@@ -855,8 +857,11 @@ int main(int argc, char **argv)
unsigned char *test_input_bit;
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");
#endif
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
......@@ -884,7 +889,13 @@ int main(int argc, char **argv)
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
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");
#endif
initNotifiedFIFO(&gNB->L1_tx_free);
initNotifiedFIFO(&gNB->L1_tx_filled);
initNotifiedFIFO(&gNB->L1_tx_out);
......@@ -1290,6 +1301,12 @@ int main(int argc, char **argv)
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_im);
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