Skip to content

Add option to designate the build option NTIME#73

Open
dvalinrh wants to merge 1 commit into
mainfrom
streams_increase
Open

Add option to designate the build option NTIME#73
dvalinrh wants to merge 1 commit into
mainfrom
streams_increase

Conversation

@dvalinrh
Copy link
Copy Markdown
Contributor

@dvalinrh dvalinrh commented May 8, 2026

Description

Adds an option to allow us to designate the NTIME build option. This build option tells the streams code to run x times and provide the best results.

Before/After Comparison

Before: Seeing variations from run to run.
After: If variations are present, use the ntime option to increase NTIME build option. Default is 100.

Clerical Stuff

This closes #55

Relates to JIRA: RPOPC-695

Testing

Verified the --ntime option is impacting the run time of streams

set to 10
real 8m37.110s
user 3m38.759s
sys 0m20.636s

Set to 100
real 15m54.233s
user 31m59.629s
sys 0m20.912s

csv file produced

Array_sizes,8192k,16384k,32768k,65536k,Start_Date,End_Date
Copy,28714,29358,29702,29674,2026-05-08T12:35:19Z,2026-05-08T12:50:57Z
Scale,20639,20342,20140,20086,2026-05-08T12:35:19Z,2026-05-08T12:50:57Z
Add,21829,21834,20361,20427,2026-05-08T12:35:19Z,2026-05-08T12:50:57Z
Triad,21946,21925,20368,20427,2026-05-08T12:35:19Z,2026-05-08T12:50:57Z

Documentation updated.

@dvalinrh dvalinrh requested a review from sayalibhavsar May 8, 2026 13:07
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

This relates to RPOPC-695

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Add --ntimes option to control stream run iterations

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add --ntimes option to control NTIMES compile flag
• Allows multiple stream runs with best result reporting
• Default value set to 100 for consistent benchmarking
• Updated documentation and usage information
Diagram
flowchart LR
  A["User Input<br/>--ntimes flag"] --> B["streams_run script<br/>parses argument"]
  B --> C["Default: ntimes=100"]
  C --> D["run_stream script<br/>receives ntimes value"]
  D --> E["Compile with<br/>-DNTIMES flag"]
  E --> F["Stream executes<br/>multiple runs"]
  F --> G["Reports best result"]
Loading

Grey Divider

File Changes

1. README.md 📝 Documentation +2/-0

Document --ntimes option in README

• Added documentation for --ntimes option
• Describes NTIMES compile flag functionality
• Explains best value reporting across multiple runs

README.md


2. streams/streams_extra/run_stream ✨ Enhancement +6/-1

Implement ntimes argument in run_stream script

• Added ntimes to argument list for parsing
• Added --ntimes command-line argument handler
• Integrated NTIMES into gcc compile command with -DNTIMES=${ntimes}
• Passes ntimes value to compiler for stream compilation

streams/streams_extra/run_stream


3. streams/streams_run ✨ Enhancement +11/-2

Add ntimes parameter handling to main script

• Initialize ntimes variable with default value of 100
• Added ntimes to argument list for parsing
• Added --ntimes command-line argument handler
• Pass --ntimes parameter to run_stream script invocations
• Updated usage documentation with ntimes option details

streams/streams_run


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented May 8, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0)

Context used

Grey Divider


Action required

1. NTIMES ignored in size_list 🐞 Bug ≡ Correctness
Description
In streams/streams_extra/run_stream, the new -DNTIMES=${ntimes} flag is only used when
size_list=="0"; when a user supplies --size_list, compilation omits NTIMES so --ntimes has no
effect. This breaks the intended behavior for explicit array-size runs and silently falls back to
STREAM’s default NTIMES.
Code

streams/streams_extra/run_stream[197]

+			CC_CMD="gcc ${MOPT} -fopenmp  -mcmodel=large ${optim_opt} -DNTIMES=${ntimes} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic"
Evidence
The default sizing branch adds -DNTIMES=${ntimes}, but the explicit size_list compilation path uses
gcc without -DNTIMES, so changing --ntimes will not change the compiled NTIMES when --size_list is
used.

streams/streams_extra/run_stream[172-205]
streams/streams_extra/run_stream[219-235]
streams/stream_omp_5_10.c[111-113]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`--ntimes` currently only affects compilation when `size_list=="0"`. When `--size_list` is provided, the compilation path omits `-DNTIMES=...`, so the new CLI option is ignored.

### Issue Context
`streams/streams_extra/run_stream` has two compilation paths inside `build_images()`: one for automatic sizing and one for explicit `--size_list`. Only the automatic sizing path applies `-DNTIMES=${ntimes}`.

### Fix Focus Areas
- streams/streams_extra/run_stream[219-235]
- streams/streams_extra/run_stream[197-201]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. No default/validation for ntimes 🐞 Bug ☼ Reliability
Description
streams/streams_extra/run_stream uses -DNTIMES=${ntimes} but does not initialize or validate ntimes,
so direct runs without --ntimes (or a non-numeric value) can produce an invalid preprocessor
expression and fail compilation. streams_run sets a default ntimes=100, but run_stream is also a
standalone script copied/executed and should be robust on its own.
Code

streams/streams_extra/run_stream[R98-101]

+		--ntimes)
+			ntimes=${2}
+			shift 2
+		;;
Evidence
run_stream has no ntimes default in its initial variable setup, but later injects
-DNTIMES=${ntimes} into the gcc command. STREAM’s source evaluates #if NTIMES<=1 when NTIMES is
defined; an empty/non-numeric macro expansion makes that #if invalid and can break compilation.

streams/streams_extra/run_stream[20-39]
streams/streams_extra/run_stream[197-201]
streams/stream_omp_5_10.c[106-113]
streams/streams_run[26-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`streams/streams_extra/run_stream` accepts `--ntimes` and uses it in `-DNTIMES=${ntimes}`, but it does not set a default value or validate input. If the script is executed directly without `--ntimes` (or with non-numeric input), compilation can fail due to invalid preprocessor evaluation in the STREAM source.

### Issue Context
`streams_run` sets `ntimes=100` and passes `--ntimes`, but `run_stream` is a copied standalone script and should be self-contained and resilient.

### Fix Focus Areas
- streams/streams_extra/run_stream[20-39]
- streams/streams_extra/run_stream[94-105]
- streams/streams_extra/run_stream[197-201]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

3. README ntimes line typo 🐞 Bug ⚙ Maintainability
Description
README.md adds --ntimes documentation with a trailing double-quote, which renders incorrectly and
can confuse users. This is a documentation defect in the new option text.
Code

README.md[R27-28]

+  --ntimes <value>: Sets the compile flag NTIMES to value x. The streams run will"
+    report the best value of the x runs.
Evidence
The added README line for --ntimes ends with an extra '"' that does not belong in the sentence and
will appear in rendered output.

README.md[21-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The README entry for `--ntimes` includes a trailing `"` character, which breaks formatting and readability.

### Issue Context
This is in the Streams Options section.

### Fix Focus Areas
- README.md[24-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

fi

CC_CMD="gcc ${MOPT} -fopenmp -mcmodel=large ${optim_opt} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic"
CC_CMD="gcc ${MOPT} -fopenmp -mcmodel=large ${optim_opt} -DNTIMES=${ntimes} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Ntimes ignored in size_list 🐞 Bug ≡ Correctness

In streams/streams_extra/run_stream, the new -DNTIMES=${ntimes} flag is only used when
size_list=="0"; when a user supplies --size_list, compilation omits NTIMES so --ntimes has no
effect. This breaks the intended behavior for explicit array-size runs and silently falls back to
STREAM’s default NTIMES.
Agent Prompt
### Issue description
`--ntimes` currently only affects compilation when `size_list=="0"`. When `--size_list` is provided, the compilation path omits `-DNTIMES=...`, so the new CLI option is ignored.

### Issue Context
`streams/streams_extra/run_stream` has two compilation paths inside `build_images()`: one for automatic sizing and one for explicit `--size_list`. Only the automatic sizing path applies `-DNTIMES=${ntimes}`.

### Fix Focus Areas
- streams/streams_extra/run_stream[219-235]
- streams/streams_extra/run_stream[197-201]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

Need to increase run time for streams.

1 participant