Skip to content

Expose cavitation and hemolysis models to python#264

Open
ryancinsight wants to merge 4 commits intomainfrom
fix/python-bindings-for-TODOs-1581635658287821159
Open

Expose cavitation and hemolysis models to python#264
ryancinsight wants to merge 4 commits intomainfrom
fix/python-bindings-for-TODOs-1581635658287821159

Conversation

@ryancinsight
Copy link
Owner

@ryancinsight ryancinsight commented Mar 10, 2026

Adds missing Python PyO3 bindings for Blake threshold calculation and Giersiepen Hemolysis Model, which had been marked with TODO in the python validation code validation/cross_validate_rust_python.py. The python script has been updated to use these bindings, asserting output exactness, and printing Formula matches Python implementation ✓ correctly. Also addresses some broken internal cfd-python crate imports for cfd-1d.


PR created automatically by Jules for task 1581635658287821159 started by @ryancinsight

High-level PR Summary

This PR exposes cavitation (Blake threshold calculation) and hemolysis (Giersiepen damage model) functionality from Rust to Python via PyO3 bindings. The new Python bindings for RayleighPlesset, CavitationRegimeClassifier, and HemolysisModel are integrated into the cfd-python crate and validated through the cross-validation script, which now performs exact output comparisons and confirms formula correctness. The PR also fixes broken internal imports in the cfd-python crate related to cfd-1d module reorganization and adds .venv to .gitignore.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 crates/cfd-python/src/cavitation.rs
2 crates/cfd-python/src/hemolysis.rs
3 crates/cfd-python/src/lib.rs
4 validation/cross_validate_rust_python.py
5 crates/cfd-python/src/bifurcation.rs
6 crates/cfd-python/src/solver_2d/serpentine.rs
7 crates/cfd-python/src/solver_2d/venturi.rs
8 crates/cfd-python/src/womersley.rs
9 .gitignore

Need help? Join our Discord

Summary by CodeRabbit

  • New Features

    • Python APIs for cavitation (bubble model and regime classifier) and a HemolysisModel with multiple presets.
  • Tests

    • Cross-validation checks comparing Rust and Python implementations for cavitation, blood viscosity, and hemolysis.
  • Chores

    • Added ".venv" to ignore rules and updated benchmark/CI setup and import paths for internal modules.

Exposed RayleighPlesset, CavitationRegimeClassifier, and HemolysisModel to Python via PyO3 to allow python cross-validation scripts to properly run against Rust implementations.

Fixed cfd-python module imports to domain/physics.

Co-authored-by: ryancinsight <55164720+ryancinsight@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the cfd-python library by integrating key physics models, specifically for cavitation and hemolysis, directly into the Python interface. This allows Python users to leverage the high-performance Rust implementations of these models. Additionally, it refines the internal module structure and improves the validation suite to ensure consistency between Rust and Python calculations.

Highlights

  • Python Bindings for Cavitation Models: Exposed RayleighPlesset and CavitationRegimeClassifier models from cfd-core to Python via PyO3 bindings, enabling Python users to calculate Blake critical radius and threshold.
  • Python Bindings for Hemolysis Models: Exposed the HemolysisModel from cfd-core to Python via PyO3 bindings, allowing Python users to calculate hemolysis damage indices using various Giersiepen models, Zhang, and Heuser-Opitz models.
  • Enhanced Validation Script: Updated the cross_validate_rust_python.py script to utilize the newly exposed Python bindings for cavitation and hemolysis models, and also for the CarreauYasudaBlood model, including robust assertions to ensure exact output matching between Rust and Python implementations.
  • Internal Import Corrections: Corrected internal cfd-python crate imports for cfd-1d modules, reflecting recent changes in the cfd-1d crate's module structure.
  • Git Ignore Update: Added .venv to the .gitignore file to prevent Python virtual environment directories from being committed.
