pytc.solver.isdf_xtc_ccsd._cgroup_memory_available_bytes

pytc.solver.isdf_xtc_ccsd._cgroup_memory_available_bytes(root='/sys/fs/cgroup', proc_cgroup='/proc/self/cgroup')[source]

Available bytes under the most restrictive enclosing cgroup limit, or None.

A SLURM job’s --mem cap is enforced by the cgroup OOM killer, so node-wide RAM (psutil) overstates what a tier-2 host lift may use. The limit lives on the job’s OWN cgroup (e.g. .../slurmstepd.scope/job_<id>/), not at the hierarchy root. Discovers the process’s cgroup(s) from /proc/self/cgroup and walks each path UP to the root, taking the minimum of limit - current over every level that sets one (cgroup v2 memory.max/memory.current; v1 memory.limit_in_bytes/memory.usage_in_bytes). Returns None when no limited level is found (e.g. macOS, non-cgroup hosts) and logs every level it inspected so the tier line is auditable. root/proc_cgroup exist for tests.