Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving memory in conditioned scenarios #9672

Merged
merged 5 commits into from
May 16, 2024
Merged

Saving memory in conditioned scenarios #9672

merged 5 commits into from
May 16, 2024

Conversation

micheles
Copy link
Contributor

@micheles micheles commented May 16, 2024

By using shared memory, which means conditioned scenarios cannot run on clusters, which is fine, since they would be terribly inefficient without shared memory due to the data transfer. The improvement is HUGE.
The following calculation (taken from the Gorkha scenario, job.zip) which was not running at all with 48 GB of RAM, with errors like

[2024-05-16 07:38:33 #12498 INFO] event_based  40% [20 submitted, 0 queued]
Process SpawnPoolWorker-57:
Traceback (most recent call last):
  File "/usr/lib64/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib64/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib64/python3.11/multiprocessing/pool.py", line 114, in worker
    task = get()
           ^^^^^
  File "/usr/lib64/python3.11/multiprocessing/queues.py", line 367, in get
    return _ForkingPickler.loads(res)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, '\xc3'.

Now runs in 2 minutes on the aristotle-beta machine with minimal data transfer:

| calc_2, maxmem=30.9 GB    | time_sec | memory_mb | counts |
|---------------------------+----------+-----------+--------|
| EventBasedCalculator.run  | 136.2    | 40.0      | 1      |
| total event_based         | 99.6     | 31.8      | 34     |
| updating gmfs             | 49.2     | 0.0       | 400    |
| instantiating GmfComputer | 44.7     | 0.0       | 100    |

$ oq show job_info
| task        | sent                                                | received | mean_recv |
|-------------+-----------------------------------------------------+----------+-----------|
| event_based | stations=19.99 MB cmaker=341.43 KB proxies=40.87 KB | 11.28 MB | 339.76 KB |

There is no other way if we want to save disk space and avoid the pickle limitations. Can be considered part of #9387.

@micheles micheles added this to the Engine 3.20.0 milestone May 16, 2024
@micheles micheles merged commit e6c8da7 into master May 16, 2024
6 checks passed
@micheles micheles deleted the sharedarray branch May 16, 2024 07:55
Copy link
Member

@raoanirudh raoanirudh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

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

Successfully merging this pull request may close these issues.

2 participants