Hi all,
I have observed a significant discrepancy in CPU usage time calculations
between sreport and sacct, and I would like to understand the underlying
cause. Let me share the specific case I encountered when calculating CPU
usage time for user zt23132881r from November 1, 2024, to November 30, 2024.
1. sreport Results (995,171 minutes):
--------------------------------------------------------------------------------
*[root@master ~]# sreport Cluster UserUtilizationByAccount user=zt23132881r
start=2024-11-01
end=2024-11-30--------------------------------------------------------------------------------Cluster/User/Account
Utilization 2024-11-01T00:00:00 - 2024-11-29T23:59:59 (2505600 secs)Usage
reported in CPU
Minutes--------------------------------------------------------------------------------
Cluster Login Proper Name Account Used
Energy--------- --------- --------------- --------------- --------
---------djhpc-po+ zt231328+ zt23132881r zt+ zt23132881r_ba+ 995171
6294875*
2. sacct Results:
# Without truncate (1,019,927 minutes / 61,195,668 seconds)
*[root@master ~]# sacct -u zt23132881r -S 2024-11-01 -E 2024-11-30 -o
"jobid,partition,account,user,alloccpus,cputimeraw,state" -X |awk
'BEGIN{total=0}{total+=$6}END{print total}'61195668*
# With truncate (967,165 minutes / 58,029,908 seconds)
*[root@master ~]# sacct -u zt23132881r -S 2024-11-01 -E 2024-11-30 -o
"jobid,partition,account,user,alloccpus,cputimeraw,state" -X --truncate
|awk 'BEGIN{total=0}{total+=$6}END{print total}'58029908*
# No -X
*[root@master ~]# sacct -u zt23132881r -S 2024-11-01 -E 2024-11-30 -o
"jobid,partition,account,user,alloccpus,cputimeraw,state" |awk
'BEGIN{total=0}{total+=$6}END{print total}'61195668*
The results show three different values:
- *sreport: 995,171 minutes*
- *sacct (without truncate): 1,019,927 minutes*
- *sacct (with truncate): 967,165 minutes*
I would appreciate if someone could explain:
- Which of these results is more accurate?
- How does sreport calculate CPU usage time?
- Why does the --truncate option in sacct lead to different results?
Thank you for your assistance in clarifying these discrepancies.
Best regards