Commit 653f32d3 authored by mir's avatar mir

RAN-PhySim tests

parent 1b8c81a3
...@@ -137,9 +137,26 @@ void nr_est_delay(int ofdm_symbol_size, const c16_t *ls_est, c16_t *ch_estimates ...@@ -137,9 +137,26 @@ void nr_est_delay(int ofdm_symbol_size, const c16_t *ls_est, c16_t *ch_estimates
#define CEILIDIV(a,b) ((a+b-1)/b) #define CEILIDIV(a,b) ((a+b-1)/b)
#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
#define cmax(a,b) ((a>b) ? (a) : (b)) // How many cmin/cmax, min/max are defined in OAI? Clean in separate MR
#ifndef cmax
#define cmax(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#endif
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c)) #define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
#define cmin(a,b) ((a<b) ? (a) : (b))
#ifndef cmin
#define cmin(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
#endif
#ifdef __cplusplus #ifdef __cplusplus
#ifdef min #ifdef min
......
...@@ -498,7 +498,7 @@ void init_task_manager(task_manager_t* man, uint32_t num_threads) ...@@ -498,7 +498,7 @@ void init_task_manager(task_manager_t* man, uint32_t num_threads)
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); assert(rc == 0 && "Error creating a thread");
} }
man->index = 0; man->index = 0;
......
...@@ -578,7 +578,7 @@ int main ( int argc, char **argv ) ...@@ -578,7 +578,7 @@ int main ( int argc, char **argv )
} }
#ifdef TASK_MANAGER_LTE #ifdef TASK_MANAGER_LTE
assert(strlen(get_softmodem_params()->threadPoolConfig) > 0); assert(strlen(get_softmodem_params()->threadPoolConfig) > 0);
int n_threads = num_threads(get_softmodem_params()->threadPoolConfig); int const n_threads = max(num_threads(get_softmodem_params()->threadPoolConfig), 1);
task_manager_t man = {0}; task_manager_t man = {0};
init_task_manager(&man, n_threads); init_task_manager(&man, n_threads);
#endif #endif
......
...@@ -790,6 +790,8 @@ int main(int argc, char **argv) { ...@@ -790,6 +790,8 @@ int main(int argc, char **argv) {
#ifdef TASK_MANAGER_LTE #ifdef TASK_MANAGER_LTE
int const n_threads = 1; int const n_threads = 1;
proc_rxtx->man = calloc(1, sizeof(task_manager_t));
assert(proc_rxtx->man != NULL && "Memory exhausted");
init_task_manager(proc_rxtx->man, n_threads); init_task_manager(proc_rxtx->man, n_threads);
#else #else
proc_rxtx->threadPool = (tpool_t *)malloc(sizeof(tpool_t)); proc_rxtx->threadPool = (tpool_t *)malloc(sizeof(tpool_t));
......
...@@ -405,9 +405,9 @@ int main(int argc, char **argv) ...@@ -405,9 +405,9 @@ int main(int argc, char **argv)
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];
#ifdef TASK_MANAGER_SIM #ifdef TASK_MANAGER_SIM
int const n_threads = num_threads(gNBthreads); int const n_threads = max(num_threads(gNBthreads), 1);
init_task_manager(&gNB->man, n_threads); init_task_manager(&gNB->man, n_threads);
init_task_manager(&nrUE_params.man, dlsch_threads); init_task_manager(&nrUE_params.man, max(dlsch_threads, 1));
#else #else
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool"); initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool"); initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool");
......
...@@ -903,6 +903,8 @@ int main(int argc, char **argv) ...@@ -903,6 +903,8 @@ int main(int argc, char **argv)
unsigned int errors_bit = 0; unsigned int errors_bit = 0;
#ifdef TASK_MANAGER_SIM #ifdef TASK_MANAGER_SIM
if(dlsch_threads == 0)
dlsch_threads = 1;
init_task_manager(&nrUE_params.man, dlsch_threads); init_task_manager(&nrUE_params.man, dlsch_threads);
#else #else
initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool"); initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool");
...@@ -945,7 +947,7 @@ int main(int argc, char **argv) ...@@ -945,7 +947,7 @@ int main(int argc, char **argv)
int n_errs = 0; int n_errs = 0;
#ifdef TASK_MANAGER_SIM #ifdef TASK_MANAGER_SIM
int const n_threads = num_threads(gNBthreads); int const n_threads = max(num_threads(gNBthreads), 1);
init_task_manager(&gNB->man, n_threads ); init_task_manager(&gNB->man, n_threads );
#else #else
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool"); initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
......
...@@ -555,7 +555,7 @@ int main(int argc, char *argv[]) ...@@ -555,7 +555,7 @@ int main(int argc, char *argv[])
gNB->num_pusch_symbols_per_thread = 1; gNB->num_pusch_symbols_per_thread = 1;
#ifdef TASK_MANAGER #ifdef TASK_MANAGER
init_task_manager(&gNB->man, threadCnt); init_task_manager(&gNB->man, max(threadCnt, 1));
#else #else
initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool"); initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool");
#endif #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