ngnrsaa / qflex

Flexible Quantum Circuit Simulator (qFlex) implements an efficient tensor network, CPU-based simulator of large quantum circuits.
Apache License 2.0
97 stars 24 forks source link

Track memory usage in real-time (depends on: #257). #253

Closed s-mandra closed 4 years ago

s-mandra commented 4 years ago

For now, it works for linux only. It uses signals and /proc/self/status, which are not available in neither Windows nor MacOSX. Any ideas?

s-mandra commented 4 years ago

For other operating systems:

I'm okay with leaving these as TODO items for now as long as this doesn't cause the other OSes to crash when logging memory usage.

Fixed the code so that tracking is only enabled for linux systems.

s-mandra commented 4 years ago

For some reasons, ualarm doesn't work properly for track_memory_milliseconds >= 1000. The problem doesn't appear for MacOSX.

s-mandra commented 4 years ago

For some reasons, ualarm doesn't work properly for track_memory_milliseconds >= 1000. The problem doesn't appear for MacOSX.

It seems that actually ualarm only accepts intervals smaller than 1 second.

s-mandra commented 4 years ago

For other operating systems:

I'm okay with leaving these as TODO items for now as long as this doesn't cause the other OSes to crash when logging memory usage.

It now works for both linux and macOSX. The portion of the code related to win64 is commented because not tested.