Skip to content

Commit

Permalink
Run clang-format to resolve merge conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhornung67 committed Jan 31, 2025
1 parent 7bf16ba commit 420b180
Show file tree
Hide file tree
Showing 289 changed files with 35,855 additions and 32,126 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2016-24, Lawrence Livermore National Security, LLC
# Copyright (c) 2016-25, Lawrence Livermore National Security, LLC
# and RAJA project contributors. See the RAJA/LICENSE file for details.
# SPDX-License-Identifier: (BSD-3-Clause)
###############################################################################
Expand Down Expand Up @@ -41,7 +41,7 @@ project(RAJA LANGUAGES CXX C
VERSION ${RAJA_LOADED})

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/thirdparty" ${CMAKE_MODULE_PATH})

set(BLT_REQUIRED_CLANGFORMAT_VERSION "14" CACHE STRING "")
include(cmake/SetupRajaOptions.cmake)

cmake_minimum_required(VERSION 3.23)
Expand Down Expand Up @@ -136,6 +136,9 @@ include(cmake/SetupCompilers.cmake)
# Macros for building executables and libraries
include (cmake/RAJAMacros.cmake)

# Configure `style` target for enforcing code style
raja_add_code_checks()

set (raja_sources
src/AlignedRangeIndexSetBuilders.cpp
src/DepGraphNode.cpp
Expand Down
61 changes: 60 additions & 1 deletion cmake/RAJAMacros.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2016-24, Lawrence Livermore National Security, LLC
# Copyright (c) 2016-25, Lawrence Livermore National Security, LLC
# and other RAJA project contributors. See the RAJA/LICENSE file for details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
Expand Down Expand Up @@ -204,3 +204,62 @@ macro(raja_add_benchmark)
NUM_OMP_THREADS ${arg_NUM_OMP_THREADS}
COMMAND ${TEST_DRIVER} ${arg_NAME})
endmacro(raja_add_benchmark)

##------------------------------------------------------------------------------
## raja_add_code_checks()
##
## Adds code checks for all source files recursively in the RAJA repository.
##
## This creates the following parent build targets:
## check - Runs a non file changing style check and CppCheck
## style - In-place code formatting
##
## Creates various child build targets that follow this pattern:
## raja_<check|style>
## raja_<cppcheck|clangformat>_<check|style>
##------------------------------------------------------------------------------
macro(raja_add_code_checks)

set(options)
set(singleValueArgs)
set(multiValueArgs)

# Parse the arguments to the macro
cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})

# Only do code checks if building raja by itself and not included in
# another project
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# Create file globbing expressions that only include directories that contain source
# TODO(bowen) Add examples, exercises, test, and benchmark to the list below
set(_base_dirs "RAJA" "include" "src")
set(_ext_expressions "*.cpp" "*.hpp" "*.inl"
"*.cxx" "*.hxx" "*.cc" "*.c" "*.h" "*.hh")

set(_glob_expressions)
foreach(_exp ${_ext_expressions})
foreach(_base_dir ${_base_dirs})
list(APPEND _glob_expressions "${PROJECT_SOURCE_DIR}/${_base_dir}/${_exp}")
endforeach()
endforeach()

# Glob for list of files to run code checks on
set(_sources)
file(GLOB_RECURSE _sources ${_glob_expressions})

blt_add_code_checks(PREFIX RAJA
SOURCES ${_sources}
CLANGFORMAT_CFG_FILE ${PROJECT_SOURCE_DIR}/.clang-format
CPPCHECK_FLAGS --enable=all --inconclusive)

# Set FOLDER property for code check targets
foreach(_suffix clangformat_check clangformat_style clang_tidy_check clang_tidy_style)
set(_tgt ${arg_PREFIX}_${_suffix})
if(TARGET ${_tgt})
set_target_properties(${_tgt} PROPERTIES FOLDER "RAJA/code_checks")
endif()
endforeach()
endif()

endmacro(raja_add_code_checks)
28 changes: 14 additions & 14 deletions include/RAJA/RAJA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
#define RAJA_HPP

#include "RAJA/config.hpp"

#include "RAJA/util/Operators.hpp"
#include "RAJA/util/Registry.hpp"
#include "RAJA/util/basic_mempool.hpp"
#include "RAJA/util/camp_aliases.hpp"
#include "RAJA/util/for_each.hpp"
#include "RAJA/util/macros.hpp"
#include "RAJA/util/types.hpp"
#include "RAJA/util/math.hpp"
#include "RAJA/util/plugins.hpp"
#include "RAJA/util/Registry.hpp"
#include "RAJA/util/for_each.hpp"
#include "RAJA/util/types.hpp"


//
Expand Down Expand Up @@ -88,7 +87,7 @@
#endif

#if defined(RAJA_ENABLE_DESUL_ATOMICS)
#include "RAJA/policy/desul.hpp"
#include "RAJA/policy/desul.hpp"
#endif

#include "RAJA/index/IndexSet.hpp"
Expand All @@ -105,18 +104,17 @@
//
#include "RAJA/pattern/forall.hpp"
#include "RAJA/pattern/region.hpp"

#include "RAJA/policy/MultiPolicy.hpp"


//
// Multidimensional layouts and views
//
#include "RAJA/util/IndexLayout.hpp"
#include "RAJA/util/Layout.hpp"
#include "RAJA/util/OffsetLayout.hpp"
#include "RAJA/util/PermutedLayout.hpp"
#include "RAJA/util/StaticLayout.hpp"
#include "RAJA/util/IndexLayout.hpp"
#include "RAJA/util/View.hpp"


Expand Down Expand Up @@ -158,14 +156,14 @@
//
// WorkPool, WorkGroup, WorkSite objects
//
#include "RAJA/policy/WorkGroup.hpp"
#include "RAJA/pattern/WorkGroup.hpp"
#include "RAJA/policy/WorkGroup.hpp"

//
// Reduction objects
//
#include "RAJA/pattern/reduce.hpp"
#include "RAJA/pattern/multi_reduce.hpp"
#include "RAJA/pattern/reduce.hpp"


//
Expand All @@ -186,9 +184,8 @@
//////////////////////////////////////////////////////////////////////
//

#include "RAJA/index/IndexSetUtils.hpp"
#include "RAJA/index/IndexSetBuilders.hpp"

#include "RAJA/index/IndexSetUtils.hpp"
#include "RAJA/pattern/scan.hpp"

#if defined(RAJA_ENABLE_RUNTIME_PLUGINS)
Expand All @@ -197,11 +194,14 @@

#include "RAJA/pattern/sort.hpp"

namespace RAJA {
namespace expt{}
namespace RAJA
{
namespace expt
{
}
// // provide a RAJA::expt namespace for experimental work, but bring alias
// // it into RAJA so it doesn't affect user code
// using namespace expt;
}
} // namespace RAJA

#endif // closing endif for header file include guard
28 changes: 15 additions & 13 deletions include/RAJA/index/IndexSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
#define RAJA_IndexSet_HPP

#include "RAJA/config.hpp"

#include "RAJA/index/ListSegment.hpp"
#include "RAJA/index/RangeSegment.hpp"

#include "RAJA/internal/Iterators.hpp"
#include "RAJA/internal/RAJAVec.hpp"

#include "RAJA/policy/PolicyBase.hpp"

#include "RAJA/util/Operators.hpp"
#include "RAJA/util/concepts.hpp"

Expand Down Expand Up @@ -91,7 +87,7 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>

//! Construct empty index set
#if _MSC_VER < 1910
// this one instance of constexpr does not work on VS2012 or VS2015
// this one instance of constexpr does not work on VS2012 or VS2015
RAJA_INLINE TypedIndexSet() : PARENT() {}
#else
RAJA_INLINE constexpr TypedIndexSet() : PARENT() {}
Expand Down Expand Up @@ -240,11 +236,11 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>
if (pend == PUSH_BACK) {
for (Index_type i = 0; i < num; ++i) {
segment_push_into(i, c, pend, pcopy);
}
}
} else {
for (Index_type i = num-1; i > -1; --i) {
for (Index_type i = num - 1; i > -1; --i) {
segment_push_into(i, c, pend, pcopy);
}
}
}
}

Expand Down Expand Up @@ -301,14 +297,18 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>
template <typename Tnew>
RAJA_INLINE void push_back(Tnew &&val)
{
push_internal(new typename std::decay<Tnew>::type(std::forward<Tnew>(val)), PUSH_BACK, PUSH_COPY);
push_internal(new typename std::decay<Tnew>::type(std::forward<Tnew>(val)),
PUSH_BACK,
PUSH_COPY);
}

