-
Notifications
You must be signed in to change notification settings - Fork 160
Open
Description
Context
- current implementation for get memory limits: https://github.com/0xPolygonHermez/zkevm-prover/blob/94f56629e1962eec7b1ae9a055213d97f57863bf/src/utils/utils.cpp#L61
- current implementation for get cpu limits: https://github.com/0xPolygonHermez/zkevm-prover/blob/94f56629e1962eec7b1ae9a055213d97f57863bf/src/utils/utils.cpp#L425
Problems
if program running in a docker container with cgroup limits, the way to get CPU/Memory limits is not accuracy which potentially will cause OOM
Solution
Get Memory Limit
try get memory limit from /sys/fs/cgroup/memory/memory.limit_in_bytes, if the value is 0 or large than /proc/meminfo, fallback to use the mem info inside /proc/meminfo
Get CPU Limit
try to caculate CPU Core number from /sys/fs/cgroup/cpu/cpu.cfs_quota_us Div /sys/fs/cgroup/cpu/cpu.cfs_period_us, if it's not a valid number, then fallback to omp_get_num_procs()
Refs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels