intel / intel-cmt-cat

User space software for Intel(R) Resource Director Technology
http://www.intel.com/content/www/us/en/architecture-and-technology/resource-director-technology.html
Other
693 stars 183 forks source link

Error while running pqos_alloc_assoc_set_pid() in c #220

Closed kazi-m22 closed 2 years ago

kazi-m22 commented 2 years ago

I am trying to associate a running program to a specific COS using its PID. From terminal it is very easy to do using pqos -I -s "pid1:123456". But when I tried c examples, I have done the following:

pid_t pid = 123456;
int ret;
ret = pqos_alloc_assoc_set_pid(123456, 1) 

This returns 3 which is not equal to PQOS_RETVAL_OK and so I can not do the association. How can I do that. The PID is running and tested using ps aux.

aleksinx commented 2 years ago

Hi, Could you provide error code and logs form running the command?

kazi-m22 commented 2 years ago

@aleksinx when I try to run the above code (i.e. pqos_alloc_assoc_set_pid(123456, 1):

WARN: resctl filesystem mounted! Using MSR interface may corrupt resctrl filesystem and cause unexpected behaviour return of pqos_alloc_assoc_set_pid(pid, 1): 3 Failed to associate

aleksinx commented 2 years ago

How do you initialize libpqos (pqos_init CALL)?

kazi-m22 commented 2 years ago

@aleksinx In the code, I have kept the example as it is, like:

struct pqos_config cfg; cfg.fd_log = STDOUT_FILENO; cfg.verbose = 0; ret = pqos_init(&cfg);

aleksinx commented 2 years ago

In order to use PID association you need to initialize library with OS interface

struct pqos_config cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.fd_log = STDOUT_FILENO;
cfg.verbose = 0;
cfg.interface = PQOS_INTER_OS; // Change interface to OS
ret = pqos_init(&cfg);
kazi-m22 commented 2 years ago

@aleksinx thanks, that worked