//! Add copy of segment to front end of index set.
template <typename Tnew>
RAJA_INLINE void push_front(Tnew &&val)
{
push_internal(new typename std::decay<Tnew>::type(std::forward<Tnew>(val)), PUSH_FRONT, PUSH_COPY);
push_internal(new typename std::decay<Tnew>::type(std::forward<Tnew>(val)),
PUSH_FRONT,
PUSH_COPY);
}

//! Return total length -- sum of lengths of all segments
Expand Down Expand Up @@ -341,7 +341,7 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>
template <typename BODY, typename... ARGS>
RAJA_HOST_DEVICE void segmentCall(size_t segid,
BODY &&body,
ARGS &&... args) const
ARGS &&...args) const
{
if (getSegmentTypes()[segid] != T0_TypeId) {
PARENT::segmentCall(segid,
Expand Down Expand Up @@ -762,12 +762,14 @@ namespace type_traits

template <typename T>
struct is_index_set
: ::RAJA::type_traits::SpecializationOf<RAJA::TypedIndexSet, typename std::decay<T>::type> {
: ::RAJA::type_traits::SpecializationOf<RAJA::TypedIndexSet,
typename std::decay<T>::type> {
};

template <typename T>
struct is_indexset_policy
: ::RAJA::type_traits::SpecializationOf<RAJA::ExecPolicy, typename std::decay<T>::type> {
: ::RAJA::type_traits::SpecializationOf<RAJA::ExecPolicy,
typename std::decay<T>::type> {
};
} // namespace type_traits

Expand Down
36 changes: 16 additions & 20 deletions include/RAJA/index/IndexSetBuilders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
#define RAJA_IndexSetBuilders_HPP

#include "RAJA/config.hpp"

#include "RAJA/index/IndexSet.hpp"
#include "RAJA/index/ListSegment.hpp"
#include "RAJA/index/RangeSegment.hpp"

#include "RAJA/util/types.hpp"

#include "camp/resource.hpp"

namespace RAJA
Expand All @@ -37,13 +34,13 @@ namespace RAJA
* \brief Generate an index set with aligned Range segments and List segments,
* as needed, from given array of indices.
*
* Routine does no error-checking on argements and assumes
* Routine does no error-checking on argements and assumes
* RAJA::Index_type array contains valid indices.
*
* \param iset reference to index set generated with aligned range segments
* \param iset reference to index set generated with aligned range segments
* and list segments. Method assumes index set is empty (no segments).
* \param work_res camp resource object that identifies the memory space in
* which list segment index data will live (passed to list segment
* \param work_res camp resource object that identifies the memory space in
* which list segment index data will live (passed to list segment
* ctor).
* \param indices_in pointer to start of input array of indices.
* \param length size of input index array.
Expand Down Expand Up @@ -79,37 +76,36 @@ void RAJASHAREDDLL_API buildIndexSetAligned(
******************************************************************************
*
* \brief Generate a lock-free "block" index set (planar division) containing
* range segments.
* range segments.
*
* The method chunks a fastDim x midDim x slowDim mesh into blocks that
* The method chunks a fastDim x midDim x slowDim mesh into blocks that
* can be dependency-scheduled, removing need for lock constructs.
*
* \param iset reference to index set generated with range segments.
* Method assumes index set is empty (no segments).
* Method assumes index set is empty (no segments).
* \param fastDim "fast" block dimension (see above).
* \param midDim "mid" block dimension (see above).
* \param slowDim "slow" block dimension (see above).
*
******************************************************************************
*/
void buildLockFreeBlockIndexset(
RAJA::TypedIndexSet<RAJA::RangeSegment>& iset,
int fastDim,
int midDim,
int slowDim);
void buildLockFreeBlockIndexset(RAJA::TypedIndexSet<RAJA::RangeSegment>& iset,
int fastDim,
int midDim,
int slowDim);

/*!
******************************************************************************
*
* \brief Generate a lock-free "color" index set containing range and list
* segments.
*
* TThe domain-set is colored based on connectivity to the range-set.
* All elements in each segment are independent, and no two segments
*
* TThe domain-set is colored based on connectivity to the range-set.
* All elements in each segment are independent, and no two segments
* can be executed in parallel.
*
* \param iset reference to index set generated. Method assumes index set
* is empty (no segments).
* \param iset reference to index set generated. Method assumes index set
* is empty (no segments).
* \param work_res camp resource object that identifies the memory space in
* which list segment index data will live (passed to list segment
* ctor).
Expand Down
Loading

0 comments on commit 420b180

Please sign in to comment.