How to check CPUs and memory

74 views
Skip to first unread message

Tashrif B.

unread,
Mar 15, 2021, 6:07:41 PM3/15/21
to singu...@lbl.gov
Hi all,

After limiting CPUs (and memory), how do I confirm?

I tried `lscpu` and `vmstat -s -S M` within the singularity shell but they both print my host's resources.

Best,
Tashrif

Thomas Hartmann

unread,
Mar 16, 2021, 4:56:14 AM3/16/21
to singu...@lbl.gov
Hi Tashrif,

cgroups don't "virtualize" the resources but the kernel limits the
processes' usage.

For a given process, you can check its cgroups through /proc for example
> /proc/${PID}/cgroup

the current settings are then (on most setups) mounted under
/sys/fs/cgroup/
with the paths from proc below there.

In the 'cpu,cpuacct' sub-group, for example the `cpu.shares` parameter
holds the share of CPU time for this cgroup (relative to the parent group).
Similarly in the `memory` sub-group, an interesting parameter is
`memory.memsw.limit_in_bytes`, which gives the maximum usage of memory
and swap for all the processes in this group.

Cheers,
Thomas

On 15/03/2021 23.07, Tashrif B. wrote:
> Hi all,
>
> After limiting CPUs
> <https://sylabs.io/guides/3.0/user-guide/cgroups.html#limiting-cpu> (and
> memory), how do I confirm?
>
> I tried `lscpu` and `vmstat -s -S M` within the singularity shell but
> they both print my host's resources.
>
> Best,
> Tashrif
>
> --
> You received this message because you are subscribed to the Google
> Groups "singularity" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to singularity...@lbl.gov
> <mailto:singularity...@lbl.gov>.
> To view this discussion on the web visit
> https://groups.google.com/a/lbl.gov/d/msgid/singularity/CAHgtwXT8u-ko4UG%3DcwyNt0e1D5QXfD9L4hCAARRW4ejarUeU8g%40mail.gmail.com
> <https://groups.google.com/a/lbl.gov/d/msgid/singularity/CAHgtwXT8u-ko4UG%3DcwyNt0e1D5QXfD9L4hCAARRW4ejarUeU8g%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages