r.param.scale: parallelize using RAM preload with private thread buffers#7442
Draft
krcoder123 wants to merge 1 commit into
Draft
r.param.scale: parallelize using RAM preload with private thread buffers#7442krcoder123 wants to merge 1 commit into
krcoder123 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
This is a draft PR that parallelizes r.param.scale using a RAM preload with a private buffer per thread. The full input map is loaded into RAM once before the parallel region. Then each thread copies its own strip of rows plus halo rows out of the shared map into its own private buffer, and does all its window math reading only from that private buffer.
The original serial version of param.scale uses a single sliding window buffer that gets shuffled down one row at a time. This creates a sequential dependency between rows that makes it hard to parallelize. This PR removes that completely by giving each thread its own chunk of output rows and its own private strip buffer to compute from.
Changes
Makefile: added OpenMP wiring (EXTRA_CFLAGS, EXTRA_LIBS, EXTRA_INC)main.c,param.h,interface.c: addednprocsparameter usingG_OPT_M_NPROCSprocess.c: rewrote to load the full map into RAM, give each thread its own private strip buffer with halo, indexed output slots, and a serial in-order write at the endCorrectness
Output matched the serial version across every configuration I tested (sizes 5, 15, 31, 51 × threads 1, 2, 4, 8 = 16 runs total, all with
r.univar diff: min=0, max=0).Status
Draft PR for GSoC 2026 coding period task.