Commit 9ff74080 authored by Eurecom's avatar Eurecom

TASK_MANAGER_SIM

parent e1bea49b
......@@ -10,7 +10,7 @@
//#define TASK_MANAGER_UE
//#define TASK_MANAGER_UE_DECODING
//#define TASK_MANAGER_SIM
#define TASK_MANAGER_SIM
#include "task.h"
......
......@@ -497,9 +497,8 @@ static
int num_threads(char* params)
{
char *saveptr, * curptr;
char *parms_cpy=strdup(params);
int nbThreads=0;
curptr=strtok_r(parms_cpy,",",&saveptr);
curptr=strtok_r( params,",",&saveptr);
while ( curptr!=NULL ) {
int c=toupper(curptr[0]);
......@@ -509,31 +508,16 @@ int num_threads(char* params)
break;
default:
printf("create a thread for core %d\n", atoi(curptr));
int core_id = atoi(curptr);
//Configure the thread scheduler policy for Linux
// set the thread name for debugging
printf("create a thread for core %d\n", core_id);
nbThreads++;
}
curptr=strtok_r(NULL,",",&saveptr);
}
free(parms_cpy);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
printf("Num threads %d \n", nbThreads);
return nbThreads;
}
void init_gNB_Tpool(int inst) {
PHY_VARS_gNB *gNB;
gNB = RC.gNB[inst];
......
......@@ -69,10 +69,14 @@ typedef struct {
uint64_t optmask; //mask to store boolean config options
uint32_t ofdm_offset_divisor; // Divisor for sample offset computation for each OFDM symbol
int max_ldpc_iterations; // number of maximum LDPC iterations
#if defined TASK_MANAGER_UE || defined TASK_MANAGER_UE_DECODING
#if defined (TASK_MANAGER_UE) && defined (TASK_MANAGER_UE_DECODING) && defined(TASK_MANAGER_SIM)
task_manager_t man;
#elif !defined (TASK_MANAGER_UE) || !defined(TASK_MANAGER_UE_DECODING) || !defined(TASK_MANAGER_SIM)
task_manager_t man;
#endif
tpool_t Tpool; // thread pool
#else
tpool_t Tpool; // thread pool
#endif
int UE_scan_carrier;
int UE_fo_compensation;
int timing_advance;
......
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
......@@ -101,6 +102,35 @@ nrUE_params_t *get_nrUE_params(void) {
}
configmodule_interface_t *uniqCfg = NULL;
static
int num_threads(char* parms_cpy)
{
char *saveptr, * curptr;
int nbThreads=0;
curptr=strtok_r(parms_cpy,",",&saveptr);
while ( curptr!=NULL ) {
int c=toupper(curptr[0]);
switch (c) {
case 'N':
//pool->activated=false;
break;
default:
int const core_id = atoi(curptr);
printf("create a thread for core %d\n", core_id);
nbThreads++;
}
curptr=strtok_r(NULL,",",&saveptr);
}
return nbThreads;
}
int main(int argc, char **argv)
{
char c;
......@@ -375,9 +405,8 @@ int main(int argc, char **argv)
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
#ifdef TASK_MANAGER_SIM
int const log_cores = get_nprocs_conf();
assert(log_cores > 0);
init_task_manager(&gNB->man, log_cores);
int const n_threads = num_threads(gNBthreads);
init_task_manager(&gNB->man, n_threads);
init_task_manager(&nrUE_params.man, dlsch_threads);
#else
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
......
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
#include <ctype.h>
#include <fcntl.h>
#include <math.h>
#include <string.h>
......@@ -261,6 +262,34 @@ void validate_input_pmi(nr_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLaye
}
static
int num_threads(char* parms_cpy)
{
char *saveptr, * curptr;
int nbThreads=0;
curptr=strtok_r(parms_cpy,",",&saveptr);
while ( curptr!=NULL ) {
int c=toupper(curptr[0]);
switch (c) {
case 'N':
//pool->activated=false;
break;
default:
int const core_id = atoi(curptr);
printf("create a thread for core %d\n", core_id);
nbThreads++;
}
curptr=strtok_r(NULL,",",&saveptr);
}
return nbThreads;
}
int NB_UE_INST = 1;
configmodule_interface_t *uniqCfg = NULL;
int main(int argc, char **argv)
......@@ -916,10 +945,8 @@ int main(int argc, char **argv)
int n_errs = 0;
#ifdef TASK_MANAGER_SIM
int const log_cores = get_nprocs_conf();
assert(log_cores > 0);
// Assuming: Physical cores = Logical cores / 2
init_task_manager(&gNB->man, log_cores/2);
int const n_threads = num_threads(gNBthreads);
init_task_manager(&gNB->man, n_threads );
#else
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
#endif
......
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