Put CPU affinity control in nr_ulsim.

This commit is contained in:
Raymond Knopp
2025-05-13 14:08:33 +00:00
committed by Romain Beurdouche
parent d6ee29a193
commit c07bfe6db5
+15 -2
View File
@@ -249,7 +249,9 @@ int main(int argc, char *argv[])
InitSinLUT();
int c;
while ((c = getopt(argc, argv, "--:O:a:b:c:d:ef:g:h:i:jk:m:n:p:q:r:s:t:u:v:w:y:z:A:C:F:G:H:I:M:N:PR:S:T:U:L:ZW:E:X:")) != -1) {
bool setAffinity=false;
char gNBthreads[128]="n";
while ((c = getopt(argc, argv, "--:O:a:b:c:d:ef:g:h:i:jk:m:n:p:q:r:s:t:u:v:w:y:z:A:C:F:G:H:I:M:N:PR:S:T:U:L:ZW:E:X:Y:")) != -1) {
/* ignore long options starting with '--', option '-O' and their arguments that are handled by configmodule */
/* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */
if (c == 1 || c == '-' || c == 'O')
@@ -494,6 +496,13 @@ int main(int argc, char *argv[])
AssertFatal(filename_csv != NULL, "strdup() error: errno %d\n", errno);
break;
case 'Y':
threadCnt = sizeof(gNBthreads)-1;
strncpy(gNBthreads, optarg, threadCnt);
gNBthreads[threadCnt]=0;
setAffinity=true;
break;
case 'Z':
transform_precoding = transformPrecoder_enabled;
num_dmrs_cdm_grps_no_data = 2;
@@ -592,7 +601,11 @@ int main(int argc, char *argv[])
gNB->RU_list[0] = calloc(1, sizeof(**gNB->RU_list));
gNB->RU_list[0]->rfdevice.openair0_cfg = openair0_cfg;
initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool");
if (setAffinity == false)
initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool");
else
initNamedTpool(gNBthreads, &gNB->threadPool, true, "gNB-tpool");
initNotifiedFIFO(&gNB->respDecode);
initNotifiedFIFO(&gNB->respPuschSymb);