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

Sacado: Rework hieararchical performance tests #7384

Merged
merged 3 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
14 changes: 12 additions & 2 deletions packages/sacado/src/Sacado_Fad_ViewStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ namespace Sacado {

namespace Fad {

#ifndef SACADO_FAD_DERIV_LOOP
#if defined(SACADO_VIEW_CUDA_HIERARCHICAL_DFAD) && !defined(SACADO_DISABLE_CUDA_IN_KOKKOS) && defined(__CUDA_ARCH__)
#define SACADO_FAD_DERIV_LOOP(I,SZ) for (int I=threadIdx.x; I<SZ; I+=blockDim.x)
#else
#define SACADO_FAD_DERIV_LOOP(I,SZ) for (int I=0; I<SZ; ++I)
#endif
#endif

/*!
* \brief Derivative array storage class that is a view into a contiguous
* memory allocation. It does not provide proper value semantics and
Expand Down Expand Up @@ -110,10 +118,12 @@ namespace Sacado {
if (this != &x) {
*val_ = *x.val_;
if (stride_one)
for (int i=0; i<sz_.value; ++i)
//for (int i=0; i<sz_.value; ++i)
SACADO_FAD_DERIV_LOOP(i,sz_.value)
dx_[i] = x.dx_[i];
else
for (int i=0; i<sz_.value; ++i)
//for (int i=0; i<sz_.value; ++i)
SACADO_FAD_DERIV_LOOP(i,sz_.value)
dx_[i*stride_.value] = x.dx_[i*x.stride_.value];
}
return *this;
Expand Down
14 changes: 12 additions & 2 deletions packages/sacado/src/new_design/Sacado_Fad_Exp_ViewStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ namespace Sacado {
namespace Fad {
namespace Exp {

#ifndef SACADO_FAD_DERIV_LOOP
#if defined(SACADO_VIEW_CUDA_HIERARCHICAL_DFAD) && !defined(SACADO_DISABLE_CUDA_IN_KOKKOS) && defined(__CUDA_ARCH__)
#define SACADO_FAD_DERIV_LOOP(I,SZ) for (int I=threadIdx.x; I<SZ; I+=blockDim.x)
#else
#define SACADO_FAD_DERIV_LOOP(I,SZ) for (int I=0; I<SZ; ++I)
#endif
#endif

// Class representing a pointer to ViewFad so that &ViewFad is supported
template <typename T, unsigned sl, unsigned ss, typename U>
class ViewFadPtr;
Expand Down Expand Up @@ -118,10 +126,12 @@ namespace Sacado {
reinterpret_cast<const volatile char&>(x)))) {
*val_ = *x.val_;
if (stride_one)
for (int i=0; i<sz_.value; ++i)
//for (int i=0; i<sz_.value; ++i)
SACADO_FAD_DERIV_LOOP(i,sz_.value)
dx_[i] = x.dx_[i];
else
for (int i=0; i<sz_.value; ++i)
//for (int i=0; i<sz_.value; ++i)
SACADO_FAD_DERIV_LOOP(i,sz_.value)
dx_[i*stride_.value] = x.dx_[i*x.stride_.value];
}
return *this;
Expand Down
47 changes: 26 additions & 21 deletions packages/sacado/test/performance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,34 @@ ENDIF()

IF (Sacado_ENABLE_TeuchosCore AND Sacado_ENABLE_KokkosCore)

TRIBITS_ADD_EXECUTABLE(
fad_kokkos_view
SOURCES fad_kokkos_view.cpp
COMM serial mpi
)

# These tests do not compile with gcc 4.7.x because it doesn't properly
# support lambdas. See github issue #854
IF(NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8")))
TRIBITS_ADD_EXECUTABLE(
fad_kokkos_hierarchical
SOURCES fad_kokkos_hierarchical.cpp
COMM serial mpi
)

# TRIBITS_ADD_EXECUTABLE(
# fad_kokkos_mat_vec_perf
# SOURCES fad_kokkos_mat_vec_perf.cpp
# COMM serial mpi
# )
ENDIF()
# Disable these tests as they have been replaced by mat_vec, advection* below

# TRIBITS_ADD_EXECUTABLE(
# fad_kokkos_view
# SOURCES fad_kokkos_view.cpp
# COMM serial mpi
# )

# # These tests do not compile with gcc 4.7.x because it doesn't properly
# # support lambdas. See github issue #854
# IF(NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8")))
# TRIBITS_ADD_EXECUTABLE(
# fad_kokkos_hierarchical
# SOURCES fad_kokkos_hierarchical.cpp
# COMM serial mpi
# )

# TRIBITS_ADD_EXECUTABLE(
# fad_kokkos_mat_vec_perf
# SOURCES fad_kokkos_mat_vec_perf.cpp
# COMM serial mpi
# )
# ENDIF()

ENDIF()

ADD_SUBDIRECTORY(fenl_assembly)
ADD_SUBDIRECTORY(fenl_assembly_view)
ADD_SUBDIRECTORY(mat_vec)
ADD_SUBDIRECTORY(advection)
ADD_SUBDIRECTORY(advection_const_basis)
22 changes: 22 additions & 0 deletions packages/sacado/test/performance/advection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ASSERT_DEFINED(PACKAGE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR)

INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

IF (Sacado_ENABLE_KokkosCore AND Sacado_ENABLE_TeuchosCore)

IF(NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8")))

TRIBITS_ADD_EXECUTABLE(
FadAdvectionHierarchicalTest
SOURCES common.hpp
advection.hpp advection.cpp
advection_hierarchical.hpp advection_hierarchical.cpp
advection_hierarchical_dfad.hpp advection_hierarchical_dfad.cpp
driver.cpp
COMM serial mpi
)

ENDIF()

ENDIF()
Loading