Skip to content

samrai assertions if not in release#862

Merged
PhilipDeegan merged 3 commits intoPHAREHUB:masterfrom
PhilipDeegan:relbug
Jul 24, 2024
Merged

samrai assertions if not in release#862
PhilipDeegan merged 3 commits intoPHAREHUB:masterfrom
PhilipDeegan:relbug

Conversation

@PhilipDeegan
Copy link
Member

@PhilipDeegan PhilipDeegan commented Jul 23, 2024

Summary by CodeRabbit

  • New Features

    • Introduced enhanced debugging options for development and testing in SAMRAI configuration, improving error detection and issue resolution.
    • Changed the default build type for the PHARE project from "Debug" to "Release," streamlining the build process toward a release-oriented focus.
  • Bug Fixes

    • Added checks to prevent aggregation of empty datasets, enhancing robustness and preventing errors during processing.
    • Simplified density calculations in simulation tests, impacting how density is computed and potentially improving simulation accuracy.

@coderabbitai
Copy link

coderabbitai bot commented Jul 23, 2024

Walkthrough

Walkthrough

The recent changes enhance the configurations for the SAMRAI and PHARE projects by incorporating debugging assertions for non-release builds in SAMRAI and modifying the default build type to "Release" for PHARE. These adjustments improve error detection during development and simplify the build process by eliminating unnecessary debug settings, resulting in a more streamlined and efficient workflow.

Changes

Files Change Summary
res/cmake/dep/samrai.cmake Added conditional debugging assertions for non-release builds, enabling additional checks during development.
CMakeLists.txt Changed default build type from "Debug" to "Release" and removed conditional debug-specific settings.
pyphare/pyphare/pharesee/particles.py Added a check to prevent aggregation of empty datasets in the single_patch_per_level_per_pop_from function.
src/amr/load_balancing/load_balancer_details.hpp Updated configuration key from "tol" to "tolerance" for improved clarity.
tests/simulator/test_load_balancing.py Modified density calculations and parameters, including updates to particle counts and thresholds.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant CMake
    participant SAMRAI

    Developer->>CMake: Set CMAKE_BUILD_TYPE (not "Release")
    CMake->>SAMRAI: Enable DEBUG_OPTIONS
    SAMRAI->>SAMRAI: Activate DEBUG_INITIALIZE_UNDEFINED
    SAMRAI->>SAMRAI: Activate DEBUG_CHECK_ASSERTIONS
    SAMRAI->>SAMRAI: Activate DEBUG_CHECK_DIM_ASSERTIONS
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 0

Outside diff range, codebase verification and nitpick comments (1)
res/cmake/dep/samrai.cmake (1)

27-32: Potential Issue: Unused Debugging Options

The debugging options DEBUG_INITIALIZE_UNDEFINED and DEBUG_CHECK_ASSERTIONS set in res/cmake/dep/samrai.cmake are not referenced elsewhere in the codebase. This might indicate incomplete integration or redundancy.

  • DEBUG_INITIALIZE_UNDEFINED
  • DEBUG_CHECK_ASSERTIONS

Please verify if these options should be used elsewhere or if they are redundant.

Analysis chain

LGTM! Ensure the debugging options are correctly used.

The code changes are approved.

However, verify that the debugging options DEBUG_INITIALIZE_UNDEFINED, DEBUG_CHECK_ASSERTIONS, and DEBUG_CHECK_DIM_ASSERTIONS are correctly used in the SAMRAI configuration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of debugging options in SAMRAI configuration.

# Test: Search for the debugging options usage. Expect: Correct usage in SAMRAI configuration.
rg --type cmake -A 5 $'DEBUG_INITIALIZE_UNDEFINED|DEBUG_CHECK_ASSERTIONS|DEBUG_CHECK_DIM_ASSERTIONS'

Length of output: 700


Script:

#!/bin/bash
# Description: Verify the usage of debugging options throughout the entire codebase.

# Test: Search for the debugging options usage across all files. Expect: Correct usage in relevant places.
rg 'DEBUG_INITIALIZE_UNDEFINED|DEBUG_CHECK_ASSERTIONS|DEBUG_CHECK_DIM_ASSERTIONS'

Length of output: 372


Script:

#!/bin/bash
# Description: Verify the usage and integration of debugging options in the codebase.

# Test: Search for the usage of DEBUG_CHECK_DIM_ASSERTIONS in the header file with context.
rg -A 5 'DEBUG_CHECK_DIM_ASSERTIONS' src/amr/data/field/field_variable_fill_pattern.hpp

# Test: Search for any references to DEBUG_INITIALIZE_UNDEFINED and DEBUG_CHECK_ASSERTIONS in the codebase.
rg 'DEBUG_INITIALIZE_UNDEFINED|DEBUG_CHECK_ASSERTIONS'

Length of output: 479

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a24c877 and 34206ed.

Files selected for processing (1)
  • res/cmake/dep/samrai.cmake (1 hunks)

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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 34206ed and ebe435b.

Files selected for processing (1)
  • CMakeLists.txt (1 hunks)
Additional comments not posted (1)
CMakeLists.txt (1)

5-7: LGTM! The default build type is now set to "Release".

This change ensures that the project defaults to a release build, which is suitable for production environments. It simplifies the configuration by removing the previous default of "Debug".

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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ebe435b and e02b024.

Files selected for processing (3)
  • pyphare/pyphare/pharesee/particles.py (1 hunks)
  • src/amr/load_balancing/load_balancer_details.hpp (1 hunks)
  • tests/simulator/test_load_balancing.py (4 hunks)
Files skipped from review due to trivial changes (1)
  • src/amr/load_balancing/load_balancer_details.hpp
Additional comments not posted (5)
tests/simulator/test_load_balancing.py (4)

61-61: Verify the impact of simplified density logic.

The densityHigh function now sets the density array rho to a constant value of 1. Ensure this simplification does not negatively impact the simulation's behavior in high-density scenarios.


132-132: Verify the rationale and impact of reduced particle count.

The number of particles per cell for the high-density configuration has been changed from 590 to 90. Ensure this reduction does not negatively impact the simulation's accuracy and performance.


142-142: Verify the rationale and impact of increased particle count.

The number of particles per cell for the low-density configuration has been changed from 90 to 120. Ensure this increase does not negatively impact the simulation's performance.


240-240: Verify the rationale and impact of the changed empirical threshold.

The empirical threshold in the assertion has been changed from 0.1 to 0.15. Ensure this change does not negatively impact the test's sensitivity to variations in standard deviation over time.

pyphare/pyphare/pharesee/particles.py (1)

299-300: LGTM! Enhances robustness by preventing errors.

The guard clause ensures particles[key] is not empty before performing aggregation, enhancing the robustness of the function.

@PhilipDeegan PhilipDeegan merged commit 09693c4 into PHAREHUB:master Jul 24, 2024
@PhilipDeegan PhilipDeegan deleted the relbug branch July 24, 2024 07:57
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Jul 24, 2024
* samrai assertions if not in release

* default cmake build type to release for distribution

* fix lb_test / python dict typo

upgrade to C++20

better consting to pick correct generate fn

simple Diags in tests - silence hidden overload

test

test without param compile flag workaround

views init

field -> grid

more

more

more

🥱

wip updates
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Jul 24, 2024
* samrai assertions if not in release

* default cmake build type to release for distribution

* fix lb_test / python dict typo

samrai assertions if not in release (PHAREHUB#862)

* samrai assertions if not in release

* default cmake build type to release for distribution

* fix lb_test / python dict typo

upgrade to C++20

better consting to pick correct generate fn

simple Diags in tests - silence hidden overload

test

test without param compile flag workaround

views init

field -> grid

more

more

more

🥱

wip updates
This was referenced Sep 20, 2024
This was referenced Oct 16, 2024
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.

2 participants