Skip to content

Commit

Permalink
Merge pull request #23 from LLNL/feature/chen59/update-raja-v0.14.0
Browse files Browse the repository at this point in the history
Update to RAJA v0.14.1
  • Loading branch information
rchen20 authored Nov 15, 2021
2 parents cbd91a5 + 724f49d commit 9853d2e
Show file tree
Hide file tree
Showing 117 changed files with 1,058 additions and 2,139 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ option(ENABLE_LULESH_TWO "Build LULESH v2.0" On)
option(ENABLE_KRIPKE "Build Kripke" On)
option(ENABLE_COMD "Build CoMD" On)

set (ENABLE_TESTS Off CACHE Bool "Don't build tests")
set (ENABLE_EXAMPLES Off CACHE Bool "Don't build examples")
set (ENABLE_EXERCISES Off CACHE Bool "Don't build exercises")
set (ENABLE_TESTS Off CACHE BOOL "Don't build tests")
set (ENABLE_EXAMPLES Off CACHE BOOL "Don't build examples")
set (ENABLE_EXERCISES Off CACHE BOOL "Don't build exercises")

if (PROXIES_ENABLE_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
Expand Down
10 changes: 5 additions & 5 deletions CoMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ project(COMD LANGUAGES CXX)
# Initialize the BLT build system
#

set(ENABLE_GTEST Off CACHE Bool "")
set(ENABLE_TESTS Off CACHE Bool "")
set(ENABLE_TBB Off CACHE Bool "")
set(ENABLE_EXAMPLES Off CACHE Bool "")
set(ENABLE_DOCUMENTATION Off CACHE Bool "")
set(ENABLE_GTEST Off CACHE BOOL "")
set(ENABLE_TESTS Off CACHE BOOL "")
set(ENABLE_TBB Off CACHE BOOL "")
set(ENABLE_EXAMPLES Off CACHE BOOL "")
set(ENABLE_DOCUMENTATION Off CACHE BOOL "")

#
# Configure RAJA
Expand Down
22 changes: 13 additions & 9 deletions CoMD/src-threaded/CoMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,16 @@ SimFlat* initSimulation(Command cmd)
// create lattice with desired temperature and displacement.
createFccLattice(cmd.nx, cmd.ny, cmd.nz, latticeConstant, sim);

RAJA::resources::Resource defHostRes{RAJA::resources::Host::get_default()};
#ifdef ENABLE_CUDA
RAJA::resources::Resource erasedRes{RAJA::resources::Cuda()};
#else
RAJA::resources::Resource erasedRes{RAJA::resources::Host::get_default()};
#endif

/* Create Total IndexSets */
sim->isTotal = new RAJA::TypedIndexSet<RAJA::RangeSegment>() ;
sim->isTotal = new RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>>() ;
for (int i=0; i<sim->boxes->nTotalBoxes; ++i) {
RAJA::RangeSegment myseg(i*MAXATOMS,i*MAXATOMS + sim->boxes->nAtoms[i]);
RAJA::TypedRangeSegment<int> myseg(i*MAXATOMS,i*MAXATOMS + sim->boxes->nAtoms[i]);
sim->isTotal->push_back( myseg ) ;
}

Expand All @@ -256,21 +260,21 @@ SimFlat* initSimulation(Command cmd)
tmpBox[tmpCount++] = sim->boxes->nbrBoxes[i][j] ;
}
}
sim->boxes->nbrSegments[i] = new RAJA::TypedListSegment<int>(tmpBox, tmpCount, defHostRes);
sim->boxes->nbrSegments[i] = new RAJA::TypedListSegment<int>(tmpBox, tmpCount, erasedRes);
}
else {
sim->boxes->nbrSegments[i] = new RAJA::TypedListSegment<int>(sim->boxes->nbrBoxes[i], 27, defHostRes);
sim->boxes->nbrSegments[i] = new RAJA::TypedListSegment<int>(sim->boxes->nbrBoxes[i], 27, erasedRes);
}
}

/* Create Local IndexSet View */
sim->isLocal = new RAJA::TypedIndexSet<RAJA::RangeSegment>() ;
sim->isLocal = new RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>>() ;
for(int i = 0; i < sim->boxes->nLocalBoxes; ++i) {
RAJA::RangeSegment myseg(i*MAXATOMS, i*MAXATOMS + sim->boxes->nAtoms[i]);
RAJA::TypedRangeSegment<int> myseg(i*MAXATOMS, i*MAXATOMS + sim->boxes->nAtoms[i]);
sim->isLocal->push_back( myseg ) ;
}