Changelog
  • .gitignore
    • Added .venv to ignore Python virtual environment directories.
  • crates/cfd-python/src/bifurcation.rs
    • Updated cfd_1d imports from junctions::branching and channel to domain::junctions::branching and domain::channel.
  • crates/cfd-python/src/cavitation.rs
    • New file added to provide PyO3 bindings for RayleighPlesset and CavitationRegimeClassifier from cfd_core::physics::cavitation.
  • crates/cfd-python/src/hemolysis.rs
    • New file added to provide PyO3 bindings for HemolysisModel from cfd_core::physics::api.
  • crates/cfd-python/src/lib.rs
    • Imported the new cavitation and hemolysis modules.
    • Added PyRayleighPlesset, PyCavitationRegimeClassifier, and PyHemolysisModel classes to the cfd_python PyO3 module.
  • crates/cfd-python/src/solver_2d/serpentine.rs
    • Updated cfd_1d imports from resistance::models to physics::resistance::models.
  • crates/cfd-python/src/solver_2d/venturi.rs
    • Updated cfd_1d imports from resistance::models to physics::resistance::models.
  • crates/cfd-python/src/womersley.rs
    • Updated cfd_1d imports from vascular::womersley to physics::vascular::womersley.
  • validation/cross_validate_rust_python.py
    • Removed TODO comments related to Blake threshold and hemolysis model validation.
    • Integrated cfd_python.RayleighPlesset and cfd_python.CavitationRegimeClassifier to validate Blake critical radius and threshold calculations against Python implementations.
    • Integrated cfd_python.CarreauYasudaBlood to validate apparent viscosity calculations.
    • Integrated cfd_python.HemolysisModel.giersiepen_standard() to validate hemolysis damage index calculations.
    • Added assertions to ensure exact matching between Rust (via Python bindings) and pure Python implementations for all validated models.
    • Removed "NEXT STEP" comments as the validation has been implemented.
Activity
  • The pull request was automatically created by Jules for task 1581635658287821159 initiated by @ryancinsight.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

Adds PyO3 Python bindings for cavitation and hemolysis, updates several import paths to a domain/physics module layout, introduces cross-validation tests comparing Rust and Python implementations, and ignores .venv in Git.

Changes

Cohort / File(s) Summary
Configuration
/.gitignore
Adds .venv to ignore Python virtual environment directory.
Module Path Updates
crates/cfd-python/src/bifurcation.rs, crates/cfd-python/src/solver_2d/serpentine.rs, crates/cfd-python/src/solver_2d/venturi.rs, crates/cfd-python/src/womersley.rs
Adjusts import paths to the reorganized domain/physics modules (e.g., cfd_1d::...cfd_1d::domain::... or cfd_1d::physics::...) without logic changes.
Python Bindings — Cavitation
crates/cfd-python/src/cavitation.rs
Adds PyRayleighPlesset and PyCavitationRegimeClassifier PyO3 wrappers with constructors and methods (blake_critical_radius, blake_threshold) delegating to inner Rust implementations.
Python Bindings — Hemolysis
crates/cfd-python/src/hemolysis.rs
Adds PyHemolysisModel PyO3 wrapper exposing multiple static constructors (Giersiepen variants, Zhang, Heuser‑Opitz) and damage_index, converting Rust errors to Python exceptions.
Module Registration
crates/cfd-python/src/lib.rs
Registers new cavitation and hemolysis modules and adds PyO3 class registrations for the new wrappers.
Cross-Validation Tests
validation/cross_validate_rust_python.py
Implements active cross-language validations: compares Rayleigh–Plesset/Blake threshold, Carreau–Yasuda apparent viscosity, and Giersiepen hemolysis damage_index between Rust bindings and Python reference implementations with printed tables and assertion tolerances.
CI Workflow
.github/workflows/performance-benchmarking.yml
Adds libfontconfig1-dev to apt packages installed on the Linux benchmark runner.
Benchmarks — Config Import & Default
benches/.../core_operations.rs, benches/.../memory_profiling.rs, benches/.../scaling_analysis.rs, benches/comprehensive_cfd_benchmarks.rs
Adds conditional imports for BenchmarkConfig (feature validation) and supplies a local BenchmarkConfig struct + Default implementation when the feature is absent.

Sequence Diagram(s)

