Skip to content

CPU & memory resource usage not measured when used with FDS connector & MPI #727

Open

Description

@alahiff

When running FDS using multiple processors (e.g. 20 in my case) the CPU & memory usage is close to zero.

Activity

  1. added theissue type on Feb 26, 2025
  2. self-assigned this
    on Feb 26, 2025
  3. added this to the v2.0.0-rc1 milestone on Feb 26, 2025
  4. added
    in progressWork is being done to resolve this issue
    and removed
    backlogWaiting to be resolved
    on Feb 26, 2025
  5. wk9874 commented on Feb 26, 2025

    @wk9874
    Collaborator

    Hmm, have a suspicion that the resource metrics actually arent tracking subprocesses at all :/

  6. wk9874 commented on Feb 26, 2025

    @wk9874
    Collaborator

    It was tracking all subprocesses, but for some reason without an interval it always reports FDS's usage as 0. Added small 0.1 interval for all CPU metric collections. This shouldnt have a big impact on performance since it happens inside the heartbeat thread which only executes every multiple seconds anyway

  7. added
    in reviewThis issue is resolved in a Pull Request which is being reviewed
    ready for testingThis issue has been fixed and is ready for testing
    and removed
    in progressWork is being done to resolve this issue
    in reviewThis issue is resolved in a Pull Request which is being reviewed
    on Feb 26, 2025
  8. assigned and unassigned on Feb 27, 2025
  9. alahiff commented on Feb 27, 2025

    @alahiff
    MemberAuthor

    Non-MPI jobs look better now (*), but FDS running using MPI still has 0% CPU usage. Will investigate further...

    (*) Looking at older FDS jobs they immediately used 100% CPU efficiency, whereas now they ramp up over 800 secs. Will investigate further...

  10. 6 remaining items

  11. wk9874 commented on Feb 28, 2025

    @wk9874
    Collaborator

    Found it! It's because self.processes recreates the list of processes each time, creating new process objects for all subprocesses (like FDS). Without an interval the first measurement returns zero as I mentioned, so because its making a new process each time itll always return zero. Just need to make it so that self.processes is constant, and anytime set_pid is used or add_process is called, it appends to that list. That should mean I can drop the small interval, which should hopefully fix our problems

  12. wk9874 commented on Feb 28, 2025

    @wk9874
    Collaborator

    Actually looks like it's in Executor:

    **

    Image

    **

  13. wk9874 commented on Mar 3, 2025

    @wk9874
    Collaborator

    Have fixed this by making it so that in Run and Executor's processes properties, it adds to / removes from existing lists instead of overwriting the list each time. Testing performed (each with 5s resource metric interval):

    1. Simple Python function which gradually increases CPU usage, in the same script as the simvue monitoring. The run is created, then sleeps for 20s, then starts the process which gradually increases CPU. Checking top during this time showed the CPU usage gradually increased to around 20% when I stopped the script:

    Image

    1. Python script which gradually increases CPU usage in a different script to simvue monitoring, with the simvue script using set_pid to track this other python process after 20s, then tracking this script for 30s. Checking top showed that the CPU usage of the python process was fluctuating between 20 - 25% in this time (rising overall):

    Image

    1. FDS using the connector and not using MPI. FDS was added as a process after 2.4s, then FDS finished at 64.6s, and file upload finished after 90.7s (with a further sleep for 10s after this):

    Image

    1. FDS using the connector with MPI over two cores. FDS was added as a process after 1.5s, then FDS finished after 39.2s, and file upload finished after 66.3s (with a further 10s sleep after this):

    Image

    1. Offline test: 20s idle, then 40s of python function which gradually increases CPU usage, then 20s idle. Then use sender() to send all metrics:

    Image

    @alahiff can you just confirm that you're happy with these? Then I'll put the changes into an alpha for you to test on CUMULUS / CSD3 :)

  14. added
    in reviewThis issue is resolved in a Pull Request which is being reviewed
    ready for testingThis issue has been fixed and is ready for testing
    and removed
    backlogWaiting to be resolved
    in reviewThis issue is resolved in a Pull Request which is being reviewed
    on Mar 3, 2025
  15. assigned and unassigned on Mar 4, 2025
  16. alahiff commented on Mar 4, 2025

    @alahiff
    MemberAuthor

    Tested with 2.0.0a3.

    When CPU is used by the Python script itself, the CPU usage reported seems correct. For an external process, like FDS with the FDS connector, the CPU usage is incorrect. FDS used ~100% CPU the whole time it ran, it didn't slowly ramp up.

    Image

    I'm not sure how you managed to get a plot where CPU usage went to 100% so quickly.

  17. assigned and unassigned on Mar 4, 2025
  18. wk9874 commented on Mar 4, 2025

    @wk9874
    Collaborator

    Damn, I have no idea why thats happening for you...

    Can you let me know what you're running this on? Eg locally on laptop, CSD3, CUMULUS etc? Is it Online or Offline? What is the resources_metrics_interval you are using?

    Will investigate more, but I can't reproduce that atm

  19. alahiff commented on Mar 4, 2025

    @alahiff
    MemberAuthor

    This is on CUMULUS online, i.e. a login node. I haven't adjusted resources_metrics_interval, it's just whatever the default is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

blockingThis is a blocking issue which must be fixed before the next releaseready for testingThis issue has been fixed and is ready for testing

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions