-
Notifications
You must be signed in to change notification settings - Fork 8
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
Investigate if scripts/consequences-v3.10.0.py could be optimized #57
Labels
Enhancement
New feature or request
Comments
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
May 5, 2022
Use Python multiprocessing package to take advantage of multiple CPU cores for processing multiple realizations simultaneously. This would reduce the total run time of, for example, bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o from 23 hours down to 6 hours on a c5a.24xlarge EC2 instance. Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
May 5, 2022
Use Python multiprocessing package to take advantage of multiple CPU cores for processing multiple realizations simultaneously. This would reduce the total run time of, for example, bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o from 23 hours down to 6 hours on a c5a.24xlarge EC2 instance. Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
May 5, 2022
Use Python multiprocessing package to take advantage of multiple CPU cores for processing multiple realizations simultaneously. This would reduce the total run time of, for example, bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o from 23 hours down to 6 hours on a c5a.24xlarge EC2 instance. Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
May 5, 2022
Use Python multiprocessing package to take advantage of multiple CPU cores for processing multiple realizations simultaneously. This would reduce the total run time of, for example, bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o from 23 hours down to 6 hours on a c5a.24xlarge EC2 instance. Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
May 11, 2022
Taking advantage of multiple CPU cores, multiple python3 instances are dispatched simultaneously using "GNU parallel" in run_OQStandard.sh for consequences calculations. Using "bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o" as example, with each realization taking 82 minutes, doing 16 realizations in parallel instead of in series would save 20.5 hours. As consequences calculations are done twice, the total run time is reduced by 41 hours, from 56 hours down to 15 hours on a c5a.24xlarge EC2 instance. Supersedes Pull Request OpenDRR#58 Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
May 11, 2022
Taking advantage of multiple CPU cores, multiple python3 instances are dispatched simultaneously using "GNU parallel" in run_OQStandard.sh for consequences calculations. Using "bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o" as example, with each realization taking 82 minutes, doing 16 realizations in parallel instead of in series would save 20.5 hours. As consequences calculations are done twice, the total run time is reduced by 41 hours, from 56 hours down to 15 hours on a c5a.24xlarge EC2 instance. Unlike Python’s own multiprocessing module, GNU parallel’s invocation of multiple invocations of Python does not involve any memory sharing at all, which avoids any potential mysterious calculation discrepancy with Numpy’s OpenBLAS dot multiplications seen in superseded Pull Request OpenDRR#58. Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
Oct 27, 2023
Taking advantage of multiple CPU cores, multiple python3 instances are dispatched simultaneously using "GNU parallel" in run_OQStandard.sh for consequences calculations. Using "bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o" as example, with each realization taking 82 minutes, doing 16 realizations in parallel instead of in series would save 20.5 hours. As consequences calculations are done twice, the total run time is reduced by 41 hours, from 56 hours down to 15 hours on a c5a.24xlarge EC2 instance. Unlike Python’s own multiprocessing module, GNU parallel’s invocation of multiple invocations of Python does not involve any memory sharing at all, which avoids any potential mysterious calculation discrepancy with Numpy’s OpenBLAS dot multiplications seen in superseded Pull Request OpenDRR#58. Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
Oct 31, 2023
Taking advantage of multiple CPU cores, multiple python3 instances are dispatched simultaneously using "GNU parallel" in run_OQStandard.sh for consequences calculations. Using "bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o" as example, with each realization taking 82 minutes, doing 16 realizations in parallel instead of in series would save 20.5 hours. As consequences calculations are done twice, the total run time is reduced by 41 hours, from 56 hours down to 15 hours on a c5a.24xlarge EC2 instance. Unlike Python’s own multiprocessing module, GNU parallel’s invocation of multiple invocations of Python does not involve any memory sharing at all, which avoids any potential mysterious calculation discrepancy with Numpy’s OpenBLAS dot multiplications seen in superseded Pull Request OpenDRR#58. Fixes OpenDRR#57
anthonyfok
added a commit
to anthonyfok/earthquake-scenarios
that referenced
this issue
Nov 2, 2023
Taking advantage of multiple CPU cores, multiple python3 instances are dispatched simultaneously using "GNU parallel" in run_OQStandard.sh for consequences calculations. Using "bash scripts/run_OQStandard.sh SCM5p8_Montreal_conv -h -r -d -o" as example, with each realization taking 82 minutes, doing 16 realizations in parallel instead of in series would save 20.5 hours. As consequences calculations are done twice, the total run time is reduced by 41 hours, from 56 hours down to 15 hours on a c5a.24xlarge EC2 instance. Unlike Python’s own multiprocessing module, GNU parallel’s invocation of multiple invocations of Python does not involve any memory sharing at all, which avoids any potential mysterious calculation discrepancy with Numpy’s OpenBLAS dot multiplications seen in superseded Pull Request OpenDRR#58. Fixes OpenDRR#57
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While casually observing a scripts/run_OQStandard.sh run, I noticed that OpenQuake itself would happily use all available CPU cores to do calculations in parallel (which is awesome), but some other processing are single-threaded and could take over 12 hours. For example:
from
ps auxwww
nearing the end ofpython3 scripts/consequences-v3.10.0.py -2
run:from
top
:from
free -h
:So, in this particular case, calculations before
python3 scripts/consequences-v3.10.0.py -2
took just over 2 hours, butpython3 scripts/consequences-v3.10.0.py -2
alonewas approaching 5 hourstook 12.65 hours (759 minutes), running single-threaded (not using a lot of RAM) and writing to CSV files at about 200 lines/second (487,211 lines per CSV file in this scenario):Ditto for the
python3 scripts/consequences-v3.10.0.py -1
command which is expected to take another 12 hours.Would be an interesting exercise to profile this script and see where it is spending most of its time, and find ways to make it speedier.
(Low priority, could have)
P.S. A quick-and-dirty script that I am using to record basic metrics:
The text was updated successfully, but these errors were encountered: