Skip to content

CFactor Topography: move index calculation and validity check outside of for loop - #458

Open
NinaHerrmann wants to merge 1 commit into
davidfrantz:developfrom
NinaHerrmann:optimization/c_factor_topography
Open

NinaHerrmann wants to merge 1 commit into
davidfrantz:developfrom
NinaHerrmann:optimization/c_factor_topography

Conversation

@NinaHerrmann

Copy link
Copy Markdown

Speed up cfactor_topography

Summary

Instead of checking data points multiple times, before the thread-parallel loop, two data structures are introduced that save the values for specific pixels: valid and off_flat.
Average savings of 40s per image in the test set mentioned below.
This change is applied in:

File Change
src/modules/lower-level/topo-ll.c Building the new datastructures for the for loop

Testing

End-to-end test

I ran a test set of Sentinel-2 images with 4 processes and 4 threads. I checked the outputs against the develop branch to ensure they are bit-identical. Runtimes improved as follows:

combined_sentinel_baseline_vs_pr0

Additional thoughts (not included)

  • Inlining functions in stats-cl did not improve the runtime.
  • Changing and reducing the sampling could significantly improve the runtime. This could be left to the user with an additional setting, such as ‘max_samples’ and ‘sampling strategy’. However, I fear this would rarely be used, as most people prioritise precision over runtime. So I don't want to introduce settings no one uses. I would be happy to hear your opinion on this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant