From 8a406e697d41920da23419ba692cc4c4dcc3fc92 Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:33:16 -0400 Subject: [PATCH 1/2] Update clang format to match Cabana Only exception is pointer alignment --- .clang-format | 3 +++ .github/workflows/format.yml | 2 +- cmake/FindCLANG_FORMAT.cmake | 16 +++------------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.clang-format b/.clang-format index 0bcc0491..7a540c3d 100644 --- a/.clang-format +++ b/.clang-format @@ -7,3 +7,6 @@ BinPackParameters: true IndentWidth: 4 SpacesInParentheses: true BreakConstructorInitializersBeforeComma: true +PointerAlignment: Right +AlwaysBreakAfterReturnType: None +KeepEmptyLinesAtTheStartOfBlocks: false diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index ec200e9f..61d04fa8 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -9,4 +9,4 @@ jobs: - name: Run clang-format style check uses: jidicula/clang-format-action@v4.6.2 with: - clang-format-version: '10' + clang-format-version: '14' diff --git a/cmake/FindCLANG_FORMAT.cmake b/cmake/FindCLANG_FORMAT.cmake index 763f3c72..25ca0d23 100644 --- a/cmake/FindCLANG_FORMAT.cmake +++ b/cmake/FindCLANG_FORMAT.cmake @@ -18,17 +18,7 @@ find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format - clang-format-7 - clang-format-6.0 - clang-format-5.0 - clang-format-4.0 - clang-format-3.9 - clang-format-3.8 - clang-format-3.7 - clang-format-3.6 - clang-format-3.5 - clang-format-3.4 - clang-format-3.3 + clang-format-14 DOC "clang-format executable") mark_as_advanced(CLANG_FORMAT_EXECUTABLE) @@ -38,11 +28,11 @@ if(CLANG_FORMAT_EXECUTABLE) OUTPUT_VARIABLE clang_format_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(clang_format_version MATCHES "^clang-format version .*") + if(clang_format_version MATCHES "^.*clang-format version .*") # clang_format_version sample: "clang-format version 3.9.1-4ubuntu3~16.04.1 # (tags/RELEASE_391/rc2)" string(REGEX - REPLACE "clang-format version ([.0-9]+).*" + REPLACE "^.*clang-format version ([.0-9]+).*" "\\1" CLANG_FORMAT_VERSION "${clang_format_version}") From eafa26aa3276693972c5cfa8a6eeafe2d6c3cf5f Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:33:48 -0400 Subject: [PATCH 2/2] apply new format --- bin/main.cpp | 1 - src/comm_mpi.h | 1 - src/comm_mpi_impl.h | 4 ---- src/inputFile_impl.h | 8 ++++---- src/output.h | 4 ++-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/bin/main.cpp b/bin/main.cpp index c85e356b..98371d52 100644 --- a/bin/main.cpp +++ b/bin/main.cpp @@ -58,7 +58,6 @@ // This main file is simply a driver int main( int argc, char *argv[] ) { - MPI_Init( &argc, &argv ); { diff --git a/src/comm_mpi.h b/src/comm_mpi.h index 05ff61cb..13e41569 100644 --- a/src/comm_mpi.h +++ b/src/comm_mpi.h @@ -323,7 +323,6 @@ class Comm KOKKOS_INLINE_FUNCTION void operator()( const TagHaloPBC, const T_INT &i ) const { - switch ( phase ) { case 0: diff --git a/src/comm_mpi_impl.h b/src/comm_mpi_impl.h index 0a1983e3..d72a1a0f 100644 --- a/src/comm_mpi_impl.h +++ b/src/comm_mpi_impl.h @@ -191,7 +191,6 @@ void Comm::reduce_min_float( T_FLOAT *vals, T_INT count ) template void Comm::exchange() { - Kokkos::Profiling::pushRegion( "Comm::exchange" ); N_local = system->N_local; @@ -277,7 +276,6 @@ void Comm::exchange() template void Comm::exchange_halo() { - Kokkos::Profiling::pushRegion( "Comm::exchange_halo" ); N_local = system->N_local; @@ -367,7 +365,6 @@ void Comm::exchange_halo() template void Comm::update_halo() { - Kokkos::Profiling::pushRegion( "Comm::update_halo" ); N_local = system->N_local; @@ -409,7 +406,6 @@ void Comm::update_halo() template void Comm::update_force() { - Kokkos::Profiling::pushRegion( "Comm::update_force" ); N_local = system->N_local; diff --git a/src/inputFile_impl.h b/src/inputFile_impl.h index 4023615d..e5803f4a 100644 --- a/src/inputFile_impl.h +++ b/src/inputFile_impl.h @@ -60,10 +60,10 @@ std::vector split( const std::string &line ) std::sregex_token_iterator first{ line.begin(), line.end(), re, -1 }, last; std::vector words{ first, last }; // Remove empty - words.erase( - std::remove_if( words.begin(), words.end(), - []( std::string const &s ) { return s.empty(); } ), - words.end() ); + words.erase( std::remove_if( words.begin(), words.end(), + []( std::string const &s ) + { return s.empty(); } ), + words.end() ); return words; } diff --git a/src/output.h b/src/output.h index e7099865..ce810ae5 100644 --- a/src/output.h +++ b/src/output.h @@ -27,7 +27,7 @@ void log( t_stream &stream, t_last &&last ) } template -void log( t_stream &stream, t_head &&head, t_tail &&... tail ) +void log( t_stream &stream, t_head &&head, t_tail &&...tail ) { if ( print_rank() ) stream << head; @@ -46,7 +46,7 @@ void log_err( t_stream &stream, t_last &&last ) } template -void log_err( t_stream &stream, t_head &&head, t_tail &&... tail ) +void log_err( t_stream &stream, t_head &&head, t_tail &&...tail ) { if ( print_rank() ) stream << head;