# Resources\_used.cpupercent meaning

**URL:** <https://community.openpbs.org/t/resources-used-cpupercent-meaning/2614>\
**Category:** Users/Site Administrators\
**Created:** [May 11, 2021, 11:59am UTC](https://community.openpbs.org/t/resources-used-cpupercent-meaning/2614 "2021-05-11T11:59:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hollow\_op](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@hollow\_op](https://community.openpbs.org/u/hollow_op)\
**Post date:** [May 11, 2021, 11:59am UTC](https://community.openpbs.org/t/resources-used-cpupercent-meaning/2614/1 "2021-05-11T11:59:20Z")

</div>

Hi,

I noticed that one of my jobs is using resources\_used.cpupercent=8077 . Does this mean I’m using 8077 percent more cpu than I requested for my job ? I only requested 20 cpus for this particular job and it seems like I’m using much more. How is this possible ? I thought that pbspro would kill immediately a job if the cpu usage is above the requested resource.

---

<div class="post-metadata">

**Author:** ![adarsh](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@adarsh](https://community.openpbs.org/u/adarsh)\
**Post date:** [May 11, 2021, 3:01pm UTC](https://community.openpbs.org/t/resources-used-cpupercent-meaning/2614/2 "2021-05-11T15:01:03Z")

</div>

**Please refer: AG-308 - PBS Professional 2020.1 Administrator’s Guide**  
MoM calculates an integer value called cpupercent each polling cycle. This is a moving weighted average of CPU usage for the cycle, given as the average percentage usage of one CPU. For example, a value of 50 means that during a certain period, the job used 50 percent of one CPU. A value of 300 means that during the period, the job used an average of three CPUs.

new\_percent = change\_in\_cpu\_time\*100 / change\_in\_walltime  
weight = delta\_weight[up|down] \* walltime/max\_poll\_period  
new\_cpupercent = (new\_percent \* weight) + (old\_cpupercent \* (1-weight))

delta\_weight\_up is used if new\_percent is higher than the old cpupercent value. delta\_weight\_down is used if new\_percent is lower than the old cpupercent value. delta\_weight\_[up|down] controls the speed with which cpupercent changes. If delta\_weight\_[up|down] is 0.0, the value for cpupercent does not change over time. If it is 1.0, cpupercent will take the value of new\_percent for the poll period. In this case cpupercent changes quickly.

However, cpupercent is controlled so that it stays at the greater of the average over the entire run or ncpus\*100.

max\_poll\_period is the maximum time between samples, set in MoM’s config file by $max\_check\_poll, with a default of 120 seconds.

The job is killed if the following is true:  
new\_cpupercent \> ((ncpus \* 100 \* delta\_cpufactor) + delta\_percent\_over)

> [@hollow\_op](#):
>
> I thought that pbspro would kill immediately a job if the cpu usage is above the requested resource.

No PBS would not kill that job.

---

<div class="post-metadata">

**Author:** ![alexis.cousein](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/alexis.cousein/32/265_2.png) [@alexis.cousein](https://community.openpbs.org/u/alexis.cousein)\
**Post date:** [May 18, 2021, 9:35am UTC](https://community.openpbs.org/t/resources-used-cpupercent-meaning/2614/3 "2021-05-18T09:35:56Z")

</div>

PBS only kills jobs when cpupercent is too high when the MoM config files contain the corresponding $enforce directives.

8077 corresponds to 80.77 CPUs. Note that this is the maximum _measured_ between two successive MoM poll intervals. That is a notoriously noisy metric, and if you don’t have the cgroups hook enabled you can run into some accounting issues, particularly at the end of the job (if a session is a child of another session but is attached to the job using pbs\_attach, its usage can be counted for that session and then also reaped in the session of the parent).

resources\_used.cput / resources\_used.walltime is a much more robust metric, which is why there is another enforcement flag for both options (but again, you can have some “double counting” issues).

If you’re using the cgroups hook and its cpuset or cpu subsystems, then you can implement measures to prevent jobs from using more than they requested and this becomes largely irrelevant. The cgroup hook will also make cpupercent reflect cput/walltime.

---

<div class="post-metadata">

**Author:** ![matzmz](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@matzmz](https://community.openpbs.org/u/matzmz)\
**Post date:** [January 10, 2024, 4:40pm UTC](https://community.openpbs.org/t/resources-used-cpupercent-meaning/2614/4 "2024-01-10T16:40:53Z")

</div>

I apologize for following up on an old post, but I need of some clarification regarding the computation of ‘resources\_used.cpupercent’ and ‘resources\_used.cputime’ parameters within the accounting file, especially in scenarios where a job utilizes multiple hosts.

From my understanding, it appears that these parameters reflect resource usage exclusively from the master node, potentially disregarding the contributions of other nodes involved in the job. Could someone confirm whether this interpretation is accurate? Are the resource usages of other nodes composing the job indeed omitted from these calculations?
