restrict number of cpu cores per user in multicore system

pvd

New Member
Joined
May 12, 2020
Messages
1
Reaction score
0
Credits
13
Hi,

we are having ubuntu 18.04 based system and we have multiple users using it for AI/ML/DL . We want to restrict / limit number of cpu cores per user to distribute number of cores among all users equally. limits is not working for cores. cgroup is also not able to control number of cpu cores per user. ANy pointer?
 


Maybe it's not what you want... I guess you can do it trying harder with cgroup and using configs like the one in the example found on the cgreoup page on the Arch Wiki:

Code:
group groupname {
  perm {
# who can manage limits
    admin {
      uid = $USER;
      gid = $GROUP;
    }
# who can add tasks to this group
    task {
      uid = $USER;
      gid = $GROUP;
    }
  }
# create this group in cpu and memory controllers
  cpu { }
  memory { }
}

group groupname/foo {
  cpu {
    cpuset.mems="0";
    cpuset.cpus="0-5";
  }
  memory {
    memory.limit_in_bytes = 10000000;
  }
}

Now, when you want to enable this restrictions, you have to run the command with this preamble:

Code:
cgexec -g memory,cpu:groupname/foo <command>

Another option is to to don't restrict the core numbers, but assign the same lowest priority to all users in your /etc/security/limits.conf (using the lowest priority 19).

Using this last method, the user is limited in resources when the system is overloaded, but can use more resources if the system is idle. Refer to this article for further explanations and file syntax.
 

Members online


Top