Skip to content

Commit

Permalink
change spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbowen42 committed Sep 4, 2024
1 parent 4d92935 commit 25aee03
Show file tree
Hide file tree
Showing 380 changed files with 4,885 additions and 10,082 deletions.
7 changes: 5 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
BasedOnStyle : LLVM
# Indent formatting
IndentWidth : 2
UseTab: Never
BreakBeforeBraces : Linux
KeepEmptyLinesAtTheStartOfBlocks : true
MaxEmptyLinesToKeep : 2
AccessModifierOffset : -2

# Pointer alignment
DerivePointerAlignment: false
PointerAlignment: Left
UseTab: Never
AllowShortIfStatementsOnASingleLine : true
ConstructorInitializerAllOnOneLineOrOnePerLine : true
AllowShortFunctionsOnASingleLine : true
AllowShortLoopsOnASingleLine : false
BinPackParameters : false
BinPackParameters : true
AllowAllParametersOfDeclarationOnNextLine : false
AlignTrailingComments : true
ColumnLimit : 80
Expand Down
6 changes: 2 additions & 4 deletions examples/dynamic-forall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@
void checkResult(int* res, int len);
void printResult(int* res, int len);

using policy_list = camp::list<RAJA::seq_exec,
RAJA::simd_exec
using policy_list = camp::list<RAJA::seq_exec, RAJA::simd_exec
#if defined(RAJA_ENABLE_OPENMP)
,
RAJA::omp_parallel_for_exec
#endif
#if defined(RAJA_ENABLE_CUDA)
,
RAJA::cuda_exec<256>,
RAJA::cuda_exec<512>
RAJA::cuda_exec<256>, RAJA::cuda_exec<512>
#endif
>;

Expand Down
6 changes: 2 additions & 4 deletions examples/omp-target-ltimes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ RAJA_INDEX_VALUE(IGroup, "IGroup");
RAJA_INDEX_VALUE(IZone, "IZone");


void runLTimesRajaKernel(bool debug,
Index_type num_moments,
Index_type num_directions,
Index_type num_groups,
void runLTimesRajaKernel(bool debug, Index_type num_moments,
Index_type num_directions, Index_type num_groups,
Index_type num_zones)
{

Expand Down
7 changes: 4 additions & 3 deletions examples/plugin/counter-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ class CounterPlugin : public RAJA::util::PluginStrategy
};

// Statically loading plugin.
static RAJA::util::PluginRegistry::add<CounterPlugin> P("Counter",
"Counts number of "
"kernel launches.");
static RAJA::util::PluginRegistry::add<CounterPlugin> P("Counter", "Counts "
"number of "
"kernel "
"launches.");

// Dynamically loading plugin.
extern "C" RAJA::util::PluginStrategy* getPlugin() { return new CounterPlugin; }
Expand Down
7 changes: 4 additions & 3 deletions examples/plugin/timer-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TimerPlugin : public RAJA::util::PluginStrategy
extern "C" RAJA::util::PluginStrategy* getPlugin() { return new TimerPlugin; }

// Statically loading plugin.
static RAJA::util::PluginRegistry::add<TimerPlugin> P("Timer",
"Prints elapsed time of "
"kernel executions.");
static RAJA::util::PluginRegistry::add<TimerPlugin> P("Timer", "Prints elapsed "
"time of "
"kernel "
"executions.");
6 changes: 2 additions & 4 deletions examples/red-black-gauss-seidel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ struct grid_s {
double solution(double x, double y);
void computeErr(double* I, grid_s grid);
RAJA::TypedIndexSet<RAJA::ListSegment> gsColorPolicy(
int N,
camp::resources::Resource res);
int N, camp::resources::Resource res);

int main(int RAJA_UNUSED_ARG(argc), char** RAJA_UNUSED_ARG(argv[]))
{
Expand Down Expand Up @@ -171,8 +170,7 @@ int main(int RAJA_UNUSED_ARG(argc), char** RAJA_UNUSED_ARG(argv[]))
// Set.

RAJA::TypedIndexSet<RAJA::ListSegment> gsColorPolicy(
int N,
camp::resources::Resource res)
int N, camp::resources::Resource res)
{
RAJA::TypedIndexSet<RAJA::ListSegment> colorSet;

Expand Down
9 changes: 3 additions & 6 deletions examples/resource-dynamic-forall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@
void checkResult(int* res, int len);
void printResult(int* res, int len);

using policy_list = camp::list<RAJA::seq_exec,
RAJA::simd_exec
using policy_list = camp::list<RAJA::seq_exec, RAJA::simd_exec
#if defined(RAJA_ENABLE_CUDA)
,
RAJA::cuda_exec<256>,
RAJA::cuda_exec<512>
RAJA::cuda_exec<256>, RAJA::cuda_exec<512>
#endif

#if defined(RAJA_ENABLE_HIP)
,
RAJA::hip_exec<256>,
RAJA::hip_exec<512>
RAJA::hip_exec<256>, RAJA::hip_exec<512>
#endif
>;

Expand Down
18 changes: 6 additions & 12 deletions examples/tut_halo-exchange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ const int num_neighbors = 26;
// Functions for checking and printing results
//
void checkResult(std::vector<double*> const& vars,
std::vector<double*> const& vars_ref,
int var_size,
std::vector<double*> const& vars_ref, int var_size,
int num_vars);
void printResult(std::vector<double*> const& vars, int var_size, int num_vars);

Expand All @@ -67,12 +66,10 @@ void printResult(std::vector<double*> const& vars, int var_size, int num_vars);
//
void create_pack_lists(std::vector<int*>& pack_index_lists,
std::vector<int>& pack_index_list_lengths,
const int halo_width,
const int* grid_dims);
const int halo_width, const int* grid_dims);
void create_unpack_lists(std::vector<int*>& unpack_index_lists,
std::vector<int>& unpack_index_list_lengths,
const int halo_width,
const int* grid_dims);
const int halo_width, const int* grid_dims);
void destroy_pack_lists(std::vector<int*>& pack_index_lists);
void destroy_unpack_lists(std::vector<int*>& unpack_index_lists);

Expand Down Expand Up @@ -1758,8 +1755,7 @@ int main(int argc, char** argv)
// Function to compare result to reference and report P/F.
//
void checkResult(std::vector<double*> const& vars,
std::vector<double*> const& vars_ref,
int var_size,
std::vector<double*> const& vars_ref, int var_size,
int num_vars)
{
bool correct = true;
Expand Down Expand Up @@ -1809,8 +1805,7 @@ struct Extent {
//
void create_pack_lists(std::vector<int*>& pack_index_lists,
std::vector<int>& pack_index_list_lengths,
const int halo_width,
const int* grid_dims)
const int halo_width, const int* grid_dims)
{
std::vector<Extent> pack_index_list_extents(num_neighbors);

Expand Down Expand Up @@ -2026,8 +2021,7 @@ void destroy_pack_lists(std::vector<int*>& pack_index_lists)
//
void create_unpack_lists(std::vector<int*>& unpack_index_lists,
std::vector<int>& unpack_index_list_lengths,
const int halo_width,
const int* grid_dims)
const int halo_width, const int* grid_dims)
{
std::vector<Extent> unpack_index_list_extents(num_neighbors);

Expand Down
28 changes: 8 additions & 20 deletions exercises/sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,14 @@
template <typename Function, typename T>
void checkUnstableSortResult(const T* in, const T* out, int N);
template <typename Function, typename T, typename U>
void checkUnstableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N);
void checkUnstableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N);
//
template <typename Function, typename T>
void checkStableSortResult(const T* in, const T* out, int N);
template <typename Function, typename T, typename U>
void checkStableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N);
void checkStableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N);
//
template <typename T>
void printArray(const T* k, int N);
Expand Down Expand Up @@ -493,11 +487,8 @@ void checkUnstableSortResult(const T* in, const T* out, int N)
}

template <typename Comparator, typename T, typename U>
void checkUnstableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N)
void checkUnstableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N)
{
Comparator comp;
bool correct = true;
Expand Down Expand Up @@ -622,11 +613,8 @@ void checkStableSortResult(const T* in, const T* out, int N)
}

template <typename Comparator, typename T, typename U>
void checkStableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N)
void checkStableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N)
{
Comparator comp;
bool correct = true;
Expand Down
28 changes: 8 additions & 20 deletions exercises/sort_solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,14 @@ constexpr int HIP_BLOCK_SIZE = 16;
template <typename Function, typename T>
void checkUnstableSortResult(const T* in, const T* out, int N);
template <typename Function, typename T, typename U>
void checkUnstableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N);
void checkUnstableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N);
//
template <typename Function, typename T>
void checkStableSortResult(const T* in, const T* out, int N);
template <typename Function, typename T, typename U>
void checkStableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N);
void checkStableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N);
//
template <typename T>
void printArray(const T* k, int N);
Expand Down Expand Up @@ -455,11 +449,8 @@ void checkUnstableSortResult(const T* in, const T* out, int N)
}

template <typename Comparator, typename T, typename U>
void checkUnstableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N)
void checkUnstableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N)
{
Comparator comp;
bool correct = true;
Expand Down Expand Up @@ -584,11 +575,8 @@ void checkStableSortResult(const T* in, const T* out, int N)
}

