Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • L losscalculator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Dynamic Exposure
  • Global Dynamic Exposure
  • losscalculator
  • Issues
  • #38

Closed
Open
Created Mar 03, 2021 by Tara Evaz Zadeh@taraMaintainer

Change tile-by-tile computation to asset-by-asset

The code should be changed to return to an asset-by-asset computation to speed up the calculations.

Computing the ground-motion field when the calculator splits the exposure into tiles is very time consuming compared to the case when the exposure model is processed only asset by asset.

The easy and fast solution to compute the ground-motion field for all the assets when the exposure model is processed only asset by asset is as below:

  1. The ground-motion field for all the assets is computed once (named full ground-motion field) and stored in an array with same number and order of assets as the exposure file. For each asset, the relevant row from the full ground-motion field is taken as the corresponding ground-motion value.

There are many ways to compute the ground-motion field for all the exposure assets when the calculator is splitting the exposure model into tiles but the most straight-forward solutions are as below:

  1. Interpolate the ground-motion values for assets of a tile each time, separately in a tile . This can be almost 520 times slower than the case above. Because whole the given ground-motion field is used for interpolation repeatedly in tiles.

  2. Interpolate the ground-motion values for all assets of the exposure mode once just like the case 1 but then write the full ground-motion field into a dictionary along with the asset-ids as the dictionary keys. Whenever in a tile, the corresponding ground-motion values can be read from the dictionary using the asset-ids.
    This makes the program 23 times faster than the case 2 but still 23 times slower than the case 1.

A benefit of doing computations tile by tile is to later run the tiles in parallel and speed up the computation. Tile-by-tile computation is now pretty slow and I do not feel the need to spend time on optimizing it now, because the exposure format will anyway change in the future. The codes using the methods 2 and 3 are stored in the branch Tile_by_tile_damagecalculator named losscalculator_compute_GMF_per_tile and losscalculator respectively in case we need to later reuse or improve them.

\fyi @cnievas @shinde
\rfc @marius
\approve @ds @fd

Edited Mar 03, 2021 by Tara Evaz Zadeh
Assignee
Assign to
Time tracking