sequenceDiagram
    participant PyScript as Python Test Script
    participant PyExt as cfd_python (PyO3 extension)
    participant RustModel as Rust Physics Libraries
    PyScript->>PyExt: construct PyRayleighPlesset / PyHemolysisModel
    PyExt->>RustModel: create/clone underlying Rust model with params
    PyScript->>PyExt: call methods (blake_critical_radius, blake_threshold, damage_index, apparent_viscosity)
    PyExt->>RustModel: delegate call to Rust implementation
    RustModel-->>PyExt: return numeric results
    PyExt-->>PyScript: return results to Python
    PyScript->>PyScript: compare with Python reference impls and assert tolerances
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through bindings, light and quick,

Bubbles, blood, and tests to pick.
Rust heart beating, Python in tune,
I checked the numbers—soon, soon, soon! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Expose cavitation and hemolysis models to python' accurately summarizes the primary change: adding Python bindings for cavitation and hemolysis physics models via PyO3.
Docstring Coverage ✅ Passed Docstring coverage is 93.75% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/python-bindings-for-TODOs-1581635658287821159

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully exposes Rust's cavitation and hemolysis models to Python using PyO3, adding new modules and Python wrappers. The cross-validation script has been updated to use these new bindings, replacing TODOs with concrete assertions that verify the correctness of the Rust implementations. Additionally, the PR includes necessary fixes for broken import paths resulting from refactoring. The changes are well-implemented and significantly improve the project's validation capabilities.

acoustic_pressure: Option<f64>,
acoustic_frequency: Option<f64>,
) -> Self {
let model = bubble_model.borrow().inner.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The .clone() call here is redundant. The RayleighPlesset struct implements the Copy trait, so accessing the inner field on the borrowed PyRayleighPlesset already produces a copy of the value. You can remove the explicit clone for more idiomatic Rust code.

Suggested change
let model = bubble_model.borrow().inner.clone();
let model = bubble_model.borrow().inner;

Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 1d431b3..62b7eee

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (9)

.gitignore
crates/cfd-python/src/bifurcation.rs
crates/cfd-python/src/cavitation.rs
crates/cfd-python/src/hemolysis.rs
crates/cfd-python/src/lib.rs
crates/cfd-python/src/solver_2d/serpentine.rs
crates/cfd-python/src/solver_2d/venturi.rs
crates/cfd-python/src/womersley.rs
validation/cross_validate_rust_python.py

Install `libfontconfig1-dev` in `.github/workflows/performance-benchmarking.yml` for Linux builds to fix the `yeslogic-fontconfig-sys` cargo build error.

Co-authored-by: ryancinsight <55164720+ryancinsight@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@validation/cross_validate_rust_python.py`:
- Line 141: Remove the unnecessary f-string prefixes on print statements that
contain no formatted placeholders: replace f"\n  Formula matches Python
implementation ✓" and the other static print at line ~196 with plain string
literals (e.g., "\n  Formula matches Python implementation ✓") so the prints are
regular strings and avoid Ruff F541; search for print(...) calls in
cross_validate_rust_python.py that use an f-prefix but contain no braces and
remove the leading 'f'.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a70af1ba-51e0-48ea-a657-9aa0064ea3a8

📥 Commits

Reviewing files that changed from the base of the PR and between 1d431b3 and 62b7eee.

📒 Files selected for processing (9)
  • .gitignore
  • crates/cfd-python/src/bifurcation.rs
  • crates/cfd-python/src/cavitation.rs
  • crates/cfd-python/src/hemolysis.rs
  • crates/cfd-python/src/lib.rs
  • crates/cfd-python/src/solver_2d/serpentine.rs
  • crates/cfd-python/src/solver_2d/venturi.rs
  • crates/cfd-python/src/womersley.rs
  • validation/cross_validate_rust_python.py

# Assert they match
assert error_pct < 0.01, f"Viscosity mismatch at {gamma_dot} s⁻¹"

print(f"\n Formula matches Python implementation ✓")
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
python - <<'PY'
import ast
from pathlib import Path

path = Path("validation/cross_validate_rust_python.py")
source = path.read_text()
tree = ast.parse(source)

for node in ast.walk(tree):
    if isinstance(node, ast.JoinedStr) and node.lineno in {141, 196}:
        has_formatted = any(isinstance(value, ast.FormattedValue) for value in node.values)
        print(f"Line {node.lineno}: has_formatted={has_formatted} :: {ast.get_source_segment(source, node)}")
PY

Repository: ryancinsight/CFDrs

Length of output: 221


Remove unnecessary f prefix from string literals without formatted values.

Lines 141 and 196 contain f-strings without any formatted placeholders, which triggers Ruff's F541 violation. These should be plain string literals.

Fix
-    print(f"\n  Formula matches Python implementation ✓")
+    print("\n  Formula matches Python implementation ✓")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
print(f"\n Formula matches Python implementation ✓")
print("\n Formula matches Python implementation ✓")
🧰 Tools
🪛 Ruff (0.15.5)

[error] 141-141: f-string without any placeholders

Remove extraneous f prefix

(F541)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@validation/cross_validate_rust_python.py` at line 141, Remove the unnecessary
f-string prefixes on print statements that contain no formatted placeholders:
replace f"\n  Formula matches Python implementation ✓" and the other static
print at line ~196 with plain string literals (e.g., "\n  Formula matches Python
implementation ✓") so the prints are regular strings and avoid Ruff F541; search
for print(...) calls in cross_validate_rust_python.py that use an f-prefix but
contain no braces and remove the leading 'f'.

google-labs-jules bot and others added 2 commits March 10, 2026 01:41
- Define a fallback `BenchmarkConfig` structure inside benchmarks if `cfd-validation` is disabled via features (the `validation` workspace feature).
- Fix benchmark map closure typing issues.

Co-authored-by: ryancinsight <55164720+ryancinsight@users.noreply.github.com>
Co-authored-by: ryancinsight <55164720+ryancinsight@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@benches/comprehensive_cfd_benchmarks.rs`:
- Around line 8-31: The fallback BenchmarkConfig struct and its Default impl are
missing the baseline_data and output_dir fields, breaking compatibility with
cfd_validation::benchmarking::BenchmarkConfig; update the struct
(BenchmarkConfig) to include pub baseline_data: Option<...> (matching the
canonical type, e.g., Option<BenchmarkBaseline> or Option<String> as
appropriate) and pub output_dir: PathBuf or String per the canonical API, then
set sensible defaults in impl Default for BenchmarkConfig (e.g., baseline_data:
None and output_dir: default directory like PathBuf::from("bench_output") or
String::new()) so code paths that reference output_dir and baseline_data (e.g.,
memory_profiling.rs usage) compile when validation feature is disabled.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: edfd2f82-ef29-4c57-b314-db4f2c308a63

📥 Commits

Reviewing files that changed from the base of the PR and between 10fe17b and d8bacfa.

📒 Files selected for processing (4)
  • benches/cfd_suite/core_operations.rs
  • benches/cfd_suite/memory_profiling.rs
  • benches/cfd_suite/scaling_analysis.rs
  • benches/comprehensive_cfd_benchmarks.rs

Comment on lines +8 to +31
#[cfg(not(feature = "validation"))]
#[derive(Debug, Clone)]
pub struct BenchmarkConfig {
pub iterations: usize,
pub warmup_iterations: usize,
pub enable_memory: bool,
pub enable_scaling: bool,
pub detailed_reporting: bool,
pub regression_threshold: f64,
pub problem_sizes: Vec<usize>,
}
#[cfg(not(feature = "validation"))]
impl Default for BenchmarkConfig {
fn default() -> Self {
Self {
iterations: 10,
warmup_iterations: 3,
enable_memory: true,
enable_scaling: true,
detailed_reporting: true,
regression_threshold: 5.0,
problem_sizes: vec![32, 64, 128, 256, 512],
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

python - <<'PY'
import pathlib, re

def extract_fields(path_str):
    path = pathlib.Path(path_str)
    text = path.read_text()
    m = re.search(r'pub struct BenchmarkConfig\s*\{(.*?)\n\}', text, re.S)
    if not m:
        raise SystemExit(f"BenchmarkConfig not found in {path}")
    fields = []
    for line in m.group(1).splitlines():
        line = line.strip()
        if line.startswith("pub "):
            fields.append(line.split(":")[0].replace("pub ", "").strip())
    return fields

local_path = "benches/comprehensive_cfd_benchmarks.rs"
canonical_path = "crates/cfd-validation/src/benchmarking/suite.rs"

local_fields = extract_fields(local_path)
canonical_fields = extract_fields(canonical_path)

print("local fields     :", local_fields)
print("canonical fields :", canonical_fields)
print("missing in local :", sorted(set(canonical_fields) - set(local_fields)))
print("extra in local   :", sorted(set(local_fields) - set(canonical_fields)))
PY

rg -n -C2 '\b(baseline_data|output_dir)\b' benches crates/cfd-validation/src/benchmarking

Repository: ryancinsight/CFDrs

Length of output: 5569


Add missing baseline_data and output_dir fields to the fallback BenchmarkConfig.

The local fallback struct omits baseline_data and output_dir from the canonical cfd_validation::benchmarking::BenchmarkConfig, breaking API compatibility. The output_dir field is actively used in benches/cfd_suite/memory_profiling.rs (lines 635–639, 768–769), so code fails when the validation feature is disabled.

Fix
 #[cfg(not(feature = "validation"))]
 #[derive(Debug, Clone)]
 pub struct BenchmarkConfig {
     pub iterations: usize,
     pub warmup_iterations: usize,
     pub enable_memory: bool,
     pub enable_scaling: bool,
     pub detailed_reporting: bool,
     pub regression_threshold: f64,
+    pub baseline_data: Option<std::collections::HashMap<String, f64>>,
     pub problem_sizes: Vec<usize>,
+    pub output_dir: Option<String>,
 }
 #[cfg(not(feature = "validation"))]
 impl Default for BenchmarkConfig {
     fn default() -> Self {
         Self {
             iterations: 10,
             warmup_iterations: 3,
             enable_memory: true,
             enable_scaling: true,
             detailed_reporting: true,
             regression_threshold: 5.0,
+            baseline_data: None,
             problem_sizes: vec![32, 64, 128, 256, 512],
+            output_dir: Some("performance_results".to_string()),
         }
     }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[cfg(not(feature = "validation"))]
#[derive(Debug, Clone)]
pub struct BenchmarkConfig {
pub iterations: usize,
pub warmup_iterations: usize,
pub enable_memory: bool,
pub enable_scaling: bool,
pub detailed_reporting: bool,
pub regression_threshold: f64,
pub problem_sizes: Vec<usize>,
}
#[cfg(not(feature = "validation"))]
impl Default for BenchmarkConfig {
fn default() -> Self {
Self {
iterations: 10,
warmup_iterations: 3,
enable_memory: true,
enable_scaling: true,
detailed_reporting: true,
regression_threshold: 5.0,
problem_sizes: vec![32, 64, 128, 256, 512],
}
}
#[cfg(not(feature = "validation"))]
#[derive(Debug, Clone)]
pub struct BenchmarkConfig {
pub iterations: usize,
pub warmup_iterations: usize,
pub enable_memory: bool,
pub enable_scaling: bool,
pub detailed_reporting: bool,
pub regression_threshold: f64,
pub baseline_data: Option<std::collections::HashMap<String, f64>>,
pub problem_sizes: Vec<usize>,
pub output_dir: Option<String>,
}
#[cfg(not(feature = "validation"))]
impl Default for BenchmarkConfig {
fn default() -> Self {
Self {
iterations: 10,
warmup_iterations: 3,
enable_memory: true,
enable_scaling: true,
detailed_reporting: true,
regression_threshold: 5.0,
baseline_data: None,
problem_sizes: vec![32, 64, 128, 256, 512],
output_dir: Some("performance_results".to_string()),
}
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benches/comprehensive_cfd_benchmarks.rs` around lines 8 - 31, The fallback
BenchmarkConfig struct and its Default impl are missing the baseline_data and
output_dir fields, breaking compatibility with
cfd_validation::benchmarking::BenchmarkConfig; update the struct
(BenchmarkConfig) to include pub baseline_data: Option<...> (matching the
canonical type, e.g., Option<BenchmarkBaseline> or Option<String> as
appropriate) and pub output_dir: PathBuf or String per the canonical API, then
set sensible defaults in impl Default for BenchmarkConfig (e.g., baseline_data:
None and output_dir: default directory like PathBuf::from("bench_output") or
String::new()) so code paths that reference output_dir and baseline_data (e.g.,
memory_profiling.rs usage) compile when validation feature is disabled.

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