template <typename Comparator, typename T, typename U>
void checkStableSortResult(const T* in,
const T* out,
const U* in_vals,
const U* out_vals,
int N)
void checkStableSortResult(const T* in, const T* out, const U* in_vals,
const U* out_vals, int N)
{
Comparator comp;
bool correct = true;
Expand Down
19 changes: 6 additions & 13 deletions include/RAJA/index/IndexSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>
///
template <typename P0, typename... PREST>
RAJA_INLINE bool compareSegmentById(
size_t segid,
const TypedIndexSet<P0, PREST...>& other) const
size_t segid, const TypedIndexSet<P0, PREST...>& other) const
{
// drill down our types until we have the right type
if (getSegmentTypes()[segid] != T0_TypeId) {
Expand Down Expand Up @@ -251,8 +250,7 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>

public:
template <typename... CALL>
RAJA_INLINE void segment_push_into(size_t segid,
TypedIndexSet<CALL...>& c,
RAJA_INLINE void segment_push_into(size_t segid, TypedIndexSet<CALL...>& c,
PushEnd pend = PUSH_BACK,
PushCopy pcopy = PUSH_COPY)
{
Expand Down Expand Up @@ -338,8 +336,7 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>
///
RAJA_SUPPRESS_HD_WARN
template <typename BODY, typename... ARGS>
RAJA_HOST_DEVICE void segmentCall(size_t segid,
BODY&& body,
RAJA_HOST_DEVICE void segmentCall(size_t segid, BODY&& body,
ARGS&&... args) const
{
if (getSegmentTypes()[segid] != T0_TypeId) {
Expand All @@ -355,17 +352,15 @@ class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>
protected:
//! Internal logic to add a new segment -- catch invalid type insertion
template <typename Tnew>
RAJA_INLINE void push_internal(Tnew* val,
PushEnd pend = PUSH_BACK,
RAJA_INLINE void push_internal(Tnew* val, PushEnd pend = PUSH_BACK,
PushCopy pcopy = PUSH_COPY)
{
static_assert(sizeof...(TREST) > 0, "Invalid type for this TypedIndexSet");
PARENT::push_internal(val, pend, pcopy);
}

//! Internal logic to add a new segment
RAJA_INLINE void push_internal(T0* val,
PushEnd pend = PUSH_BACK,
RAJA_INLINE void push_internal(T0* val, PushEnd pend = PUSH_BACK,
PushCopy pcopy = PUSH_COPY)
{
data.push_back(val);
Expand Down Expand Up @@ -706,9 +701,7 @@ class TypedIndexSet<>
}

template <typename... CALL>
RAJA_INLINE void segment_push_into(size_t,
TypedIndexSet<CALL...>&,
PushEnd,
RAJA_INLINE void segment_push_into(size_t, TypedIndexSet<CALL...>&, PushEnd,
PushCopy) const
{
}
Expand Down
17 changes: 5 additions & 12 deletions include/RAJA/index/IndexSetBuilders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ namespace RAJA
void RAJASHAREDDLL_API buildIndexSetAligned(
RAJA::TypedIndexSet<RAJA::RangeSegment, RAJA::ListSegment>& iset,
camp::resources::Resource work_res,
const RAJA::Index_type* const indices_in,
RAJA::Index_type length,
RAJA::Index_type range_min_length,
RAJA::Index_type range_align);
const RAJA::Index_type* const indices_in, RAJA::Index_type length,
RAJA::Index_type range_min_length, RAJA::Index_type range_align);


////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -90,9 +88,7 @@ void RAJASHAREDDLL_API buildIndexSetAligned(
******************************************************************************
*/
void buildLockFreeBlockIndexset(RAJA::TypedIndexSet<RAJA::RangeSegment>& iset,
int fastDim,
int midDim,
int slowDim);
int fastDim, int midDim, int slowDim);

/*!
******************************************************************************
Expand All @@ -114,11 +110,8 @@ void buildLockFreeBlockIndexset(RAJA::TypedIndexSet<RAJA::RangeSegment>& iset,
*/
void buildLockFreeColorIndexset(
RAJA::TypedIndexSet<RAJA::RangeSegment, RAJA::ListSegment>& iset,
camp::resources::Resource work_res,
RAJA::Index_type const* domainToRange,
int numEntity,
int numRangePerDomain,
int numEntityRange,
camp::resources::Resource work_res, RAJA::Index_type const* domainToRange,
int numEntity, int numRangePerDomain, int numEntityRange,
RAJA::Index_type* elemPermutation = nullptr,
RAJA::Index_type* ielemPermutation = nullptr);

Expand Down
3 changes: 1 addition & 2 deletions include/RAJA/index/IndexSetUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ RAJA_INLINE void getIndicesConditional(CONTAINER_T& con,
******************************************************************************
*/
template <typename CONTAINER_T, typename SEGMENT_T, typename CONDITIONAL>
RAJA_INLINE void getIndicesConditional(CONTAINER_T& con,
const SEGMENT_T& seg,
RAJA_INLINE void getIndicesConditional(CONTAINER_T& con, const SEGMENT_T& seg,
CONDITIONAL conditional)
{
CONTAINER_T tcon;
Expand Down
Loading

0 comments on commit 25aee03

Please sign in to comment.