sim->isLocalSegment = new RAJA::RangeSegment(0, sim->boxes->nLocalBoxes);
sim->isLocalSegment = new RAJA::TypedRangeSegment<int>(0, sim->boxes->nLocalBoxes);

setTemperature(sim, cmd.temperature);

Expand Down Expand Up @@ -412,7 +416,7 @@ void sumAtoms(SimFlat* s)
*/
RAJA::kernel<redistributeKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, nLocalBoxes)),
RAJA::TypedRangeSegment<int>(0, nLocalBoxes)),
[=] RAJA_DEVICE (int i)
{
nLocalReduce += s->boxes->nAtoms[i];
Expand Down
6 changes: 3 additions & 3 deletions CoMD/src-threaded/CoMDTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ typedef struct SimFlatSt

HaloExchange* atomExchange;

RAJA::TypedIndexSet<RAJA::RangeSegment> *isTotal ;
RAJA::TypedIndexSet<RAJA::RangeSegment> *isLocal ;
RAJA::RangeSegment *isLocalSegment ;
RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> *isTotal ;
RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> *isLocal ;
RAJA::TypedRangeSegment<int> *isLocalSegment ;

} SimFlat;

Expand Down
20 changes: 10 additions & 10 deletions CoMD/src-threaded/eam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ int eamForce(SimFlat* s)

RAJA::kernel<atomWorkKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, s->boxes->nLocalBoxes),
RAJA::RangeSegment(0, MAXATOMS) ),
RAJA::TypedRangeSegment<int>(0, s->boxes->nLocalBoxes),
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ),
[=] COMD_DEVICE (int iBox, int iOffLocal) {

const int nIBox = s->boxes->nAtoms[iBox];
Expand Down Expand Up @@ -271,9 +271,9 @@ int eamForce(SimFlat* s)
RAJA::kernel<forcePolicyKernel>(
RAJA::make_tuple(
*s->isLocalSegment, // local boxes
RAJA::RangeSegment(0,27), // 27 neighbor boxes
RAJA::RangeSegment(0, MAXATOMS), // atoms i in local box
RAJA::RangeSegment(0, MAXATOMS) ), // atoms j in neighbor box
RAJA::TypedRangeSegment<int>(0,27), // 27 neighbor boxes
RAJA::TypedRangeSegment<int>(0, MAXATOMS), // atoms i in local box
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ), // atoms j in neighbor box
[=] COMD_DEVICE (int iBox, int nghb, int iOff, int jOff) {

const int jBox = s->boxes->nbrBoxes[iBox][nghb];
Expand Down Expand Up @@ -338,8 +338,8 @@ int eamForce(SimFlat* s)
profileStart(forceFunctionTimer);
RAJA::kernel<atomWorkKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, s->boxes->nLocalBoxes),
RAJA::RangeSegment(0, MAXATOMS) ),
RAJA::TypedRangeSegment<int>(0, s->boxes->nLocalBoxes),
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ),
[=] COMD_DEVICE (int iBox, int iOffLocal) {

const int nIBox = s->boxes->nAtoms[iBox];
Expand Down Expand Up @@ -368,9 +368,9 @@ int eamForce(SimFlat* s)
RAJA::kernel<forcePolicyKernel>(
RAJA::make_tuple(
*s->isLocalSegment, // local boxes
RAJA::RangeSegment(0,27), // 27 neighbor boxes
RAJA::RangeSegment(0, MAXATOMS), // atoms i in local box
RAJA::RangeSegment(0, MAXATOMS) ), // atoms j in neighbor box
RAJA::TypedRangeSegment<int>(0,27), // 27 neighbor boxes
RAJA::TypedRangeSegment<int>(0, MAXATOMS), // atoms i in local box
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ), // atoms j in neighbor box
[=] COMD_DEVICE (int iBox, int nghb, int iOff, int jOff) {

const int jBox = s->boxes->nbrBoxes[iBox][nghb];
Expand Down
2 changes: 1 addition & 1 deletion CoMD/src-threaded/haloExchange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ int loadAtomsBuffer(void* vparms, void* data, int face, char* charBuf)
// TODO: Try to optimize this.
RAJA::kernel<redistributeKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, nCells)),
RAJA::TypedRangeSegment<int>(0, nCells)),
[=] RAJA_DEVICE (int iCell) {
SimFlat* s = (SimFlat*) data;
int* offsetBuf = (int*)charBuf;
Expand Down
6 changes: 3 additions & 3 deletions CoMD/src-threaded/linkCells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ LinkCell* initLinkCells(const Domain* domain, real_t cutoff)
// Adding nbrSegments
ll->nbrSegments = (RAJA::TypedListSegment<int> **)comdMalloc(ll->nTotalBoxes*sizeof(RAJA::TypedListSegment<int>*));

ll->neighbors = (RAJA::TypedIndexSet<RAJA::RangeSegment> **)comdMalloc(ll->nTotalBoxes*sizeof(RAJA::TypedIndexSet<RAJA::RangeSegment> *));
ll->neighbors = (RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> **)comdMalloc(ll->nTotalBoxes*sizeof(RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> *));

return ll;
}
Expand Down Expand Up @@ -407,7 +407,7 @@ void emptyHaloCells(LinkCell* boxes)
{
RAJA::kernel<redistributeKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(boxes->nLocalBoxes, boxes->nTotalBoxes)),
RAJA::TypedRangeSegment<int>(boxes->nLocalBoxes, boxes->nTotalBoxes)),
[=] RAJA_DEVICE (int ii) {
boxes->nAtoms[ii] = 0;
});
Expand Down Expand Up @@ -524,7 +524,7 @@ void unloadAtomsBuffer(void* vparms, void* data, int face, int bufSize, char* ch

RAJA::kernel<redistributeKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, nCells)),
RAJA::TypedRangeSegment<int>(0, nCells)),
[=] RAJA_DEVICE (int iCell) {
AtomMsg* buf = (AtomMsg*)(charBuf + size);
int* offsets = (int*)(charBuf);
Expand Down
2 changes: 1 addition & 1 deletion CoMD/src-threaded/linkCells.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef struct LinkCellSt
int* nAtoms; //!< total number of atoms in each box
int** nbrBoxes; //!< neighbor boxes for each box

RAJA::TypedIndexSet<RAJA::RangeSegment> ** neighbors ; //!< neighbor IndexSets (Slices) for each box
RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> ** neighbors ; //!< neighbor IndexSets (Slices) for each box
RAJA::TypedListSegment<int> ** nbrSegments ; //!< neighbor list per box, same indexing as boxes


Expand Down
10 changes: 5 additions & 5 deletions CoMD/src-threaded/ljForce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ int ljForce(SimFlat* s)
profileStart(forceZeroingTimer);
RAJA::kernel<atomWorkKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, s->boxes->nLocalBoxes),
RAJA::RangeSegment(0, MAXATOMS) ),
RAJA::TypedRangeSegment<int>(0, s->boxes->nLocalBoxes),
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ),
[=] COMD_DEVICE (int iBox, int iOffLocal) {
const int nIBox = s->boxes->nAtoms[iBox];
if(iOffLocal < nIBox) {
Expand All @@ -181,9 +181,9 @@ int ljForce(SimFlat* s)
RAJA::kernel<forcePolicyKernel>(
RAJA::make_tuple(
*s->isLocalSegment, // local boxes
RAJA::RangeSegment(0,27), // 27 neighbor boxes
RAJA::RangeSegment(0, MAXATOMS), // atoms i in local box
RAJA::RangeSegment(0, MAXATOMS) ), // atoms j in neighbor box
RAJA::TypedRangeSegment<int>(0,27), // 27 neighbor boxes
RAJA::TypedRangeSegment<int>(0, MAXATOMS), // atoms i in local box
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ), // atoms j in neighbor box
[=] COMD_DEVICE (int iBoxID, int nghb, int iOff, int jOff) {
const int nLocalBoxes = s->boxes->nLocalBoxes;
const int nIBox = s->boxes->nAtoms[iBoxID];
Expand Down
22 changes: 11 additions & 11 deletions CoMD/src-threaded/timestep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "parallel.h"
#include "performanceTimers.h"

static void advanceVelocity(SimFlat* s, RAJA::TypedIndexSet<RAJA::RangeSegment> *extent, real_t dt);
static void advancePosition(SimFlat* s, RAJA::TypedIndexSet<RAJA::RangeSegment> *extent, real_t dt);
static void advanceVelocity(SimFlat* s, RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> *extent, real_t dt);
static void advancePosition(SimFlat* s, RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> *extent, real_t dt);

extern "C" int sortAtomsById(const void* a, const void* b);

Expand Down Expand Up @@ -67,12 +67,12 @@ void computeForce(SimFlat* s)
}


void advanceVelocity(SimFlat* s, RAJA::TypedIndexSet<RAJA::RangeSegment> *extent, real_t dt)
void advanceVelocity(SimFlat* s, RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> *extent, real_t dt)
{
RAJA::kernel<atomWorkKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, s->boxes->nLocalBoxes),
RAJA::RangeSegment(0, MAXATOMS) ),
RAJA::TypedRangeSegment<int>(0, s->boxes->nLocalBoxes),
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ),
[=] COMD_DEVICE (int iBox, int iOffLocal) {
const int nIBox = s->boxes->nAtoms[iBox];
if(iOffLocal < nIBox) {
Expand All @@ -87,12 +87,12 @@ void advanceVelocity(SimFlat* s, RAJA::TypedIndexSet<RAJA::RangeSegment> *extent
} );
}

void advancePosition(SimFlat* s, RAJA::TypedIndexSet<RAJA::RangeSegment> *extent, real_t dt)
void advancePosition(SimFlat* s, RAJA::TypedIndexSet<RAJA::TypedRangeSegment<int>> *extent, real_t dt)
{
RAJA::kernel<atomWorkKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, s->boxes->nLocalBoxes),
RAJA::RangeSegment(0, MAXATOMS) ),
RAJA::TypedRangeSegment<int>(0, s->boxes->nLocalBoxes),
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ),
[=] COMD_DEVICE (int iBox, int iOffLocal) {
const int nIBox = s->boxes->nAtoms[iBox];
if(iOffLocal < nIBox) {
Expand Down Expand Up @@ -122,8 +122,8 @@ void kineticEnergy(SimFlat* s)

RAJA::kernel<atomWorkKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, s->boxes->nLocalBoxes),
RAJA::RangeSegment(0, MAXATOMS) ),
RAJA::TypedRangeSegment<int>(0, s->boxes->nLocalBoxes),
RAJA::TypedRangeSegment<int>(0, MAXATOMS) ),
[=] COMD_DEVICE (int iBox, int iOffLocal) {
const int nIBox = s->boxes->nAtoms[iBox];
if(iOffLocal < nIBox) {
Expand Down Expand Up @@ -272,7 +272,7 @@ void redistributeAtoms(SimFlat* sim)
startTimer(atomSortTimer);
RAJA::kernel<redistributeKernel>(
RAJA::make_tuple(
RAJA::RangeSegment(0, sim->boxes->nTotalBoxes)),
RAJA::TypedRangeSegment<int>(0, sim->boxes->nTotalBoxes)),
[=] COMD_DEVICE (int iBox) {
sortAtomsInCell(sim->atoms, sim->boxes, iBox);
} );
Expand Down
2 changes: 1 addition & 1 deletion blt
Submodule blt updated 156 files
29 changes: 0 additions & 29 deletions host-configs/blueos/clang_3_9_1.cmake

This file was deleted.

29 changes: 0 additions & 29 deletions host-configs/blueos/clang_4_0_0.cmake

This file was deleted.

16 changes: 16 additions & 0 deletions host-configs/blueos/clang_X.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###############################################################################
# Copyright (c) 2016-21, Lawrence Livermore National Security, LLC
# and RAJA project contributors. See the RAJA/COPYRIGHT file for details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
###############################################################################

set(RAJA_COMPILER "RAJA_COMPILER_CLANG" CACHE STRING "")

set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g" CACHE STRING "")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING "")

set(RAJA_DATA_ALIGN 64 CACHE STRING "")

set(RAJA_HOST_CONFIG_LOADED On CACHE BOOL "")
29 changes: 0 additions & 29 deletions host-configs/blueos/clang_coral_2017_08_31.cmake

This file was deleted.

Loading

0 comments on commit 9853d2e

Please sign in to comment.