Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silent werror on ubuntu builds #906

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cmake_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ jobs:
set -ex
cmake $GITHUB_WORKSPACE
cd ${{runner.workspace}}/PHARE/subprojects/samrai && mkdir build && cd build
cmake .. -DENABLE_SAMRAI_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake .. -DENABLE_SAMRAI_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug
make -j2 && sudo make install && cd ../.. && rm -rf samrai
cd ${{runner.workspace}}/build && rm -rf *
cmake $GITHUB_WORKSPACE -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON --fresh \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -Dasan=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DlowResourceTests=ON -DdevMode=ON -Dbench=ON \
-DCMAKE_CXX_FLAGS="-DPHARE_DIAG_DOUBLES=1 " -Dphare_configurator=ON
-DCMAKE_CXX_FLAGS="-O3 -DPHARE_DIAG_DOUBLES=1 " -Dphare_configurator=ON
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Inconsistent Optimization Levels Detected

The main project uses -O3 optimization, while res/cmake/coverage.cmake employs -O0. This mismatch can lead to:

  • Performance Discrepancies: Different optimization levels may cause inconsistent behavior and performance issues.
  • Debugging Challenges: Optimized code (-O3) can interfere with debugging processes compared to unoptimized builds (-O0).

Recommendations:

  1. Align Optimization Flags: Use a consistent optimization level across all CMake configurations, such as RelWithDebInfo, to balance performance and debuggability.
  2. Review CMake Files: Ensure all CMake files set compatible CMAKE_CXX_FLAGS to maintain uniform behavior.
🔗 Analysis chain

Resolve inconsistency between Debug build and -O3 optimization

There's an inconsistency in the optimization levels:

  1. SAMRAI is built with Debug configuration (typically -O0 or -Og).
  2. The main project uses -O3 optimization.

This mix of optimization levels could lead to:

  • Inconsistent performance characteristics.
  • Potential issues when debugging, as optimized code might not match source code exactly.

Consider the following options:

  1. If performance is critical, use RelWithDebInfo for both SAMRAI and the main project.
  2. If debugging is the priority, remove the -O3 flag and use Debug consistently.
  3. If you need both performance and debugging capabilities, consider using RelWithDebInfo with -g flag for both.

Please clarify the intended behavior and adjust the configuration accordingly.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent optimization levels across the project

# Test 1: Check if -O3 is used consistently in CMake files
echo "Checking for -O3 usage in CMake files:"
rg --type cmake -i 'cmake_cxx_flags.*-O3' -g '!.github/workflows/cmake_ubuntu.yml'

# Test 2: Check for other optimization flags that might conflict
echo "Checking for other optimization flags:"
rg --type cmake -i 'cmake_(c|cxx)_flags.*-O[0-2g]'

Length of output: 410


- name: Build
working-directory: ${{runner.workspace}}/build
Expand Down
Loading