Update Kokkos library in LAMMPS to v3.1

This commit is contained in:
Stan Moore
2020-04-16 09:06:08 -06:00
parent fa6922a182
commit ba8d043c7e
554 changed files with 24628 additions and 14871 deletions

View File

@ -12,8 +12,38 @@ KOKKOS_ADD_TEST_LIBRARY(
HEADERS ${GTEST_SOURCE_DIR}/gtest/gtest.h
SOURCES ${GTEST_SOURCE_DIR}/gtest/gtest-all.cc
)
KOKKOS_TARGET_COMPILE_DEFINITIONS(kokkos_gtest PUBLIC "-DGTEST_HAS_PTHREAD=0")
KOKKOS_TARGET_INCLUDE_DIRECTORIES(kokkos_gtest PUBLIC ${GTEST_SOURCE_DIR})
#These can be direct, no need for Tribits or Kokkos wrappers
# WORKAROUND FOR HIPCC
IF(Kokkos_ENABLE_HIP)
TARGET_COMPILE_DEFINITIONS(kokkos_gtest PUBLIC "-DGTEST_HAS_PTHREAD=0 --amdgpu-target=gfx906")
ELSE()
TARGET_COMPILE_DEFINITIONS(kokkos_gtest PUBLIC "-DGTEST_HAS_PTHREAD=0")
ENDIF()
TARGET_INCLUDE_DIRECTORIES(kokkos_gtest PUBLIC ${GTEST_SOURCE_DIR})
#Gtest minimally requires C++11
TARGET_COMPILE_FEATURES(kokkos_gtest PUBLIC cxx_std_11)
#
# Define Incremental Testing Feature Levels
# Define Device name mappings (i.e. what comes after Kokkos:: for the ExecSpace)
#
SET(KOKKOS_CUDA_FEATURE_LEVEL 999)
SET(KOKKOS_CUDA_NAME Cuda)
SET(KOKKOS_HIP_FEATURE_LEVEL 12)
SET(KOKKOS_HIP_NAME Experimental::HIP)
SET(KOKKOS_HPX_FEATURE_LEVEL 999)
SET(KOKKOS_HPX_NAME Experimental::HPX)
SET(KOKKOS_OPENMP_FEATURE_LEVEL 999)
SET(KOKKOS_OPENMP_NAME OpenMP)
SET(KOKKOS_OPENMPTARGET_FEATURE_LEVEL 10)
SET(KOKKOS_OPENMPTARGET_NAME Experimental::OpenMPTarget)
SET(KOKKOS_SERIAL_FEATURE_LEVEL 999)
SET(KOKKOS_SERIAL_NAME Serial)
SET(KOKKOS_THREADS_FEATURE_LEVEL 999)
SET(KOKKOS_THREADS_NAME Threads)
#
@ -24,7 +54,7 @@ KOKKOS_TARGET_INCLUDE_DIRECTORIES(kokkos_gtest PUBLIC ${GTEST_SOURCE_DIR})
KOKKOS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
KOKKOS_INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR})
foreach(Tag Threads;Serial;OpenMP;Cuda;HPX)
foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP)
# Because there is always an exception to the rule
if(Tag STREQUAL "Threads")
set(DEVICE "PTHREAD")
@ -46,6 +76,7 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX)
${dir}/Test${Tag}_AtomicOperations_complexfloat.cpp
${dir}/Test${Tag}_AtomicViews.cpp
${dir}/Test${Tag}_Atomics.cpp
${dir}/Test${Tag}_Concepts.cpp
${dir}/Test${Tag}_Complex.cpp
${dir}/Test${Tag}_Crs.cpp
${dir}/Test${Tag}_DeepCopyAlignment.cpp
@ -59,6 +90,7 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX)
${dir}/Test${Tag}_MDRange_e.cpp
${dir}/Test${Tag}_Other.cpp
${dir}/Test${Tag}_RangePolicy.cpp
${dir}/Test${Tag}_RangePolicyRequire.cpp
${dir}/Test${Tag}_Reductions.cpp
${dir}/Test${Tag}_Reducers_a.cpp
${dir}/Test${Tag}_Reducers_b.cpp
@ -104,6 +136,30 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX)
)
endforeach()
if(Kokkos_ENABLE_OPENMPTARGET)
list(REMOVE_ITEM OpenMPTarget_SOURCES
openmptarget/TestOpenMPTarget_AtomicOperations_complexdouble.cpp
openmptarget/TestOpenMPTarget_MDRange_a.cpp
openmptarget/TestOpenMPTarget_MDRange_b.cpp
openmptarget/TestOpenMPTarget_MDRange_c.cpp
openmptarget/TestOpenMPTarget_MDRange_d.cpp
openmptarget/TestOpenMPTarget_MDRange_e.cpp
openmptarget/TestOpenMPTarget_Other.cpp
openmptarget/TestOpenMPTarget_Scan.cpp
openmptarget/TestOpenMPTarget_Team.cpp
openmptarget/TestOpenMPTarget_TeamScratch.cpp
openmptarget/TestOpenMPTarget_ViewAPI_e.cpp
openmptarget/TestOpenMPTarget_ViewMapping_subview.cpp
openmptarget/TestOpenMPTarget_ViewOfClass.cpp
)
endif()
if(Kokkos_ENABLE_HIP)
# FIXME Linktime error: undefined reference to
# Kokkos::Impl::ViewDimensin<0ul, ...>(unsigned int, ...)
list(REMOVE_ITEM Serial_SOURCES serial/TestSerial_ViewLayoutStrideAssignment.cpp)
endif()
if(Kokkos_ENABLE_SERIAL)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
UnitTest_Serial
@ -150,42 +206,11 @@ if(Kokkos_ENABLE_HPX)
)
endif()
if(Kokkos_ENABLE_QTHREADS)
if(Kokkos_ENABLE_OPENMPTARGET)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
UnitTest_Qthreads
UnitTest_OpenMPTarget
SOURCES
UnitTestMainInit.cpp
qthreads/TestQthreads_Atomics.cpp
qthreads/TestQthreads_Complex.cpp
qthreads/TestQthreads_DeepCopyAlignment.cpp
qthreads/TestQthreads_Other.cpp
qthreads/TestQthreads_Reductions.cpp
qthreads/TestQthreads_Reducers_a.cpp
qthreads/TestQthreads_Reducers_b.cpp
qthreads/TestQthreads_Reducers_c.cpp
qthreads/TestQthreads_Reducers_d.cpp
qthreads/TestQthreads_SubView_a.cpp
qthreads/TestQthreads_SubView_b.cpp
qthreads/TestQthreads_SubView_c01.cpp
qthreads/TestQthreads_SubView_c02.cpp
qthreads/TestQthreads_SubView_c03.cpp
qthreads/TestQthreads_SubView_c04.cpp
qthreads/TestQthreads_SubView_c05.cpp
qthreads/TestQthreads_SubView_c06.cpp
qthreads/TestQthreads_SubView_c07.cpp
qthreads/TestQthreads_SubView_c08.cpp
qthreads/TestQthreads_SubView_c09.cpp
qthreads/TestQthreads_SubView_c10.cpp
qthreads/TestQthreads_SubView_c11.cpp
qthreads/TestQthreads_SubView_c12.cpp
qthreads/TestQthreads_SubView_c13.cpp
qthreads/TestQthreads_Team.cpp
qthreads/TestQthreads_View_64bit.cpp
qthreads/TestQthreads_ViewAPI_a.cpp
qthreads/TestQthreads_ViewAPI_b.cpp
qthreads/TestQthreads_ViewAPI_c.cpp
qthreads/TestQthreads_ViewAPI_d.cpp
qthreads/TestQthreads_ViewAPI_e.cpp
${OpenMPTarget_SOURCES}
)
endif()
@ -233,22 +258,66 @@ if(Kokkos_ENABLE_CUDA)
)
endif()
if(Kokkos_ENABLE_HIP)
# FIXME_HIP
LIST(REMOVE_ITEM HIP_SOURCES
hip/TestHIP_AtomicOperations_complexdouble.cpp
hip/TestHIP_Other.cpp
hip/TestHIP_Reductions_DeviceView.cpp
hip/TestHIP_Team.cpp
hip/TestHIP_TeamReductionScan.cpp
hip/TestHIP_TeamScratch.cpp
hip/TestHIP_TeamTeamSize.cpp
hip/TestHIP_TeamVectorRange.cpp
hip/TestHIP_UniqueToken.cpp
hip/TestHIP_ViewAPI_a.cpp
hip/TestHIP_ViewAPI_b.cpp
hip/TestHIP_ViewAPI_e.cpp
hip/TestHIP_ViewLayoutStrideAssignment.cpp
hip/TestHIP_WorkGraph.cpp
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
UnitTest_HIP
SOURCES
${HIP_SOURCES}
hip/TestHIPHostPinned_ViewAPI_a.cpp
hip/TestHIPHostPinned_ViewAPI_b.cpp
hip/TestHIPHostPinned_ViewAPI_c.cpp
hip/TestHIPHostPinned_ViewAPI_d.cpp
hip/TestHIPHostPinned_ViewAPI_e.cpp
hip/TestHIPHostPinned_ViewCopy.cpp
hip/TestHIPHostPinned_ViewMapping_a.cpp
hip/TestHIPHostPinned_ViewMapping_b.cpp
hip/TestHIPHostPinned_ViewMapping_subview.cpp
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
UnitTest_HIPInterOpInit
SOURCES
UnitTestMain.cpp
hip/TestHIP_InterOp_Init.cpp
)
endif()
SET(DEFAULT_DEVICE_SOURCES
UnitTestMainInit.cpp
default/TestDefaultDeviceType.cpp
default/TestDefaultDeviceType_a1.cpp
default/TestDefaultDeviceType_b1.cpp
default/TestDefaultDeviceType_c1.cpp
default/TestDefaultDeviceType_a2.cpp
default/TestDefaultDeviceType_b2.cpp
default/TestDefaultDeviceType_c2.cpp
default/TestDefaultDeviceType_a3.cpp
default/TestDefaultDeviceType_b3.cpp
default/TestDefaultDeviceType_c3.cpp
default/TestDefaultDeviceType_d.cpp
default/TestDefaultDeviceTypeResize.cpp
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
UnitTest_Default
SOURCES
UnitTestMainInit.cpp
default/TestDefaultDeviceType.cpp
default/TestDefaultDeviceType_a1.cpp
default/TestDefaultDeviceType_b1.cpp
default/TestDefaultDeviceType_c1.cpp
default/TestDefaultDeviceType_a2.cpp
default/TestDefaultDeviceType_b2.cpp
default/TestDefaultDeviceType_c2.cpp
default/TestDefaultDeviceType_a3.cpp
default/TestDefaultDeviceType_b3.cpp
default/TestDefaultDeviceType_c3.cpp
default/TestDefaultDeviceType_d.cpp
default/TestDefaultDeviceTypeResize.cpp
SOURCES ${DEFAULT_DEVICE_SOURCES}
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
@ -275,6 +344,7 @@ KOKKOS_ADD_ADVANCED_TEST( UnitTest_PushFinalizeHook_terminate
ALWAYS_FAIL_ON_ZERO_RETURN
)
if(NOT KOKKOS_HAS_TRILINOS)
KOKKOS_ADD_TEST_EXECUTABLE(
StackTraceTestExec
SOURCES
@ -287,20 +357,9 @@ KOKKOS_ADD_TEST_EXECUTABLE(
)
# We need -rdynamic on GNU platforms for the stacktrace functionality
# to work correctly with shared libraries
if(NOT KOKKOS_HAS_TRILINOS)
SET_PROPERTY(TARGET StackTraceTestExec PROPERTY ENABLE_EXPORTS 1)
KOKKOS_SET_EXE_PROPERTY(StackTraceTestExec ENABLE_EXPORTS ON)
KOKKOS_ADD_TEST( NAME UnitTest_StackTraceTest_normal
EXE StackTraceTestExec
FAIL_REGULAR_EXPRESSION "FAILED"
)
KOKKOS_ADD_TEST( NAME UnitTest_StackTraceTest_terminate
EXE StackTraceTestExec
FAIL_REGULAR_EXPRESSION "FAILED"
)
KOKKOS_ADD_TEST( NAME UnitTest_StackTraceTest_generic_term
KOKKOS_ADD_TEST( NAME UnitTest_StackTraceTest
EXE StackTraceTestExec
FAIL_REGULAR_EXPRESSION "FAILED"
)
@ -325,5 +384,52 @@ KOKKOS_ADD_EXECUTABLE_AND_TEST(
SOURCES UnitTestMain.cpp TestHostBarrier.cpp
)
FUNCTION (KOKKOS_ADD_INCREMENTAL_TEST DEVICE)
KOKKOS_OPTION( ${DEVICE}_EXCLUDE_TESTS "" STRING "Incremental test exclude list" )
# Add unit test main
SET(${DEVICE}_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/UnitTestMainInit.cpp)
# Iterate over incremental tests in directory
APPEND_GLOB(INCREMENTAL_FILE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/incremental/*.hpp)
SET(DEVICE_NAME ${KOKKOS_${DEVICE}_NAME})
FOREACH (CURRENT_FILE_PATH ${INCREMENTAL_FILE_LIST})
GET_FILENAME_COMPONENT( CURRENT_FILE_NAME ${CURRENT_FILE_PATH} NAME )
STRING (REPLACE ".hpp" "" CURRENT_TEST_NAME ${CURRENT_FILE_NAME})
IF (NOT CURRENT_TEST_NAME IN_LIST Kokkos_${DEVICE}_EXCLUDE_TESTS)
SET (CURRENT_TEST_OUTPUT_FILENAME ${CURRENT_TEST_NAME}_${DEVICE})
FILE( STRINGS ${CURRENT_FILE_PATH} CURRENT_REQUIRED_FEATURE_LINE REGEX "Kokkos_Feature_Level_Required" )
# From each test get level implementation required
STRING( REGEX REPLACE ".*Kokkos_Feature_Level_Required:" "" CURRENT_REQUIRED_FEATURE_LEVEL ${CURRENT_REQUIRED_FEATURE_LINE} )
# Cross-reference list of dependencies with selected feature list > matching feature test files are added to test applications
IF (KOKKOS_${DEVICE}_FEATURE_LEVEL GREATER_EQUAL CURRENT_REQUIRED_FEATURE_LEVEL)
CONFIGURE_FILE (IncrementalTest.cpp.in ${CMAKE_BINARY_DIR}/core/unit_test/generated/${CURRENT_TEST_OUTPUT_FILENAME}.cpp )
SET(${DEVICE}_SOURCES ${${DEVICE}_SOURCES}; ${CMAKE_BINARY_DIR}/core/unit_test/generated/${CURRENT_TEST_OUTPUT_FILENAME}.cpp)
ENDIF()
ENDIF()
ENDFOREACH()
STRING(TOUPPER ${DEVICE} UC_DEVICE)
KOKKOS_OPTION (
ENABLE_${UC_DEVICE} ON BOOL "ENABLE ${UC_DEVICE}"
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
IncrementalTest_${DEVICE}
SOURCES ${${DEVICE}_SOURCES}
)
TARGET_INCLUDE_DIRECTORIES( ${PACKAGE_NAME}_IncrementalTest_${DEVICE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incremental )
ENDFUNCTION()
FOREACH (DEVICE ${KOKKOS_ENABLED_DEVICES})
KOKKOS_ADD_INCREMENTAL_TEST(${DEVICE})
ENDFOREACH()
KOKKOS_ADD_EXECUTABLE_AND_TEST(
UnitTest_CTestDevice
SOURCES UnitTestMain.cpp TestCTestDevice.cpp
)

View File

@ -0,0 +1,58 @@
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
#ifndef KOKKOS_TEST_@BACK_END_NAME@_@CURRENT_TEST_NAME@
#define KOKKOS_TEST_@BACK_END_NAME@_@CURRENT_TEST_NAME@
#include <gtest/gtest.h>
#include <Kokkos_Macros.hpp>
#define TEST_CATEGORY @DEVICE@
#define TEST_EXECSPACE Kokkos::@DEVICE_NAME@
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#include <@CURRENT_FILE_NAME@>
#endif
#endif

View File

@ -8,7 +8,7 @@ vpath %.cpp ${KOKKOS_PATH}/core/unit_test/serial
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/threads
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/openmp
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/openmptarget
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/qthreads
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/hip
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/hpx
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/cuda
vpath %.cpp ${KOKKOS_PATH}/core/unit_test/rocm
@ -67,7 +67,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
OBJ_CUDA = UnitTestMainInit.o gtest-all.o
OBJ_CUDA += TestCuda_Init.o
OBJ_CUDA += TestCuda_SharedAlloc.o TestCudaUVM_SharedAlloc.o TestCudaHostPinned_SharedAlloc.o
OBJ_CUDA += TestCuda_RangePolicy.o
OBJ_CUDA += TestCuda_RangePolicy.o TestCuda_RangePolicyRequire.o
OBJ_CUDA += TestCuda_ViewAPI_a.o TestCuda_ViewAPI_b.o TestCuda_ViewAPI_c.o TestCuda_ViewAPI_d.o TestCuda_ViewAPI_e.o
OBJ_CUDA += TestCuda_DeepCopyAlignment.o
OBJ_CUDA += TestCuda_ViewMapping_a.o TestCuda_ViewMapping_b.o TestCuda_ViewMapping_subview.o TestCuda_ViewResize.o TestCuda_ViewLayoutStrideAssignment.o
@ -103,7 +103,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
OBJ_CUDA += TestCuda_LocalDeepCopy.o
OBJ_CUDA += TestCuda_DebugSerialExecution.o
OBJ_CUDA += TestCuda_DebugPinUVMSpace.o
TARGETS += KokkosCore_UnitTest_Cuda
TARGETS += KokkosCore_UnitTest_CudaInterOpInit
TARGETS += KokkosCore_UnitTest_CudaInterOpStreams
@ -166,7 +166,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_PTHREADS), 1)
OBJ_THREADS = UnitTestMainInit.o gtest-all.o
OBJ_THREADS += TestThreads_Init.o
OBJ_THREADS += TestThreads_SharedAlloc.o
OBJ_THREADS += TestThreads_RangePolicy.o
OBJ_THREADS += TestThreads_RangePolicy.o TestThreads_RangePolicyRequire.o
OBJ_THREADS += TestThreads_View_64bit.o
OBJ_THREADS += TestThreads_ViewAPI_a.o TestThreads_ViewAPI_b.o TestThreads_ViewAPI_c.o TestThreads_ViewAPI_d.o TestThreads_ViewAPI_e.o
OBJ_THREADS += TestThreads_DeepCopyAlignment.o
@ -201,7 +201,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
OBJ_OPENMP = UnitTestMainInit.o gtest-all.o
OBJ_OPENMP += TestOpenMP_Init.o
OBJ_OPENMP += TestOpenMP_SharedAlloc.o
OBJ_OPENMP += TestOpenMP_RangePolicy.o
OBJ_OPENMP += TestOpenMP_RangePolicy.o TestOpenMP_RangePolicyRequire.o
OBJ_OPENMP += TestOpenMP_View_64bit.o
OBJ_OPENMP += TestOpenMP_ViewAPI_a.o TestOpenMP_ViewAPI_b.o TestOpenMP_ViewAPI_c.o TestOpenMP_ViewAPI_d.o TestOpenMP_ViewAPI_e.o
OBJ_OPENMP += TestOpenMP_DeepCopyAlignment.o
@ -242,11 +242,12 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
OBJ_OPENMPTARGET += TestOpenMPTarget_Init.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_SharedAlloc.o
OBJ_OPENMPTARGET += TestOpenMPTarget_RangePolicy.o
OBJ_OPENMPTARGET += TestOpenMPTarget_ViewAPI_a.o TestOpenMPTarget_ViewAPI_b.o TestOpenMPTarget_ViewAPI_c.o TestOpenMPTarget_ViewAPI_d.o TestOpenMPTarget_ViewAPI_e.o #Some commented out code
OBJ_OPENMPTARGET += TestOpenMPTarget_ViewAPI_a.o TestOpenMPTarget_ViewAPI_b.o TestOpenMPTarget_ViewAPI_c.o TestOpenMPTarget_ViewAPI_d.o #Some commented out code
#OBJ_OPENMPTARGET += TestOpenMPTarget_ViewAPI_e.o
OBJ_OPENMPTARGET += TestOpenMPTarget_DeepCopyAlignment.o
OBJ_OPENMPTARGET += TestOpenMPTarget_ViewMapping_a.o
OBJ_OPENMPTARGET += TestOpenMPTarget_ViewMapping_b.o
OBJ_OPENMPTARGET += TestOpenMPTarget_ViewMapping_subview.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_ViewMapping_subview.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_ViewOfClass.o
OBJ_OPENMPTARGET += TestOpenMPTarget_SubView_a.o TestOpenMPTarget_SubView_b.o
#The following subview tests need something like UVM:
@ -255,12 +256,13 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
#OBJ_OPENMPTARGET += TestOpenMPTarget_SubView_c07.o TestOpenMPTarget_SubView_c08.o TestOpenMPTarget_SubView_c09.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_SubView_c10.o TestOpenMPTarget_SubView_c11.o TestOpenMPTarget_SubView_c12.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_Reductions.o # Need custom reductions
#OBJ_OPENMPTARGET += TestOpenMPTarget_Reducers_a.o TestOpenMPTarget_Reducers_b.o TestOpenMPTarget_Reducers_c.o TestOpenMPTarget_Reducers_d.o
OBJ_OPENMPTARGET += TestOpenMPTarget_Reducers_a.o TestOpenMPTarget_Reducers_b.o TestOpenMPTarget_Reducers_c.o TestOpenMPTarget_Reducers_d.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_Scan.o
OBJ_OPENMPTARGET += TestOpenMPTarget_Complex.o
OBJ_OPENMPTARGET += TestOpenMPTarget_AtomicOperations_int.o TestOpenMPTarget_AtomicOperations_unsignedint.o TestOpenMPTarget_AtomicOperations_longint.o
OBJ_OPENMPTARGET += TestOpenMPTarget_AtomicOperations_unsignedlongint.o TestOpenMPTarget_AtomicOperations_longlongint.o TestOpenMPTarget_AtomicOperations_double.o TestOpenMPTarget_AtomicOperations_float.o
OBJ_OPENMPTARGET += TestOpenMPTarget_AtomicOperations_complexfloat.o TestOpenMPTarget_AtomicOperations_complexdouble.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_AtomicOperations_complexfloat.o
#OBJ_OPENMPTARGET += TestOpenMPTarget_AtomicOperations_complexdouble.o
OBJ_OPENMPTARGET += TestOpenMPTarget_AtomicViews.o
OBJ_OPENMPTARGET += TestOpenMPTarget_Atomics.o # Commented Out Arbitrary Type Atomics
#OBJ_OPENMPTARGET += TestOpenMPTarget_Team.o # There is still a static function in this
@ -275,28 +277,26 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
TEST_TARGETS += test-openmptarget
endif
ifeq ($(KOKKOS_INTERNAL_USE_QTHREADS), 1)
OBJ_QTHREADS = TestQthreads_Other.o TestQthreads_Reductions.o TestQthreads_Atomics.o TestQthreads_Team.o
OBJ_QTHREADS += TestQthreads_SubView_a.o TestQthreads_SubView_b.o
OBJ_QTHREADS += TestQthreads_SubView_c01.o TestQthreads_SubView_c02.o TestQthreads_SubView_c03.o
OBJ_QTHREADS += TestQthreads_SubView_c04.o TestQthreads_SubView_c05.o TestQthreads_SubView_c06.o
OBJ_QTHREADS += TestQthreads_SubView_c07.o TestQthreads_SubView_c08.o TestQthreads_SubView_c09.o
OBJ_QTHREADS += TestQthreads_SubView_c10.o TestQthreads_SubView_c11.o TestQthreads_SubView_c12.o
OBJ_QTHREADS += TestQthreads_ViewAPI_a.o TestQthreads_ViewAPI_b.o TestQthreads_ViewAPI_c.o TestQthreads_ViewAPI_d.o TestQthreads_ViewAPI_e.o UnitTestMain.o gtest-all.o
TARGETS += KokkosCore_UnitTest_Qthreads
ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
OBJ_HIP = UnitTestMainInit.o gtest-all.o
OBJ_HIP += TestHIP_Init.o
OBJ_HIP += TestHIP_Reducers_a.o TestHIP_Reducers_b.o TestHIP_Reducers_c.o TestHIP_Reducers_d.o
OBJ_HIP += TestHIP_Reductions.o
OBJ_HIP += TestHIP_MDRange_a.o TestHIP_MDRange_b.o TestHIP_MDRange_c.o TestHIP_MDRange_d.o TestHIP_MDRange_e.o
OBJ_HIP += TestHIP_Spaces.o
OBJ_HIP += TestHIPHostPinned_ViewCopy.o TestHIPHostPinned_ViewAPI_a.o TestHIPHostPinned_ViewAPI_b.o TestHIPHostPinned_ViewAPI_c.o TestHIPHostPinned_ViewAPI_d.o TestHIPHostPinned_ViewAPI_e.o
OBJ_HIP += TestHIPHostPinned_ViewMapping_a.o TestHIPHostPinned_ViewMapping_b.o TestHIPHostPinned_ViewMapping_subview.o
OBJ_QTHREADS2 = UnitTestMainInit.o gtest-all.o
OBJ_QTHREADS2 += TestQthreads_Complex.o
TARGETS += KokkosCore_UnitTest_Qthreads2
TARGETS += KokkosCore_UnitTest_HIP
TEST_TARGETS += test-qthreads
TEST_TARGETS += test-hip
endif
ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1)
OBJ_HPX = UnitTestMainInit.o gtest-all.o
OBJ_HPX += TestHPX_Init.o
OBJ_HPX += TestHPX_SharedAlloc.o
OBJ_HPX += TestHPX_RangePolicy.o
OBJ_HPX += TestHPX_RangePolicy.o TestHPX_RangePolicyRequire.o
OBJ_HPX += TestHPX_View_64bit.o
OBJ_HPX += TestHPX_ViewAPI_a.o TestHPX_ViewAPI_b.o TestHPX_ViewAPI_c.o TestHPX_ViewAPI_d.o TestHPX_ViewAPI_e.o
OBJ_HPX += TestHPX_ViewMapping_a.o TestHPX_ViewMapping_b.o TestHPX_ViewMapping_subview.o TestHPX_ViewResize.o
@ -335,7 +335,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1)
OBJ_SERIAL = UnitTestMainInit.o gtest-all.o
OBJ_SERIAL += TestSerial_Init.o
OBJ_SERIAL += TestSerial_SharedAlloc.o
OBJ_SERIAL += TestSerial_RangePolicy.o
OBJ_SERIAL += TestSerial_RangePolicy.o TestSerial_RangePolicyRequire.o
OBJ_SERIAL += TestSerial_View_64bit.o
OBJ_SERIAL += TestSerial_ViewAPI_a.o TestSerial_ViewAPI_b.o TestSerial_ViewAPI_c.o TestSerial_ViewAPI_d.o TestSerial_ViewAPI_e.o
OBJ_SERIAL += TestSerial_DeepCopyAlignment.o
@ -414,7 +414,7 @@ TEST_TARGETS += ${INITTESTS_TEST_TARGETS}
KokkosCore_UnitTest_Cuda: $(OBJ_CUDA) $(KOKKOS_LINK_DEPENDS)
$(LINK) $(EXTRA_PATH) $(OBJ_CUDA) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_Cuda
KokkosCore_UnitTest_CudaInterOpInit: UnitTestMain.o gtest-all.o TestCuda_InterOp_Init.o $(KOKKOS_LINK_DEPENDS)
$(LINK) $(EXTRA_PATH) UnitTestMain.o gtest-all.o TestCuda_InterOp_Init.o $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_CudaInterOpInit
KokkosCore_UnitTest_CudaInterOpStreams: UnitTestMain.o gtest-all.o TestCuda_InterOp_Streams.o $(KOKKOS_LINK_DEPENDS)
@ -438,11 +438,8 @@ KokkosCore_UnitTest_OpenMPTarget: $(OBJ_OPENMPTARGET) $(KOKKOS_LINK_DEPENDS)
KokkosCore_UnitTest_Serial: $(OBJ_SERIAL) $(KOKKOS_LINK_DEPENDS)
$(LINK) $(EXTRA_PATH) $(OBJ_SERIAL) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_Serial
KokkosCore_UnitTest_Qthreads: $(OBJ_QTHREADS) $(KOKKOS_LINK_DEPENDS)
$(LINK) $(EXTRA_PATH) $(OBJ_QTHREADS) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_Qthreads
KokkosCore_UnitTest_Qthreads2: $(OBJ_QTHREADS2) $(KOKKOS_LINK_DEPENDS)
$(LINK) $(EXTRA_PATH) $(OBJ_QTHREADS2) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_Qthreads2
KokkosCore_UnitTest_HIP: $(OBJ_HIP) $(KOKKOS_LINK_DEPENDS)
$(LINK) $(EXTRA_PATH) $(OBJ_HIP) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_HIP
KokkosCore_UnitTest_HPX: $(OBJ_HPX) $(KOKKOS_LINK_DEPENDS)
$(LINK) $(EXTRA_PATH) $(OBJ_HPX) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_HPX
@ -496,9 +493,8 @@ test-openmptarget: KokkosCore_UnitTest_OpenMPTarget
test-serial: KokkosCore_UnitTest_Serial
./KokkosCore_UnitTest_Serial
test-qthreads: KokkosCore_UnitTest_Qthreads KokkosCore_UnitTest_Qthreads2
./KokkosCore_UnitTest_Qthreads
./KokkosCore_UnitTest_Qthreads2
test-hip: KokkosCore_UnitTest_HIP
./KokkosCore_UnitTest_HIP
test-hpx: KokkosCore_UnitTest_HPX
./KokkosCore_UnitTest_HPX

View File

@ -527,7 +527,19 @@ TEST(TEST_CATEGORY, atomics) {
ASSERT_TRUE((TestAtomic::Loop<float, TEST_EXECSPACE>(100, 3)));
#ifndef KOKKOS_ENABLE_OPENMPTARGET
#ifndef KOKKOS_ENABLE_ROCM // ROCM doesn't yet support atomics for >64bit types
ASSERT_TRUE((TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(1, 1)));
ASSERT_TRUE((TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(1, 2)));
ASSERT_TRUE((TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(1, 3)));
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(100, 1)));
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(100, 2)));
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(100, 3)));
// FIXME_HIP HIP doesn't yet support atomics for >64bit types properly
#ifndef KOKKOS_ENABLE_HIP
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<double>, TEST_EXECSPACE>(1, 1)));
ASSERT_TRUE(
@ -542,17 +554,8 @@ TEST(TEST_CATEGORY, atomics) {
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<double>, TEST_EXECSPACE>(100, 3)));
ASSERT_TRUE((TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(1, 1)));
ASSERT_TRUE((TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(1, 2)));
ASSERT_TRUE((TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(1, 3)));
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(100, 1)));
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(100, 2)));
ASSERT_TRUE(
(TestAtomic::Loop<Kokkos::complex<float>, TEST_EXECSPACE>(100, 3)));
// WORKAROUND MSVC
#ifndef _WIN32
ASSERT_TRUE(
(TestAtomic::Loop<TestAtomic::SuperScalar<4>, TEST_EXECSPACE>(100, 1)));
ASSERT_TRUE(
@ -561,6 +564,7 @@ TEST(TEST_CATEGORY, atomics) {
(TestAtomic::Loop<TestAtomic::SuperScalar<4>, TEST_EXECSPACE>(100, 3)));
#endif
#endif
#endif
}
} // namespace Test

View File

@ -97,8 +97,8 @@ struct TestViewOperator_LeftAndRight<DataType, DeviceType, 1> {
right_view right;
stride_view left_stride;
stride_view right_stride;
long left_alloc;
long right_alloc;
int64_t left_alloc;
int64_t right_alloc;
TestViewOperator_LeftAndRight()
: left("left"),
@ -255,11 +255,11 @@ class TestAtomicViewAPI {
ASSERT_EQ(ax.use_count(), size_t(4));
ASSERT_EQ(const_ax.use_count(), ax.use_count());
ASSERT_FALSE(ax.data() == 0);
ASSERT_FALSE(const_ax.data() == 0); // referenceable ptr
ASSERT_FALSE(unmanaged_ax.data() == 0);
ASSERT_FALSE(unmanaged_ax_from_ptr_dx.data() == 0);
ASSERT_FALSE(ay.data() == 0);
ASSERT_FALSE(ax.data() == nullptr);
ASSERT_FALSE(const_ax.data() == nullptr); // referenceable ptr
ASSERT_FALSE(unmanaged_ax.data() == nullptr);
ASSERT_FALSE(unmanaged_ax_from_ptr_dx.data() == nullptr);
ASSERT_FALSE(ay.data() == nullptr);
// ASSERT_NE( ax, ay );
// Above test results in following runtime error from gtest:
// Expected: (ax) != (ay), actual: 32-byte object <30-01 D0-A0 D8-7F
@ -318,13 +318,13 @@ struct InitFunctor_Seq {
typedef Kokkos::View<T*, execution_space> view_type;
view_type input;
const long length;
const int64_t length;
InitFunctor_Seq(view_type& input_, const long length_)
InitFunctor_Seq(view_type& input_, const int64_t length_)
: input(input_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
input(i) = (T)i;
}
@ -336,15 +336,15 @@ struct InitFunctor_ModTimes {
typedef Kokkos::View<T*, execution_space> view_type;
view_type input;
const long length;
const long remainder;
const int64_t length;
const int64_t remainder;
InitFunctor_ModTimes(view_type& input_, const long length_,
const long remainder_)
InitFunctor_ModTimes(view_type& input_, const int64_t length_,
const int64_t remainder_)
: input(input_), length(length_), remainder(remainder_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % (remainder + 1) == remainder) {
input(i) = (T)2;
@ -360,15 +360,15 @@ struct InitFunctor_ModShift {
typedef Kokkos::View<T*, execution_space> view_type;
view_type input;
const long length;
const long remainder;
const int64_t length;
const int64_t remainder;
InitFunctor_ModShift(view_type& input_, const long length_,
const long remainder_)
InitFunctor_ModShift(view_type& input_, const int64_t length_,
const int64_t remainder_)
: input(input_), length(length_), remainder(remainder_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % (remainder + 1) == remainder) {
input(i) = 1;
@ -390,15 +390,15 @@ struct PlusEqualAtomicViewFunctor {
view_type input;
atomic_view_type even_odd_result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator
PlusEqualAtomicViewFunctor(const view_type& input_,
view_type& even_odd_result_, const long length_)
view_type& even_odd_result_, const int64_t length_)
: input(input_), even_odd_result(even_odd_result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % 2 == 0) {
even_odd_result(0) += input(i);
@ -410,11 +410,11 @@ struct PlusEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T PlusEqualAtomicView(const long input_length) {
T PlusEqualAtomicView(const int64_t input_length) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef typename view_type::HostMirror host_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
view_type result_view("result_view", 2);
@ -435,19 +435,19 @@ T PlusEqualAtomicView(const long input_length) {
}
template <class T>
T PlusEqualAtomicViewCheck(const long input_length) {
const long N = input_length;
T PlusEqualAtomicViewCheck(const int64_t input_length) {
const int64_t N = input_length;
T result[2];
if (N % 2 == 0) {
const long half_sum_end = (N / 2) - 1;
const long full_sum_end = N - 1;
const int64_t half_sum_end = (N / 2) - 1;
const int64_t full_sum_end = N - 1;
result[0] = half_sum_end * (half_sum_end + 1) / 2; // Even sum.
result[1] =
(full_sum_end * (full_sum_end + 1) / 2) - result[0]; // Odd sum.
} else {
const long half_sum_end = (T)(N / 2);
const long full_sum_end = N - 2;
const int64_t half_sum_end = (T)(N / 2);
const int64_t full_sum_end = N - 2;
result[0] = half_sum_end * (half_sum_end - 1) / 2; // Even sum.
result[1] =
(full_sum_end * (full_sum_end - 1) / 2) - result[0]; // Odd sum.
@ -457,7 +457,7 @@ T PlusEqualAtomicViewCheck(const long input_length) {
}
template <class T, class DeviceType>
bool PlusEqualAtomicViewTest(long input_length) {
bool PlusEqualAtomicViewTest(int64_t input_length) {
T res = PlusEqualAtomicView<T, DeviceType>(input_length);
T resSerial = PlusEqualAtomicViewCheck<T>(input_length);
@ -487,15 +487,16 @@ struct MinusEqualAtomicViewFunctor {
view_type input;
atomic_view_type even_odd_result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator.
MinusEqualAtomicViewFunctor(const view_type& input_,
view_type& even_odd_result_, const long length_)
view_type& even_odd_result_,
const int64_t length_)
: input(input_), even_odd_result(even_odd_result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % 2 == 0) {
even_odd_result(0) -= input(i);
@ -507,11 +508,11 @@ struct MinusEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T MinusEqualAtomicView(const long input_length) {
T MinusEqualAtomicView(const int64_t input_length) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef typename view_type::HostMirror host_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
view_type result_view("result_view", 2);
@ -532,19 +533,19 @@ T MinusEqualAtomicView(const long input_length) {
}
template <class T>
T MinusEqualAtomicViewCheck(const long input_length) {
const long N = input_length;
T MinusEqualAtomicViewCheck(const int64_t input_length) {
const int64_t N = input_length;
T result[2];
if (N % 2 == 0) {
const long half_sum_end = (N / 2) - 1;
const long full_sum_end = N - 1;
const int64_t half_sum_end = (N / 2) - 1;
const int64_t full_sum_end = N - 1;
result[0] = -1 * (half_sum_end * (half_sum_end + 1) / 2); // Even sum.
result[1] =
-1 * ((full_sum_end * (full_sum_end + 1) / 2) + result[0]); // Odd sum.
} else {
const long half_sum_end = (long)(N / 2);
const long full_sum_end = N - 2;
const int64_t half_sum_end = (int64_t)(N / 2);
const int64_t full_sum_end = N - 2;
result[0] = -1 * (half_sum_end * (half_sum_end - 1) / 2); // Even sum.
result[1] =
-1 * ((full_sum_end * (full_sum_end - 1) / 2) + result[0]); // Odd sum.
@ -554,7 +555,7 @@ T MinusEqualAtomicViewCheck(const long input_length) {
}
template <class T, class DeviceType>
bool MinusEqualAtomicViewTest(long input_length) {
bool MinusEqualAtomicViewTest(int64_t input_length) {
T res = MinusEqualAtomicView<T, DeviceType>(input_length);
T resSerial = MinusEqualAtomicViewCheck<T>(input_length);
@ -584,15 +585,15 @@ struct TimesEqualAtomicViewFunctor {
view_type input;
atomic_view_type result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator
TimesEqualAtomicViewFunctor(const view_type& input_, view_type& result_,
const long length_)
const int64_t length_)
: input(input_), result(result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length && i > 0) {
result(0) *= (double)input(i);
}
@ -600,11 +601,11 @@ struct TimesEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T TimesEqualAtomicView(const long input_length, const long remainder) {
T TimesEqualAtomicView(const int64_t input_length, const int64_t remainder) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef typename view_type::HostMirror host_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
view_type result_view("result_view", 1);
@ -626,12 +627,13 @@ T TimesEqualAtomicView(const long input_length, const long remainder) {
}
template <class T>
T TimesEqualAtomicViewCheck(const long input_length, const long remainder) {
T TimesEqualAtomicViewCheck(const int64_t input_length,
const int64_t remainder) {
// Analytical result.
const long N = input_length;
T result = 1.0;
const int64_t N = input_length;
T result = 1.0;
for (long i = 2; i < N; ++i) {
for (int64_t i = 2; i < N; ++i) {
if (i % (remainder + 1) == remainder) {
result *= 2.0;
} else {
@ -643,8 +645,8 @@ T TimesEqualAtomicViewCheck(const long input_length, const long remainder) {
}
template <class T, class DeviceType>
bool TimesEqualAtomicViewTest(const long input_length) {
const long remainder = 23;
bool TimesEqualAtomicViewTest(const int64_t input_length) {
const int64_t remainder = 23;
T res = TimesEqualAtomicView<T, DeviceType>(input_length, remainder);
T resSerial = TimesEqualAtomicViewCheck<T>(input_length, remainder);
@ -675,15 +677,15 @@ struct DivEqualAtomicViewFunctor {
view_type input;
atomic_view_type result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator.
DivEqualAtomicViewFunctor(const view_type& input_, scalar_view_type& result_,
const long length_)
const int64_t length_)
: input(input_), result(result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length && i > 0) {
result() /= (double)(input(i));
}
@ -691,12 +693,12 @@ struct DivEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T DivEqualAtomicView(const long input_length, const long remainder) {
T DivEqualAtomicView(const int64_t input_length, const int64_t remainder) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef Kokkos::View<T, execution_space> scalar_view_type;
typedef typename scalar_view_type::HostMirror host_scalar_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
scalar_view_type result_view("result_view");
@ -718,10 +720,10 @@ T DivEqualAtomicView(const long input_length, const long remainder) {
}
template <class T>
T DivEqualAtomicViewCheck(const long input_length, const long remainder) {
const long N = input_length;
T result = 12121212121.0;
for (long i = 2; i < N; ++i) {
T DivEqualAtomicViewCheck(const int64_t input_length, const int64_t remainder) {
const int64_t N = input_length;
T result = 12121212121.0;
for (int64_t i = 2; i < N; ++i) {
if (i % (remainder + 1) == remainder) {
result /= 1.0;
} else {
@ -733,8 +735,8 @@ T DivEqualAtomicViewCheck(const long input_length, const long remainder) {
}
template <class T, class DeviceType>
bool DivEqualAtomicViewTest(const long input_length) {
const long remainder = 23;
bool DivEqualAtomicViewTest(const int64_t input_length) {
const int64_t remainder = 23;
T res = DivEqualAtomicView<T, DeviceType>(input_length, remainder);
T resSerial = DivEqualAtomicViewCheck<T>(input_length, remainder);
@ -766,15 +768,15 @@ struct ModEqualAtomicViewFunctor {
view_type input;
atomic_view_type result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator.
ModEqualAtomicViewFunctor(const view_type& input_, scalar_view_type& result_,
const long length_)
const int64_t length_)
: input(input_), result(result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length && i > 0) {
result() %= (double)(input(i));
}
@ -782,12 +784,12 @@ struct ModEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T ModEqualAtomicView(const long input_length, const long remainder) {
T ModEqualAtomicView(const int64_t input_length, const int64_t remainder) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef Kokkos::View<T, execution_space> scalar_view_type;
typedef typename scalar_view_type::HostMirror host_scalar_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
scalar_view_type result_view("result_view");
@ -809,10 +811,10 @@ T ModEqualAtomicView(const long input_length, const long remainder) {
}
template <class T>
T ModEqualAtomicViewCheck(const long input_length, const long remainder) {
const long N = input_length;
T result = 12121212121;
for (long i = 2; i < N; ++i) {
T ModEqualAtomicViewCheck(const int64_t input_length, const int64_t remainder) {
const int64_t N = input_length;
T result = 12121212121;
for (int64_t i = 2; i < N; ++i) {
if (i % (remainder + 1) == remainder) {
result %= 1;
} else {
@ -824,12 +826,12 @@ T ModEqualAtomicViewCheck(const long input_length, const long remainder) {
}
template <class T, class DeviceType>
bool ModEqualAtomicViewTest(const long input_length) {
bool ModEqualAtomicViewTest(const int64_t input_length) {
static_assert(std::is_integral<T>::value,
"ModEqualAtomicView Error: Type must be integral type for this "
"unit test");
const long remainder = 23;
const int64_t remainder = 23;
T res = ModEqualAtomicView<T, DeviceType>(input_length, remainder);
T resSerial = ModEqualAtomicViewCheck<T>(input_length, remainder);
@ -861,16 +863,16 @@ struct RSEqualAtomicViewFunctor {
const view_type input;
atomic_view_type result;
const long length;
const long value;
const int64_t length;
const int64_t value;
// Wrap the result view in an atomic view, use this for operator.
RSEqualAtomicViewFunctor(const view_type& input_, result_view_type& result_,
const long& length_, const long& value_)
const int64_t& length_, const int64_t& value_)
: input(input_), result(result_), length(length_), value(value_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % 4 == 0) {
result(1, 0, 0, 0) >>= input(i);
@ -886,13 +888,13 @@ struct RSEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T RSEqualAtomicView(const long input_length, const long value,
const long remainder) {
T RSEqualAtomicView(const int64_t input_length, const int64_t value,
const int64_t remainder) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef Kokkos::View<T****, execution_space> result_view_type;
typedef typename result_view_type::HostMirror host_scalar_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
result_view_type result_view("result_view", 2, 2, 2, 2);
@ -918,8 +920,8 @@ T RSEqualAtomicView(const long input_length, const long value,
}
template <class T>
T RSEqualAtomicViewCheck(const long input_length, const long value,
const long remainder) {
T RSEqualAtomicViewCheck(const int64_t input_length, const int64_t value,
const int64_t remainder) {
T result[4];
result[0] = value;
result[1] = value;
@ -927,7 +929,7 @@ T RSEqualAtomicViewCheck(const long input_length, const long value,
result[3] = value;
T* input = new T[input_length];
for (long i = 0; i < input_length; ++i) {
for (int64_t i = 0; i < input_length; ++i) {
if (i % (remainder + 1) == remainder) {
input[i] = 1;
} else {
@ -935,7 +937,7 @@ T RSEqualAtomicViewCheck(const long input_length, const long value,
}
}
for (long i = 0; i < input_length; ++i) {
for (int64_t i = 0; i < input_length; ++i) {
if (i % 4 == 0) {
result[0] >>= input[i];
} else if (i % 4 == 1) {
@ -953,12 +955,12 @@ T RSEqualAtomicViewCheck(const long input_length, const long value,
}
template <class T, class DeviceType>
bool RSEqualAtomicViewTest(const long input_length) {
bool RSEqualAtomicViewTest(const int64_t input_length) {
static_assert(std::is_integral<T>::value,
"RSEqualAtomicViewTest: Must be integral type for test");
const long remainder = 61042; // prime - 1
const long value = 1073741825; // 2^30+1
const int64_t remainder = 61042; // prime - 1
const int64_t value = 1073741825; // 2^30+1
T res = RSEqualAtomicView<T, DeviceType>(input_length, value, remainder);
T resSerial = RSEqualAtomicViewCheck<T>(input_length, value, remainder);
@ -989,16 +991,16 @@ struct LSEqualAtomicViewFunctor {
view_type input;
atomic_view_type result;
const long length;
const long value;
const int64_t length;
const int64_t value;
// Wrap the result view in an atomic view, use this for operator.
LSEqualAtomicViewFunctor(const view_type& input_, result_view_type& result_,
const long& length_, const long& value_)
const int64_t& length_, const int64_t& value_)
: input(input_), result(result_), length(length_), value(value_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % 4 == 0) {
result(1, 0, 0, 0) <<= input(i);
@ -1014,13 +1016,13 @@ struct LSEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T LSEqualAtomicView(const long input_length, const long value,
const long remainder) {
T LSEqualAtomicView(const int64_t input_length, const int64_t value,
const int64_t remainder) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef Kokkos::View<T****, execution_space> result_view_type;
typedef typename result_view_type::HostMirror host_scalar_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
result_view_type result_view("result_view", 2, 2, 2, 2);
@ -1046,8 +1048,8 @@ T LSEqualAtomicView(const long input_length, const long value,
}
template <class T>
T LSEqualAtomicViewCheck(const long input_length, const long value,
const long remainder) {
T LSEqualAtomicViewCheck(const int64_t input_length, const int64_t value,
const int64_t remainder) {
T result[4];
result[0] = value;
result[1] = value;
@ -1055,7 +1057,7 @@ T LSEqualAtomicViewCheck(const long input_length, const long value,
result[3] = value;
T* input = new T[input_length];
for (long i = 0; i < input_length; ++i) {
for (int64_t i = 0; i < input_length; ++i) {
if (i % (remainder + 1) == remainder) {
input[i] = 1;
} else {
@ -1063,7 +1065,7 @@ T LSEqualAtomicViewCheck(const long input_length, const long value,
}
}
for (long i = 0; i < input_length; ++i) {
for (int64_t i = 0; i < input_length; ++i) {
if (i % 4 == 0) {
result[0] <<= input[i];
} else if (i % 4 == 1) {
@ -1081,12 +1083,12 @@ T LSEqualAtomicViewCheck(const long input_length, const long value,
}
template <class T, class DeviceType>
bool LSEqualAtomicViewTest(const long input_length) {
bool LSEqualAtomicViewTest(const int64_t input_length) {
static_assert(std::is_integral<T>::value,
"LSEqualAtomicViewTest: Must be integral type for test");
const long remainder = 61042; // prime - 1
const long value = 1; // 2^30+1
const int64_t remainder = 61042; // prime - 1
const int64_t value = 1; // 2^30+1
T res = LSEqualAtomicView<T, DeviceType>(input_length, value, remainder);
T resSerial = LSEqualAtomicViewCheck<T>(input_length, value, remainder);
@ -1116,15 +1118,15 @@ struct AndEqualAtomicViewFunctor {
view_type input;
atomic_view_type even_odd_result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator.
AndEqualAtomicViewFunctor(const view_type& input_,
view_type& even_odd_result_, const long length_)
view_type& even_odd_result_, const int64_t length_)
: input(input_), even_odd_result(even_odd_result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % 2 == 0) {
even_odd_result(0) &= input(i);
@ -1136,11 +1138,11 @@ struct AndEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T AndEqualAtomicView(const long input_length) {
T AndEqualAtomicView(const int64_t input_length) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef typename view_type::HostMirror host_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
view_type result_view("result_view", 2);
@ -1162,10 +1164,10 @@ T AndEqualAtomicView(const long input_length) {
}
template <class T>
T AndEqualAtomicViewCheck(const long input_length) {
const long N = input_length;
T result[2] = {1};
for (long i = 0; i < N; ++i) {
T AndEqualAtomicViewCheck(const int64_t input_length) {
const int64_t N = input_length;
T result[2] = {1};
for (int64_t i = 0; i < N; ++i) {
if (N % 2 == 0) {
result[0] &= (T)i;
} else {
@ -1177,7 +1179,7 @@ T AndEqualAtomicViewCheck(const long input_length) {
}
template <class T, class DeviceType>
bool AndEqualAtomicViewTest(long input_length) {
bool AndEqualAtomicViewTest(int64_t input_length) {
static_assert(std::is_integral<T>::value,
"AndEqualAtomicViewTest: Must be integral type for test");
@ -1210,15 +1212,15 @@ struct OrEqualAtomicViewFunctor {
view_type input;
atomic_view_type even_odd_result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator.
OrEqualAtomicViewFunctor(const view_type& input_, view_type& even_odd_result_,
const long length_)
const int64_t length_)
: input(input_), even_odd_result(even_odd_result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % 2 == 0) {
even_odd_result(0) |= input(i);
@ -1230,11 +1232,11 @@ struct OrEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T OrEqualAtomicView(const long input_length) {
T OrEqualAtomicView(const int64_t input_length) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef typename view_type::HostMirror host_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
view_type result_view("result_view", 2);
@ -1255,10 +1257,10 @@ T OrEqualAtomicView(const long input_length) {
}
template <class T>
T OrEqualAtomicViewCheck(const long input_length) {
const long N = input_length;
T result[2] = {0};
for (long i = 0; i < N; ++i) {
T OrEqualAtomicViewCheck(const int64_t input_length) {
const int64_t N = input_length;
T result[2] = {0};
for (int64_t i = 0; i < N; ++i) {
if (i % 2 == 0) {
result[0] |= (T)i;
} else {
@ -1270,7 +1272,7 @@ T OrEqualAtomicViewCheck(const long input_length) {
}
template <class T, class DeviceType>
bool OrEqualAtomicViewTest(long input_length) {
bool OrEqualAtomicViewTest(int64_t input_length) {
static_assert(std::is_integral<T>::value,
"OrEqualAtomicViewTest: Must be integral type for test");
@ -1303,15 +1305,15 @@ struct XOrEqualAtomicViewFunctor {
view_type input;
atomic_view_type even_odd_result;
const long length;
const int64_t length;
// Wrap the result view in an atomic view, use this for operator.
XOrEqualAtomicViewFunctor(const view_type& input_,
view_type& even_odd_result_, const long length_)
view_type& even_odd_result_, const int64_t length_)
: input(input_), even_odd_result(even_odd_result_), length(length_) {}
KOKKOS_INLINE_FUNCTION
void operator()(const long i) const {
void operator()(const int64_t i) const {
if (i < length) {
if (i % 2 == 0) {
even_odd_result(0) ^= input(i);
@ -1323,11 +1325,11 @@ struct XOrEqualAtomicViewFunctor {
};
template <class T, class execution_space>
T XOrEqualAtomicView(const long input_length) {
T XOrEqualAtomicView(const int64_t input_length) {
typedef Kokkos::View<T*, execution_space> view_type;
typedef typename view_type::HostMirror host_view_type;
const long length = input_length;
const int64_t length = input_length;
view_type input("input_view", length);
view_type result_view("result_view", 2);
@ -1348,10 +1350,10 @@ T XOrEqualAtomicView(const long input_length) {
}
template <class T>
T XOrEqualAtomicViewCheck(const long input_length) {
const long N = input_length;
T result[2] = {0};
for (long i = 0; i < N; ++i) {
T XOrEqualAtomicViewCheck(const int64_t input_length) {
const int64_t N = input_length;
T result[2] = {0};
for (int64_t i = 0; i < N; ++i) {
if (i % 2 == 0) {
result[0] ^= (T)i;
} else {
@ -1363,7 +1365,7 @@ T XOrEqualAtomicViewCheck(const long input_length) {
}
template <class T, class DeviceType>
bool XOrEqualAtomicViewTest(long input_length) {
bool XOrEqualAtomicViewTest(int64_t input_length) {
static_assert(std::is_integral<T>::value,
"XOrEqualAtomicViewTest: Must be integral type for test");
@ -1426,38 +1428,38 @@ bool AtomicViewsTestNonIntegralType(const int length, int test) {
namespace Test {
TEST(TEST_CATEGORY, atomic_views_integral) {
const long length = 1000000;
const int64_t length = 1000000;
{
// Integral Types.
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 1)));
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 2)));
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 3)));
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 4)));
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 5)));
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 6)));
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 7)));
ASSERT_TRUE(
(TestAtomicViews::AtomicViewsTestIntegralType<long, TEST_EXECSPACE>(
(TestAtomicViews::AtomicViewsTestIntegralType<int64_t, TEST_EXECSPACE>(
length, 8)));
}
}
TEST(TEST_CATEGORY, atomic_views_nonintegral) {
const long length = 1000000;
const int64_t length = 1000000;
{
// Non-Integral Types.
ASSERT_TRUE((

View File

@ -0,0 +1,138 @@
#include <gtest/gtest.h>
namespace Kokkos {
namespace Impl {
int get_ctest_gpu(const char *local_rank_str);
} // namespace Impl
} // namespace Kokkos
#ifdef _WIN32
int setenv(const char *name, const char *value, int overwrite) {
int errcode = 0;
if (!overwrite) {
size_t envsize = 0;
errcode = getenv_s(&envsize, NULL, 0, name);
if (errcode || envsize) return errcode;
}
return _putenv_s(name, value);
}
int unsetenv(const char *name) { return _putenv_s(name, ""); }
#endif
// Needed because https://github.com/google/googletest/issues/952 has not been
// resolved
#define EXPECT_THROW_WITH_MESSAGE(stmt, etype, whatstring) \
EXPECT_THROW( \
try { stmt; } catch (const etype &ex) { \
EXPECT_EQ(whatstring, std::string(ex.what())); \
throw; \
}, \
etype)
class ctest_environment : public ::testing::Test {
protected:
void SetUp();
};
void ctest_environment::SetUp() {
setenv("CTEST_KOKKOS_DEVICE_TYPE", "gpus", 1);
setenv("CTEST_RESOURCE_GROUP_COUNT", "10", 1);
unsetenv("CTEST_RESOURCE_GROUP_0");
setenv("CTEST_RESOURCE_GROUP_1", "threads", 1);
setenv("CTEST_RESOURCE_GROUP_2", "threads,cores", 1);
setenv("CTEST_RESOURCE_GROUP_3", "gpus", 1);
unsetenv("CTEST_RESOURCE_GROUP_3_GPUS");
setenv("CTEST_RESOURCE_GROUP_4", "gpus", 1);
setenv("CTEST_RESOURCE_GROUP_4_GPUS", "id:2", 1);
setenv("CTEST_RESOURCE_GROUP_5", "gpus", 1);
setenv("CTEST_RESOURCE_GROUP_5_GPUS", "slots:1,id:2", 1);
setenv("CTEST_RESOURCE_GROUP_6", "gpus", 1);
setenv("CTEST_RESOURCE_GROUP_6_GPUS", "id:2,slots:1", 1);
setenv("CTEST_RESOURCE_GROUP_7", "threads,gpus", 1);
setenv("CTEST_RESOURCE_GROUP_7_GPUS", "id:3,slots:1", 1);
setenv("CTEST_RESOURCE_GROUP_8", "gpus,threads", 1);
setenv("CTEST_RESOURCE_GROUP_8_GPUS", "id:1,slots:1", 1);
setenv("CTEST_RESOURCE_GROUP_9", "cores,gpus,threads", 1);
setenv("CTEST_RESOURCE_GROUP_9_GPUS", "id:4,slots:1", 1);
}
TEST_F(ctest_environment, no_device_type) {
unsetenv("CTEST_KOKKOS_DEVICE_TYPE");
EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("0"), 0);
}
TEST_F(ctest_environment, no_process_count) {
unsetenv("CTEST_RESOURCE_GROUP_COUNT");
EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("0"), 0);
}
TEST_F(ctest_environment, invalid_rank) {
EXPECT_THROW_WITH_MESSAGE(
Kokkos::Impl::get_ctest_gpu("10"), std::runtime_error,
"Error: local rank 10 is outside the bounds of resource groups provided "
"by"
" CTest. Raised by Kokkos::Impl::get_ctest_gpu().\nTraceback "
"functionality"
" not available\n");
}
TEST_F(ctest_environment, no_type_str) {
EXPECT_THROW_WITH_MESSAGE(
Kokkos::Impl::get_ctest_gpu("0"), std::runtime_error,
"Error: CTEST_RESOURCE_GROUP_0 is not specified. Raised by "
"Kokkos::Impl::get_ctest_gpu().\nTraceback functionality not "
"available\n");
}
TEST_F(ctest_environment, missing_type) {
EXPECT_THROW_WITH_MESSAGE(
Kokkos::Impl::get_ctest_gpu("1"), std::runtime_error,
"Error: device type 'gpus' not included in CTEST_RESOURCE_GROUP_1. "
"Raised "
"by Kokkos::Impl::get_ctest_gpu().\nTraceback functionality not available"
"\n");
EXPECT_THROW_WITH_MESSAGE(
Kokkos::Impl::get_ctest_gpu("2"), std::runtime_error,
"Error: device type 'gpus' not included in CTEST_RESOURCE_GROUP_2. "
"Raised "
"by Kokkos::Impl::get_ctest_gpu().\nTraceback functionality not available"
"\n");
}
TEST_F(ctest_environment, no_id_str) {
EXPECT_THROW_WITH_MESSAGE(
Kokkos::Impl::get_ctest_gpu("3"), std::runtime_error,
"Error: CTEST_RESOURCE_GROUP_3_GPUS is not specified. Raised by "
"Kokkos::Impl::get_ctest_gpu().\nTraceback functionality not "
"available\n");
}
TEST_F(ctest_environment, invalid_id_str) {
EXPECT_THROW_WITH_MESSAGE(
Kokkos::Impl::get_ctest_gpu("4"), std::runtime_error,
"Error: invalid value of CTEST_RESOURCE_GROUP_4_GPUS: 'id:2'. Raised by "
"Kokkos::Impl::get_ctest_gpu().\nTraceback functionality not "
"available\n");
EXPECT_THROW_WITH_MESSAGE(
Kokkos::Impl::get_ctest_gpu("5"), std::runtime_error,
"Error: invalid value of CTEST_RESOURCE_GROUP_5_GPUS: 'slots:1,id:2'. "
"Raised by Kokkos::Impl::get_ctest_gpu().\nTraceback functionality not "
"available\n");
}
TEST_F(ctest_environment, good) {
EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("6"), 2);
EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("7"), 3);
EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("8"), 1);
EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("9"), 4);
}

View File

@ -361,6 +361,7 @@ bool Test(int test) {
return passed;
#else
(void)test;
return true;
#endif
}

View File

@ -44,10 +44,7 @@
#include <Kokkos_Core.hpp>
#if defined(KOKKOS_ENABLE_CUDA) && \
(!defined(KOKKOS_ENABLE_CUDA_LAMBDA) || \
((defined(KOKKOS_ENABLE_SERIAL) || defined(KOKKOS_ENABLE_OPENMP)) && \
((CUDA_VERSION < 8000) && defined(__NVCC__))))
#if defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_CUDA_LAMBDA)
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#error "Macro bug: KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA shouldn't be defined"
#endif

View File

@ -84,8 +84,9 @@ struct TestComplexConstruction {
ASSERT_FLOAT_EQ(h_results(8).real(), double(8));
ASSERT_FLOAT_EQ(h_results(8).imag(), 0.0);
#ifndef KOKKOS_ENABLE_ROCM // Copy construction conversion between
// Kokkos::complex and std::complex doesn't compile
// Copy construction conversion between
// Kokkos::complex and std::complex doesn't compile
#ifndef KOKKOS_ENABLE_HIP // FIXME_HIP
Kokkos::complex<double> a(1.5, 2.5), b(3.25, 5.25), r_kk;
std::complex<double> sa(a), sb(3.25, 5.25), r;
r = a;
@ -104,7 +105,7 @@ struct TestComplexConstruction {
}
KOKKOS_INLINE_FUNCTION
void operator()(const int &i) const {
void operator()(const int & /*i*/) const {
Kokkos::complex<double> a(1.5, 2.5);
d_results(0) = a;
Kokkos::complex<double> b(a);
@ -164,8 +165,10 @@ struct TestComplexBasicMath {
ASSERT_FLOAT_EQ(h_results(2).real(), r.real());
ASSERT_FLOAT_EQ(h_results(2).imag(), r.imag());
r = a / b;
#ifndef KOKKOS_WORKAROUND_OPENMPTARGET_CLANG
ASSERT_FLOAT_EQ(h_results(3).real(), r.real());
ASSERT_FLOAT_EQ(h_results(3).imag(), r.imag());
#endif
r = d + a;
ASSERT_FLOAT_EQ(h_results(4).real(), r.real());
ASSERT_FLOAT_EQ(h_results(4).imag(), r.imag());
@ -212,8 +215,10 @@ struct TestComplexBasicMath {
ASSERT_FLOAT_EQ(h_results(18).real(), r.real());
ASSERT_FLOAT_EQ(h_results(18).imag(), r.imag());
r = c / a;
#ifndef KOKKOS_WORKAROUND_OPENMPTARGET_CLANG
ASSERT_FLOAT_EQ(h_results(19).real(), r.real());
ASSERT_FLOAT_EQ(h_results(19).imag(), r.imag());
#endif
r = a;
/* r = a+e; */ ASSERT_FLOAT_EQ(h_results(20).real(), r.real() + e);
@ -227,7 +232,7 @@ struct TestComplexBasicMath {
}
KOKKOS_INLINE_FUNCTION
void operator()(const int &i) const {
void operator()(const int & /*i*/) const {
Kokkos::complex<double> a(1.5, 2.5);
Kokkos::complex<double> b(3.25, 5.75);
// Basic math complex / complex
@ -320,7 +325,7 @@ struct TestComplexSpecialFunctions {
}
KOKKOS_INLINE_FUNCTION
void operator()(const int &i) const {
void operator()(const int & /*i*/) const {
Kokkos::complex<double> a(1.5, 2.5);
Kokkos::complex<double> b(3.25, 5.75);
double c = 9.3;
@ -356,4 +361,41 @@ TEST(TEST_CATEGORY, complex_special_funtions) {
TEST(TEST_CATEGORY, complex_io) { testComplexIO(); }
TEST(TEST_CATEGORY, complex_trivially_copyable) {
using RealType = double;
// Kokkos::complex<RealType> is trivially copyable when RealType is
// trivially copyable
// Simply disable the check for IBM's XL compiler since we can't reliably
// check for a version that defines relevant functions.
#if !defined(__ibmxl__)
// clang claims compatibility with gcc 4.2.1 but all versions tested know
// about std::is_trivially_copyable.
#if !defined(__clang__)
#define KOKKOS_COMPILER_GNU_VERSION \
__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__
#endif
#if KOKKOS_COMPILER_GNU_VERSION == 0 || KOKKOS_COMPILER_GNU_VERSION > 500
ASSERT_TRUE(std::is_trivially_copyable<Kokkos::complex<RealType>>::value ||
!std::is_trivially_copyable<RealType>::value);
#elif KOKKOS_COMPILER_GNU_VERSION > 480
ASSERT_TRUE(
(std::has_trivial_copy_constructor<Kokkos::complex<RealType>>::value &&
std::has_trivial_copy_assign<Kokkos::complex<RealType>>::value &&
std::is_trivially_destructible<Kokkos::complex<RealType>>::value) ||
!(std::has_trivial_copy_constructor<RealType>::value &&
std::has_trivial_copy_assign<RealType>::value &&
std::is_trivially_destructible<RealType>::value));
#else
ASSERT_TRUE(
(std::has_trivial_copy_constructor<Kokkos::complex<RealType>>::value &&
std::has_trivial_copy_assign<Kokkos::complex<RealType>>::value &&
std::has_trivial_destructor<Kokkos::complex<RealType>>::value) ||
!(std::has_trivial_copy_constructor<RealType>::value &&
std::has_trivial_copy_assign<RealType>::value &&
std::has_trivial_destructor<RealType>::value));
#endif
#endif
}
} // namespace Test

View File

@ -0,0 +1,81 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <Kokkos_Core.hpp>
namespace TestConcept {
using ExecutionSpace = TEST_EXECSPACE;
using MemorySpace = typename ExecutionSpace::memory_space;
using DeviceType = typename ExecutionSpace::device_type;
static_assert(Kokkos::is_execution_space<ExecutionSpace>{}, "");
static_assert(Kokkos::is_execution_space<ExecutionSpace const>{}, "");
static_assert(!Kokkos::is_execution_space<ExecutionSpace &>{}, "");
static_assert(!Kokkos::is_execution_space<ExecutionSpace const &>{}, "");
static_assert(Kokkos::is_memory_space<MemorySpace>{}, "");
static_assert(Kokkos::is_memory_space<MemorySpace const>{}, "");
static_assert(!Kokkos::is_memory_space<MemorySpace &>{}, "");
static_assert(!Kokkos::is_memory_space<MemorySpace const &>{}, "");
static_assert(Kokkos::is_device<DeviceType>{}, "");
static_assert(Kokkos::is_device<DeviceType const>{}, "");
static_assert(!Kokkos::is_device<DeviceType &>{}, "");
static_assert(!Kokkos::is_device<DeviceType const &>{}, "");
static_assert(!Kokkos::is_device<ExecutionSpace>{}, "");
static_assert(!Kokkos::is_device<MemorySpace>{}, "");
static_assert(Kokkos::is_space<ExecutionSpace>{}, "");
static_assert(Kokkos::is_space<MemorySpace>{}, "");
static_assert(Kokkos::is_space<DeviceType>{}, "");
static_assert(Kokkos::is_space<ExecutionSpace const>{}, "");
static_assert(Kokkos::is_space<MemorySpace const>{}, "");
static_assert(Kokkos::is_space<DeviceType const>{}, "");
static_assert(!Kokkos::is_space<ExecutionSpace &>{}, "");
static_assert(!Kokkos::is_space<MemorySpace &>{}, "");
static_assert(!Kokkos::is_space<DeviceType &>{}, "");
} // namespace TestConcept

View File

@ -53,7 +53,7 @@ namespace {
template <class ExecSpace>
struct CountFillFunctor {
KOKKOS_INLINE_FUNCTION
std::int32_t operator()(std::int32_t row, std::int32_t *fill) const {
std::int32_t operator()(std::int32_t row, float *fill) const {
auto n = (row % 4) + 1;
if (fill) {
for (std::int32_t j = 0; j < n; ++j) {
@ -153,7 +153,7 @@ struct RunUpdateCrsTest {
template <class ExecSpace>
void test_count_fill(std::int32_t nrows) {
Kokkos::Crs<std::int32_t, ExecSpace, void, std::int32_t> graph;
Kokkos::Crs<float, ExecSpace, void, std::int32_t> graph;
Kokkos::count_and_fill_crs(graph, nrows, CountFillFunctor<ExecSpace>());
ASSERT_EQ(graph.numRows(), nrows);
auto row_map = Kokkos::create_mirror_view(graph.row_map);
@ -176,12 +176,12 @@ void test_count_fill(std::int32_t nrows) {
template <class ExecSpace>
void test_constructor(std::int32_t nrows) {
for (int nTest = 1; nTest < 5; nTest++) {
typedef Kokkos::Crs<std::int32_t, ExecSpace, void, std::int32_t> crs_int32;
crs_int32 graph;
typedef Kokkos::Crs<float, ExecSpace, void, std::int32_t> crs_type;
crs_type graph;
Kokkos::count_and_fill_crs(graph, nrows, CountFillFunctor<ExecSpace>());
ASSERT_EQ(graph.numRows(), nrows);
RunUpdateCrsTest<crs_int32, ExecSpace, std::int32_t> crstest(graph);
RunUpdateCrsTest<crs_type, ExecSpace, std::int32_t> crstest(graph);
crstest.run_test(nTest);
auto row_map = Kokkos::create_mirror_view(graph.row_map);

View File

@ -2,6 +2,7 @@
namespace Test {
#ifdef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
namespace Impl {
template <class MemorySpaceA, class MemorySpaceB>
struct TestDeepCopy {
@ -210,5 +211,149 @@ TEST(TEST_CATEGORY, deep_copy_alignment) {
Kokkos::HostSpace>::run_test(100000);
}
}
#endif
// KOKKOS_IMPL_HIP_CLANG_WORKAROUND
#ifndef KOKKOS_ENABLE_HIP
namespace Impl {
template <class Scalar1, class Scalar2, class Layout1, class Layout2>
struct TestDeepCopyScalarConversion {
struct TagFill {};
struct TagCompare {};
using view_type_s1_1d = Kokkos::View<Scalar1*, Layout1, TEST_EXECSPACE>;
using view_type_s2_1d = Kokkos::View<Scalar2*, Layout2, TEST_EXECSPACE>;
using view_type_s1_2d = Kokkos::View<Scalar1**, Layout1, TEST_EXECSPACE>;
using view_type_s2_2d = Kokkos::View<Scalar2**, Layout2, TEST_EXECSPACE>;
using base_layout1 = typename std::conditional<
std::is_same<Layout1, Kokkos::LayoutStride>::value, Kokkos::LayoutLeft,
Layout1>::type;
using base_layout2 = typename std::conditional<
std::is_same<Layout2, Kokkos::LayoutStride>::value, Kokkos::LayoutLeft,
Layout2>::type;
using base_type_s1_1d = Kokkos::View<Scalar1*, base_layout1, TEST_EXECSPACE>;
using base_type_s2_1d = Kokkos::View<Scalar2*, base_layout2, TEST_EXECSPACE>;
using base_type_s1_2d = Kokkos::View<Scalar1**, base_layout1, TEST_EXECSPACE>;
using base_type_s2_2d = Kokkos::View<Scalar2**, base_layout2, TEST_EXECSPACE>;
view_type_s1_1d view_s1_1d;
view_type_s2_1d view_s2_1d;
view_type_s1_2d view_s1_2d;
view_type_s2_2d view_s2_2d;
Kokkos::View<int64_t, TEST_EXECSPACE> error_count;
void create_views(int64_t N0, int64_t N1) {
base_type_s1_1d b_s1_1d("TestDeepCopyConversion::b_s1_1d", N0);
base_type_s2_1d b_s2_1d("TestDeepCopyConversion::b_s2_1d", N0);
base_type_s1_2d b_s1_2d("TestDeepCopyConversion::b_s1_2d", N0, N1);
base_type_s2_2d b_s2_2d("TestDeepCopyConversion::b_s2_2d", N0, N1);
view_s1_1d = view_type_s1_1d(b_s1_1d, Kokkos::ALL);
view_s2_1d = view_type_s2_1d(b_s2_1d, Kokkos::ALL);
view_s1_2d = view_type_s1_2d(b_s1_2d, Kokkos::ALL, Kokkos::ALL);
view_s2_2d = view_type_s2_2d(b_s2_2d, Kokkos::ALL, Kokkos::ALL);
error_count = Kokkos::View<int64_t, TEST_EXECSPACE>(
"TestDeepCopyConversion::error_count");
}
KOKKOS_FUNCTION
void operator()(TagFill, const int64_t i) const {
view_s2_1d(i) = static_cast<Scalar2>(i + 1);
for (int64_t j = 0; j < static_cast<int64_t>(view_s2_2d.extent(1)); j++)
view_s2_2d(i, j) = static_cast<Scalar2>((i + 1) * 1000 + j + 1);
}
KOKKOS_FUNCTION
void operator()(TagCompare, const int64_t i) const {
int64_t errors = 0;
if (view_s1_1d(i) != static_cast<Scalar1>(static_cast<Scalar2>(i + 1)))
errors++;
for (int64_t j = 0; j < static_cast<int64_t>(view_s1_2d.extent(1)); j++) {
if (view_s1_2d(i, j) !=
static_cast<Scalar1>(static_cast<Scalar2>((i + 1) * 1000 + j + 1)))
errors++;
}
if (errors > 0) Kokkos::atomic_add(&error_count(), errors);
}
void run_tests(int64_t N0, int64_t N1) {
create_views(N0, N1);
Kokkos::parallel_for("TestDeepCopyConversion::Fill",
Kokkos::RangePolicy<TEST_EXECSPACE, TagFill,
Kokkos::IndexType<int64_t>>(0, N0),
*this);
Kokkos::deep_copy(view_s1_1d, view_s2_1d);
Kokkos::deep_copy(view_s1_2d, view_s2_2d);
Kokkos::parallel_for("TestDeepCopyConversion::Compare",
Kokkos::RangePolicy<TEST_EXECSPACE, TagCompare,
Kokkos::IndexType<int64_t>>(0, N0),
*this);
int64_t errors = 0;
Kokkos::deep_copy(errors, error_count);
ASSERT_TRUE(errors == 0);
Kokkos::deep_copy(view_s1_1d, static_cast<Scalar1>(0));
Kokkos::deep_copy(view_s1_2d, static_cast<Scalar1>(0));
Kokkos::parallel_for("TestDeepCopyConversion::Compare",
Kokkos::RangePolicy<TEST_EXECSPACE, TagCompare,
Kokkos::IndexType<int64_t>>(0, N0),
*this);
Kokkos::deep_copy(errors, error_count);
ASSERT_TRUE(errors > 0);
Kokkos::deep_copy(error_count, 0);
Kokkos::deep_copy(TEST_EXECSPACE(), view_s1_1d, view_s2_1d);
Kokkos::deep_copy(TEST_EXECSPACE(), view_s1_2d, view_s2_2d);
Kokkos::parallel_for("TestDeepCopyConversion::Compare",
Kokkos::RangePolicy<TEST_EXECSPACE, TagCompare,
Kokkos::IndexType<int64_t>>(0, N0),
*this);
Kokkos::deep_copy(errors, error_count);
ASSERT_TRUE(errors == 0);
}
};
} // namespace Impl
TEST(TEST_CATEGORY, deep_copy_conversion) {
int64_t N0 = 19381;
int64_t N1 = 17;
using right = Kokkos::LayoutRight;
using left = Kokkos::LayoutLeft;
using stride = Kokkos::LayoutStride;
Impl::TestDeepCopyScalarConversion<double, double, right, right>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, double, right, left>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, double, left, right>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, double, stride, right>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, double, right, stride>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, float, right, right>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, float, right, left>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, float, left, right>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, float, stride, right>().run_tests(
N0, N1);
Impl::TestDeepCopyScalarConversion<double, float, right, stride>().run_tests(
N0, N1);
}
#endif
} // namespace Test

View File

@ -934,7 +934,6 @@ void impl_test_local_deepcopy_rangepolicy_rank_7(const int N) {
//-------------------------------------------------------------------------------------------------------------
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
TEST(TEST_CATEGORY, local_deepcopy_teampolicy_layoutleft) {
typedef TEST_EXECSPACE ExecSpace;
typedef Kokkos::View<double********, Kokkos::LayoutLeft, ExecSpace> ViewType;
@ -1043,5 +1042,73 @@ TEST(TEST_CATEGORY, local_deepcopy_rangepolicy_layoutright) {
}
}
#endif
#endif
namespace Impl {
template <typename T, typename SHMEMTYPE>
using ShMemView =
Kokkos::View<T, Kokkos::LayoutRight, SHMEMTYPE, Kokkos::MemoryUnmanaged>;
struct DeepCopyScratchFunctor {
DeepCopyScratchFunctor(
Kokkos::View<double*, TEST_EXECSPACE::memory_space> check_view_1,
Kokkos::View<double*, TEST_EXECSPACE::memory_space> check_view_2)
: check_view_1_(check_view_1),
check_view_2_(check_view_2),
N_(check_view_1.extent(0)) {}
KOKKOS_INLINE_FUNCTION void operator()(
Kokkos::TeamPolicy<TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Dynamic>>::member_type team)
const {
using ShmemType = TEST_EXECSPACE::scratch_memory_space;
auto shview =
Impl::ShMemView<double**, ShmemType>(team.team_scratch(1), N_, 1);
Kokkos::parallel_for(
Kokkos::TeamThreadRange(team, N_), KOKKOS_LAMBDA(const size_t& index) {
auto thread_shview = Kokkos::subview(shview, index, Kokkos::ALL());
Kokkos::Experimental::local_deep_copy(thread_shview, index);
});
Kokkos::Experimental::local_deep_copy(
team, check_view_1_, Kokkos::subview(shview, Kokkos::ALL(), 0));
Kokkos::Experimental::local_deep_copy(team, shview, 6.);
Kokkos::Experimental::local_deep_copy(
team, check_view_2_, Kokkos::subview(shview, Kokkos::ALL(), 0));
}
Kokkos::View<double*, TEST_EXECSPACE::memory_space> check_view_1_;
Kokkos::View<double*, TEST_EXECSPACE::memory_space> check_view_2_;
int const N_;
};
} // namespace Impl
TEST(TEST_CATEGORY, deep_copy_scratch) {
using TestDeviceTeamPolicy = Kokkos::TeamPolicy<TEST_EXECSPACE>;
const int N = 8;
const int bytes_per_team =
Impl::ShMemView<double**,
TEST_EXECSPACE::scratch_memory_space>::shmem_size(N, 1);
TestDeviceTeamPolicy policy(1, Kokkos::AUTO);
auto team_exec = policy.set_scratch_size(1, Kokkos::PerTeam(bytes_per_team));
Kokkos::View<double*, TEST_EXECSPACE::memory_space> check_view_1("check_1",
N);
Kokkos::View<double*, TEST_EXECSPACE::memory_space> check_view_2("check_2",
N);
Kokkos::parallel_for(
team_exec, Impl::DeepCopyScratchFunctor{check_view_1, check_view_2});
auto host_copy_1 =
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), check_view_1);
auto host_copy_2 =
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), check_view_2);
for (unsigned int i = 0; i < N; ++i) {
ASSERT_EQ(host_copy_1(i), i);
ASSERT_EQ(host_copy_2(i), 6.0);
}
}
} // namespace Test

View File

@ -256,7 +256,6 @@ struct TestMDRange_2D {
static void test_reduce2(const int N0, const int N1) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<2>,
Kokkos::IndexType<int> >
@ -269,13 +268,12 @@ struct TestMDRange_2D {
double sum = 0.0;
parallel_reduce(
range,
KOKKOS_LAMBDA(const int i, const int j, double &lsum) {
KOKKOS_LAMBDA(const int /*i*/, const int /*j*/, double &lsum) {
lsum += 1.0;
},
sum);
ASSERT_EQ(sum, N0 * N1);
}
#endif
#endif
{
@ -361,7 +359,6 @@ struct TestMDRange_2D {
}
// Test Min reducer with lambda
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<2>,
Kokkos::IndexType<int> >
@ -387,7 +384,6 @@ struct TestMDRange_2D {
ASSERT_EQ(min, 4.0);
}
#endif
#endif
// Tagged operator test
{
@ -532,7 +528,6 @@ struct TestMDRange_2D {
static void test_for2(const int N0, const int N1) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<2>,
Kokkos::IndexType<int> >
@ -571,7 +566,6 @@ struct TestMDRange_2D {
ASSERT_EQ(counter, 0);
}
#endif
#endif
{
@ -909,7 +903,6 @@ struct TestMDRange_3D {
static void test_reduce3(const int N0, const int N1, const int N2) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<3>,
Kokkos::IndexType<int> >
@ -922,13 +915,11 @@ struct TestMDRange_3D {
double sum = 0.0;
parallel_reduce(
range,
KOKKOS_LAMBDA(const int i, const int j, const int k, double &lsum) {
lsum += 1.0;
},
KOKKOS_LAMBDA(const int /*i*/, const int /*j*/, const int /*k*/,
double &lsum) { lsum += 1.0; },
sum);
ASSERT_EQ(sum, N0 * N1 * N2);
}
#endif
#endif
{
@ -1013,7 +1004,6 @@ struct TestMDRange_3D {
}
// Test Min reducer with lambda
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<3>,
Kokkos::IndexType<int> >
@ -1046,7 +1036,6 @@ struct TestMDRange_3D {
ASSERT_EQ(min, min_identity);
}
}
#endif
#endif
// Tagged operator test
@ -1193,7 +1182,6 @@ struct TestMDRange_3D {
static void test_for3(const int N0, const int N1, const int N2) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<3>,
Kokkos::IndexType<int> >
@ -1236,7 +1224,6 @@ struct TestMDRange_3D {
ASSERT_EQ(counter, 0);
}
#endif
#endif
{
@ -1549,7 +1536,6 @@ struct TestMDRange_4D {
static void test_reduce4(const int N0, const int N1, const int N2,
const int N3) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>,
Kokkos::IndexType<int> >
@ -1562,12 +1548,11 @@ struct TestMDRange_4D {
double sum = 0.0;
parallel_reduce(
range,
KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
double &lsum) { lsum += 1.0; },
KOKKOS_LAMBDA(const int /*i*/, const int /*j*/, const int /*k*/,
const int /*l*/, double &lsum) { lsum += 1.0; },
sum);
ASSERT_EQ(sum, N0 * N1 * N2 * N3);
}
#endif
#endif
{
@ -1656,7 +1641,6 @@ struct TestMDRange_4D {
// Test Min reducer with lambda
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>,
Kokkos::IndexType<int> >
@ -1684,7 +1668,6 @@ struct TestMDRange_4D {
ASSERT_EQ(min, 16.0);
}
#endif
#endif
// Tagged operator test
@ -1834,7 +1817,6 @@ struct TestMDRange_4D {
static void test_for4(const int N0, const int N1, const int N2,
const int N3) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>,
Kokkos::IndexType<int> >
@ -1878,7 +1860,6 @@ struct TestMDRange_4D {
ASSERT_EQ(counter, 0);
}
#endif
#endif
{
@ -2206,7 +2187,6 @@ struct TestMDRange_5D {
static void test_reduce5(const int N0, const int N1, const int N2,
const int N3, const int N4) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>,
Kokkos::IndexType<int> >
@ -2220,12 +2200,12 @@ struct TestMDRange_5D {
double sum = 0.0;
parallel_reduce(
range,
KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
const int m, double &lsum) { lsum += 1.0; },
KOKKOS_LAMBDA(const int /*i*/, const int /*j*/, const int /*k*/,
const int /*l*/, const int /*m*/,
double &lsum) { lsum += 1.0; },
sum);
ASSERT_EQ(sum, N0 * N1 * N2 * N3 * N4);
}
#endif
#endif
{
@ -2320,7 +2300,6 @@ struct TestMDRange_5D {
// Test Min reducer with lambda
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>,
Kokkos::IndexType<int> >
@ -2352,7 +2331,6 @@ struct TestMDRange_5D {
ASSERT_EQ(min, 32.0);
}
#endif
#endif
// Tagged operator test
@ -2404,7 +2382,6 @@ struct TestMDRange_5D {
static void test_for5(const int N0, const int N1, const int N2, const int N3,
const int N4) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>,
Kokkos::IndexType<int> >
@ -2452,7 +2429,6 @@ struct TestMDRange_5D {
ASSERT_EQ(counter, 0);
}
#endif
#endif
{
@ -2798,7 +2774,6 @@ struct TestMDRange_6D {
static void test_reduce6(const int N0, const int N1, const int N2,
const int N3, const int N4, const int N5) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>,
Kokkos::IndexType<int> >
@ -2812,13 +2787,12 @@ struct TestMDRange_6D {
double sum = 0.0;
parallel_reduce(
range,
KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
const int m, const int n,
KOKKOS_LAMBDA(const int /*i*/, const int /*j*/, const int /*k*/,
const int /*l*/, const int /*m*/, const int /*n*/,
double &lsum) { lsum += 1.0; },
sum);
ASSERT_EQ(sum, N0 * N1 * N2 * N3 * N4 * N5);
}
#endif
#endif
{
@ -2914,7 +2888,6 @@ struct TestMDRange_6D {
// Test Min reducer with lambda
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>,
Kokkos::IndexType<int> >
@ -2948,7 +2921,6 @@ struct TestMDRange_6D {
ASSERT_EQ(min, 64.0);
}
#endif
#endif
// Tagged operator test
@ -3001,7 +2973,6 @@ struct TestMDRange_6D {
static void test_for6(const int N0, const int N1, const int N2, const int N3,
const int N4, const int N5) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
{
typedef typename Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>,
Kokkos::IndexType<int> >
@ -3051,7 +3022,6 @@ struct TestMDRange_6D {
ASSERT_EQ(counter, 0);
}
#endif
#endif
{

View File

@ -162,10 +162,10 @@ void test_host_memory_pool_stats() {
// Aborts because exceeds max block size:
// void * p2048 = pool.allocate(2048);
ASSERT_NE(p0064, (void*)0);
ASSERT_NE(p0128, (void*)0);
ASSERT_NE(p0256, (void*)0);
ASSERT_NE(p1024, (void*)0);
ASSERT_NE(p0064, nullptr);
ASSERT_NE(p0128, nullptr);
ASSERT_NE(p0256, nullptr);
ASSERT_NE(p1024, nullptr);
pool.deallocate(p0064, 64);
pool.deallocate(p0128, 128);
@ -475,17 +475,15 @@ void test_memory_pool_corners(const bool print_statistics,
template <class DeviceType, class Enable = void>
struct TestMemoryPoolHuge {
TestMemoryPoolHuge() {}
enum : size_t { num_superblock = 0 };
using value_type = long;
KOKKOS_INLINE_FUNCTION
void operator()(int i, long& err) const noexcept {}
void operator()(int /*i*/, long& /*err*/) const noexcept {}
KOKKOS_INLINE_FUNCTION
void operator()(int i) const noexcept {}
void operator()(int /*i*/) const noexcept {}
};
template <class DeviceType>

View File

@ -54,9 +54,10 @@ template <class ExecSpace, class ScheduleType>
struct TestRange {
typedef int value_type; ///< typedef required for the parallel_reduce
typedef Kokkos::View<int *, ExecSpace> view_type;
typedef Kokkos::View<value_type *, ExecSpace> view_type;
view_type m_flags;
view_type result_view;
struct VerifyInitTag {};
struct ResetTag {};
@ -65,9 +66,19 @@ struct TestRange {
struct VerifyOffsetTag {};
int N;
#ifndef KOKKOS_WORKAROUND_OPENMPTARGET_GCC
static const int offset = 13;
#else
int offset;
#endif
TestRange(const size_t N_)
: m_flags(Kokkos::ViewAllocateWithoutInitializing("flags"), N_), N(N_) {}
: m_flags(Kokkos::ViewAllocateWithoutInitializing("flags"), N_),
result_view(Kokkos::ViewAllocateWithoutInitializing("results"), N_),
N(N_) {
#ifdef KOKKOS_WORKAROUND_OPENMPTARGET_GCC
offset = 13;
#endif
}
void test_for() {
typename view_type::HostMirror host_flags =
@ -185,7 +196,7 @@ struct TestRange {
//----------------------------------------
void test_reduce() {
int total = 0;
value_type total = 0;
Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, ScheduleType>(0, N),
*this);
@ -220,15 +231,31 @@ struct TestRange {
Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, ScheduleType>(0, N),
*this);
auto check_scan_results = [&]() {
auto const host_mirror =
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), result_view);
for (int i = 0; i < N; ++i) {
if (((i + 1) * i) / 2 != host_mirror(i)) {
std::cout << "Error at " << i << std::endl;
EXPECT_EQ(size_t(((i + 1) * i) / 2), size_t(host_mirror(i)));
}
}
};
Kokkos::parallel_scan(
"TestKernelScan",
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(0, N), *this);
int total = 0;
check_scan_results();
value_type total = 0;
Kokkos::parallel_scan(
"TestKernelScanWithTotal",
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(0, N), *this,
total);
check_scan_results();
ASSERT_EQ(size_t((N - 1) * (N) / 2), size_t(total)); // sum( 0 .. N-1 )
}
@ -239,16 +266,16 @@ struct TestRange {
if (final) {
if (update != (i * (i + 1)) / 2) {
printf("TestRange::test_scan error %d : %d != %d\n", i,
(i * (i + 1)) / 2, m_flags(i));
printf("TestRange::test_scan error (%d,%d) : %d != %d\n", i, m_flags(i),
(i * (i + 1)) / 2, update);
}
result_view(i) = update;
}
}
void test_dynamic_policy() {
auto const N_no_implicit_capture = N;
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
auto const N_no_implicit_capture = N;
typedef Kokkos::RangePolicy<ExecSpace, Kokkos::Schedule<Kokkos::Dynamic> >
policy_t;
@ -273,7 +300,7 @@ struct TestRange {
int error = 0;
Kokkos::parallel_reduce(
Kokkos::RangePolicy<ExecSpace>(0, N),
KOKKOS_LAMBDA(const int &i, int &lsum) {
KOKKOS_LAMBDA(const int &i, value_type &lsum) {
lsum += (a(i) != (i < N_no_implicit_capture / 2 ? 1 : 10000));
},
error);
@ -300,10 +327,10 @@ struct TestRange {
count("Count", ExecSpace::concurrency());
Kokkos::View<int *, ExecSpace> a("A", N);
int sum = 0;
value_type sum = 0;
Kokkos::parallel_reduce(
policy_t(0, N),
KOKKOS_LAMBDA(const int &i, int &lsum) {
KOKKOS_LAMBDA(const int &i, value_type &lsum) {
for (int k = 0; k < (i < N_no_implicit_capture / 2 ? 1 : 10000);
k++) {
a(i)++;
@ -321,7 +348,7 @@ struct TestRange {
int error = 0;
Kokkos::parallel_reduce(
Kokkos::RangePolicy<ExecSpace>(0, N),
KOKKOS_LAMBDA(const int &i, int &lsum) {
KOKKOS_LAMBDA(const int &i, value_type &lsum) {
lsum += (a(i) != (i < N_no_implicit_capture / 2 ? 1 : 10000));
},
error);
@ -342,7 +369,6 @@ struct TestRange {
//}
}
}
#endif
#endif
}
};
@ -417,7 +443,7 @@ TEST(TEST_CATEGORY, range_scan) {
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(0);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_ROCM)
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(0);
f.test_dynamic_policy();
@ -432,7 +458,7 @@ TEST(TEST_CATEGORY, range_scan) {
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(3);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_ROCM)
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(3);
f.test_dynamic_policy();
@ -447,7 +473,7 @@ TEST(TEST_CATEGORY, range_scan) {
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(1001);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_ROCM)
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(1001);
f.test_dynamic_policy();

View File

@ -0,0 +1,518 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <cstdio>
#include <Kokkos_Core.hpp>
// This file is largely duplicating TestRange.hpp but it applies
// Kokkos::Experimental require at every place where a parallel
// operation is executed.
namespace Test {
namespace {
template <class ExecSpace, class ScheduleType, class Property>
struct TestRangeRequire {
typedef int value_type; ///< typedef required for the parallel_reduce
typedef Kokkos::View<int *, ExecSpace> view_type;
view_type m_flags;
struct VerifyInitTag {};
struct ResetTag {};
struct VerifyResetTag {};
struct OffsetTag {};
struct VerifyOffsetTag {};
int N;
static const int offset = 13;
TestRangeRequire(const size_t N_)
: m_flags(Kokkos::ViewAllocateWithoutInitializing("flags"), N_), N(N_) {}
void test_for() {
typename view_type::HostMirror host_flags =
Kokkos::create_mirror_view(m_flags);
Kokkos::parallel_for(
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType>(0, N), Property()),
*this);
#if defined(KOKKOS_ENABLE_PROFILING)
{
typedef TestRangeRequire<ExecSpace, ScheduleType, Property> ThisType;
std::string label("parallel_for");
Kokkos::Impl::ParallelConstructName<ThisType, void> pcn(label);
ASSERT_EQ(pcn.get(), label);
std::string empty_label("");
Kokkos::Impl::ParallelConstructName<ThisType, void> empty_pcn(
empty_label);
ASSERT_EQ(empty_pcn.get(), typeid(ThisType).name());
}
#endif
Kokkos::parallel_for(
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType, VerifyInitTag>(0, N),
Property()),
*this);
#if defined(KOKKOS_ENABLE_PROFILING)
{
typedef TestRangeRequire<ExecSpace, ScheduleType, Property> ThisType;
std::string label("parallel_for");
Kokkos::Impl::ParallelConstructName<ThisType, VerifyInitTag> pcn(label);
ASSERT_EQ(pcn.get(), label);
std::string empty_label("");
Kokkos::Impl::ParallelConstructName<ThisType, VerifyInitTag> empty_pcn(
empty_label);
ASSERT_EQ(empty_pcn.get(), std::string(typeid(ThisType).name()) + "/" +
typeid(VerifyInitTag).name());
}
#endif
Kokkos::deep_copy(host_flags, m_flags);
int error_count = 0;
for (int i = 0; i < N; ++i) {
if (int(i) != host_flags(i)) ++error_count;
}
ASSERT_EQ(error_count, int(0));
Kokkos::parallel_for(
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType, ResetTag>(0, N),
Property()),
*this);
Kokkos::parallel_for(
std::string("TestKernelFor"),
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType, VerifyResetTag>(0, N),
Property()),
*this);
Kokkos::deep_copy(host_flags, m_flags);
error_count = 0;
for (int i = 0; i < N; ++i) {
if (int(2 * i) != host_flags(i)) ++error_count;
}
ASSERT_EQ(error_count, int(0));
Kokkos::parallel_for(
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(offset,
N + offset),
Property()),
*this);
Kokkos::parallel_for(
std::string("TestKernelFor"),
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType,
Kokkos::IndexType<unsigned int>,
VerifyOffsetTag>(0, N),
Property()),
*this);
Kokkos::deep_copy(host_flags, m_flags);
error_count = 0;
for (int i = 0; i < N; ++i) {
if (i + offset != host_flags(i)) ++error_count;
}
ASSERT_EQ(error_count, int(0));
}
KOKKOS_INLINE_FUNCTION
void operator()(const int i) const { m_flags(i) = i; }
KOKKOS_INLINE_FUNCTION
void operator()(const VerifyInitTag &, const int i) const {
if (i != m_flags(i)) {
printf("TestRangeRequire::test_for error at %d != %d\n", i, m_flags(i));
}
}
KOKKOS_INLINE_FUNCTION
void operator()(const ResetTag &, const int i) const {
m_flags(i) = 2 * m_flags(i);
}
KOKKOS_INLINE_FUNCTION
void operator()(const VerifyResetTag &, const int i) const {
if (2 * i != m_flags(i)) {
printf("TestRangeRequire::test_for error at %d != %d\n", i, m_flags(i));
}
}
KOKKOS_INLINE_FUNCTION
void operator()(const OffsetTag &, const int i) const {
m_flags(i - offset) = i;
}
KOKKOS_INLINE_FUNCTION
void operator()(const VerifyOffsetTag &, const int i) const {
if (i + offset != m_flags(i)) {
printf("TestRangeRequire::test_for error at %d != %d\n", i + offset,
m_flags(i));
}
}
//----------------------------------------
void test_reduce() {
int total = 0;
Kokkos::parallel_for(
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType>(0, N), Property()),
*this);
Kokkos::parallel_reduce(
"TestKernelReduce",
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType>(0, N), Property()),
*this, total);
// sum( 0 .. N-1 )
ASSERT_EQ(size_t((N - 1) * (N) / 2), size_t(total));
Kokkos::parallel_reduce(
Kokkos::Experimental::require(
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(offset,
N + offset),
Property()),
*this, total);
// sum( 1 .. N )
ASSERT_EQ(size_t((N) * (N + 1) / 2), size_t(total));
}
KOKKOS_INLINE_FUNCTION
void operator()(const int i, value_type &update) const {
update += m_flags(i);
}
KOKKOS_INLINE_FUNCTION
void operator()(const OffsetTag &, const int i, value_type &update) const {
update += 1 + m_flags(i - offset);
}
//----------------------------------------
void test_scan() {
Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, ScheduleType>(0, N),
*this);
Kokkos::parallel_scan(
"TestKernelScan",
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(0, N), *this);
int total = 0;
Kokkos::parallel_scan(
"TestKernelScanWithTotal",
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(0, N), *this,
total);
ASSERT_EQ(size_t((N - 1) * (N) / 2), size_t(total)); // sum( 0 .. N-1 )
}
KOKKOS_INLINE_FUNCTION
void operator()(const OffsetTag &, const int i, value_type &update,
bool final) const {
update += m_flags(i);
if (final) {
if (update != (i * (i + 1)) / 2) {
printf("TestRangeRequire::test_scan error %d : %d != %d\n", i,
(i * (i + 1)) / 2, m_flags(i));
}
}
}
void test_dynamic_policy() {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
auto const N_no_implicit_capture = N;
typedef Kokkos::RangePolicy<ExecSpace, Kokkos::Schedule<Kokkos::Dynamic> >
policy_t;
{
Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> >
count("Count", ExecSpace::concurrency());
Kokkos::View<int *, ExecSpace> a("A", N);
Kokkos::parallel_for(
policy_t(0, N), KOKKOS_LAMBDA(const int &i) {
for (int k = 0; k < (i < N_no_implicit_capture / 2 ? 1 : 10000);
k++) {
a(i)++;
}
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
count(ExecSpace::hardware_thread_id())++;
#else
count( ExecSpace::impl_hardware_thread_id() )++;
#endif
});
int error = 0;
Kokkos::parallel_reduce(
Kokkos::RangePolicy<ExecSpace>(0, N),
KOKKOS_LAMBDA(const int &i, int &lsum) {
lsum += (a(i) != (i < N_no_implicit_capture / 2 ? 1 : 10000));
},
error);
ASSERT_EQ(error, 0);
if ((ExecSpace::concurrency() > (int)1) &&
(N > static_cast<int>(4 * ExecSpace::concurrency()))) {
size_t min = N;
size_t max = 0;
for (int t = 0; t < ExecSpace::concurrency(); t++) {
if (count(t) < min) min = count(t);
if (count(t) > max) max = count(t);
}
ASSERT_TRUE(min < max);
// if ( ExecSpace::concurrency() > 2 ) {
// ASSERT_TRUE( 2 * min < max );
//}
}
}
{
Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> >
count("Count", ExecSpace::concurrency());
Kokkos::View<int *, ExecSpace> a("A", N);
int sum = 0;
Kokkos::parallel_reduce(
policy_t(0, N),
KOKKOS_LAMBDA(const int &i, int &lsum) {
for (int k = 0; k < (i < N_no_implicit_capture / 2 ? 1 : 10000);
k++) {
a(i)++;
}
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
count(ExecSpace::hardware_thread_id())++;
#else
count(ExecSpace::impl_hardware_thread_id())++;
#endif
lsum++;
},
sum);
ASSERT_EQ(sum, N);
int error = 0;
Kokkos::parallel_reduce(
Kokkos::RangePolicy<ExecSpace>(0, N),
KOKKOS_LAMBDA(const int &i, int &lsum) {
lsum += (a(i) != (i < N_no_implicit_capture / 2 ? 1 : 10000));
},
error);
ASSERT_EQ(error, 0);
if ((ExecSpace::concurrency() > (int)1) &&
(N > static_cast<int>(4 * ExecSpace::concurrency()))) {
size_t min = N;
size_t max = 0;
for (int t = 0; t < ExecSpace::concurrency(); t++) {
if (count(t) < min) min = count(t);
if (count(t) > max) max = count(t);
}
ASSERT_TRUE(min < max);
// if ( ExecSpace::concurrency() > 2 ) {
// ASSERT_TRUE( 2 * min < max );
//}
}
}
#endif
}
};
} // namespace
TEST(TEST_CATEGORY, range_for_require) {
using Property = Kokkos::Experimental::WorkItemProperty::HintLightWeight_t;
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(0);
f.test_for();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(0);
f.test_for();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(2);
f.test_for();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(3);
f.test_for();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(1000);
f.test_for();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(1001);
f.test_for();
}
}
TEST(TEST_CATEGORY, range_reduce_require) {
using Property = Kokkos::Experimental::WorkItemProperty::HintLightWeight_t;
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(0);
f.test_reduce();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(0);
f.test_reduce();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(2);
f.test_reduce();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(3);
f.test_reduce();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(1000);
f.test_reduce();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(1001);
f.test_reduce();
}
}
#ifndef KOKKOS_ENABLE_OPENMPTARGET
TEST(TEST_CATEGORY, range_scan_require) {
using Property = Kokkos::Experimental::WorkItemProperty::HintLightWeight_t;
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(0);
f.test_scan();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(0);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(0);
f.test_dynamic_policy();
}
#endif
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(2);
f.test_scan();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(3);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(3);
f.test_dynamic_policy();
}
#endif
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, Property>
f(1000);
f.test_scan();
}
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(1001);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
{
TestRangeRequire<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
Property>
f(1001);
f.test_dynamic_policy();
}
#endif
}
#endif
} // namespace Test

View File

@ -95,12 +95,12 @@ class ReduceFunctor {
};
template <class DeviceType>
class ReduceFunctorFinal : public ReduceFunctor<long, DeviceType> {
class ReduceFunctorFinal : public ReduceFunctor<int64_t, DeviceType> {
public:
typedef typename ReduceFunctor<long, DeviceType>::value_type value_type;
typedef typename ReduceFunctor<int64_t, DeviceType>::value_type value_type;
KOKKOS_INLINE_FUNCTION
ReduceFunctorFinal(const size_t n) : ReduceFunctor<long, DeviceType>(n) {}
ReduceFunctorFinal(const size_t n) : ReduceFunctor<int64_t, DeviceType>(n) {}
KOKKOS_INLINE_FUNCTION
void final(value_type& dst) const {
@ -198,11 +198,11 @@ class RuntimeReduceMinMax {
template <class DeviceType>
class RuntimeReduceFunctorFinal
: public RuntimeReduceFunctor<long, DeviceType> {
: public RuntimeReduceFunctor<int64_t, DeviceType> {
public:
typedef RuntimeReduceFunctor<long, DeviceType> base_type;
typedef RuntimeReduceFunctor<int64_t, DeviceType> base_type;
typedef typename base_type::value_type value_type;
typedef long scalar_type;
typedef int64_t scalar_type;
RuntimeReduceFunctorFinal(const size_t theNwork, const size_t count)
: base_type(theNwork, count) {}
@ -237,9 +237,8 @@ class TestReduce {
value_type result[Repeat];
const unsigned long nw = nwork;
const unsigned long nsum =
nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
const uint64_t nw = nwork;
const uint64_t nsum = nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
for (unsigned i = 0; i < Repeat; ++i) {
Kokkos::parallel_reduce(nwork, functor_type(nwork), result[i]);
@ -247,7 +246,7 @@ class TestReduce {
for (unsigned i = 0; i < Repeat; ++i) {
for (unsigned j = 0; j < Count; ++j) {
const unsigned long correct = 0 == j % 3 ? nw : nsum;
const uint64_t correct = 0 == j % 3 ? nw : nsum;
ASSERT_EQ((ScalarType)correct, result[i].value[j]);
}
}
@ -262,9 +261,8 @@ class TestReduce {
value_type result[Repeat];
const unsigned long nw = nwork;
const unsigned long nsum =
nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
const uint64_t nw = nwork;
const uint64_t nsum = nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
for (unsigned i = 0; i < Repeat; ++i) {
if (i % 2 == 0) {
@ -277,7 +275,7 @@ class TestReduce {
for (unsigned i = 0; i < Repeat; ++i) {
for (unsigned j = 0; j < Count; ++j) {
const unsigned long correct = 0 == j % 3 ? nw : nsum;
const uint64_t correct = 0 == j % 3 ? nw : nsum;
ASSERT_EQ((ScalarType)correct, -result[i].value[j]);
}
}
@ -305,9 +303,8 @@ class TestReduceDynamic {
ScalarType result[Repeat][Count];
const unsigned long nw = nwork;
const unsigned long nsum =
nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
const uint64_t nw = nwork;
const uint64_t nsum = nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
for (unsigned i = 0; i < Repeat; ++i) {
if (i % 2 == 0) {
@ -320,7 +317,7 @@ class TestReduceDynamic {
for (unsigned i = 0; i < Repeat; ++i) {
for (unsigned j = 0; j < Count; ++j) {
const unsigned long correct = 0 == j % 3 ? nw : nsum;
const uint64_t correct = 0 == j % 3 ? nw : nsum;
ASSERT_EQ((ScalarType)correct, result[i][j]);
}
}
@ -351,7 +348,7 @@ class TestReduceDynamic {
const ScalarType correct = (j % 2) ? amax : amin;
ASSERT_EQ((ScalarType)correct, result[i][j]);
} else {
const unsigned long correct = j % 2 ? 1 : nwork;
const uint64_t correct = j % 2 ? 1 : nwork;
ASSERT_EQ((ScalarType)correct, result[i][j]);
}
}
@ -366,9 +363,8 @@ class TestReduceDynamic {
typename functor_type::scalar_type result[Repeat][Count];
const unsigned long nw = nwork;
const unsigned long nsum =
nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
const uint64_t nw = nwork;
const uint64_t nsum = nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
for (unsigned i = 0; i < Repeat; ++i) {
if (i % 2 == 0) {
@ -381,7 +377,7 @@ class TestReduceDynamic {
for (unsigned i = 0; i < Repeat; ++i) {
for (unsigned j = 0; j < Count; ++j) {
const unsigned long correct = 0 == j % 3 ? nw : nsum;
const uint64_t correct = 0 == j % 3 ? nw : nsum;
ASSERT_EQ((ScalarType)correct, -result[i][j]);
}
}
@ -405,9 +401,8 @@ class TestReduceDynamicView {
const unsigned CountLimit = 23;
const unsigned long nw = nwork;
const unsigned long nsum =
nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
const uint64_t nw = nwork;
const uint64_t nsum = nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
for (unsigned count = 0; count < CountLimit; ++count) {
result_type result("result", count);
@ -425,7 +420,7 @@ class TestReduceDynamicView {
}
for (unsigned j = 0; j < count; ++j) {
const unsigned long correct = 0 == j % 3 ? nw : nsum;
const uint64_t correct = 0 == j % 3 ? nw : nsum;
ASSERT_EQ(host_result(j), (ScalarType)correct);
host_result(j) = 0;
}
@ -435,9 +430,9 @@ class TestReduceDynamicView {
} // namespace
TEST(TEST_CATEGORY, long_reduce) {
TestReduce<long, TEST_EXECSPACE>(0);
TestReduce<long, TEST_EXECSPACE>(1000000);
TEST(TEST_CATEGORY, int64_t_reduce) {
TestReduce<int64_t, TEST_EXECSPACE>(0);
TestReduce<int64_t, TEST_EXECSPACE>(1000000);
}
TEST(TEST_CATEGORY, double_reduce) {
@ -445,9 +440,9 @@ TEST(TEST_CATEGORY, double_reduce) {
TestReduce<double, TEST_EXECSPACE>(1000000);
}
TEST(TEST_CATEGORY, long_reduce_dynamic) {
TestReduceDynamic<long, TEST_EXECSPACE>(0);
TestReduceDynamic<long, TEST_EXECSPACE>(1000000);
TEST(TEST_CATEGORY, int64_t_reduce_dynamic) {
TestReduceDynamic<int64_t, TEST_EXECSPACE>(0);
TestReduceDynamic<int64_t, TEST_EXECSPACE>(1000000);
}
TEST(TEST_CATEGORY, double_reduce_dynamic) {
@ -455,9 +450,9 @@ TEST(TEST_CATEGORY, double_reduce_dynamic) {
TestReduceDynamic<double, TEST_EXECSPACE>(1000000);
}
TEST(TEST_CATEGORY, long_reduce_dynamic_view) {
TestReduceDynamicView<long, TEST_EXECSPACE>(0);
TestReduceDynamicView<long, TEST_EXECSPACE>(1000000);
TEST(TEST_CATEGORY, int64_t_reduce_dynamic_view) {
TestReduceDynamicView<int64_t, TEST_EXECSPACE>(0);
TestReduceDynamicView<int64_t, TEST_EXECSPACE>(1000000);
}
} // namespace Test

View File

@ -467,10 +467,10 @@ struct TestReduceCombinatoricalInstantiation {
}
template <class... Args>
static void AddLambdaRange(Kokkos::InvalidType, Args... args) {}
static void AddLambdaRange(Kokkos::InvalidType, Args... /*args*/) {}
template <class... Args>
static void AddLambdaTeam(Kokkos::InvalidType, Args... args) {}
static void AddLambdaTeam(Kokkos::InvalidType, Args... /*args*/) {}
template <int ISTEAM, class... Args>
static void AddFunctor(Args... args) {

View File

@ -71,7 +71,7 @@ void impl_testResize() {
typedef Kokkos::View<int*, DeviceType> view_type;
view_type view_1d("view_1d", sizes[0]);
const int* oldPointer = view_1d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_1d, sizes[0]);
const int* newPointer = view_1d.data();
EXPECT_TRUE(oldPointer == newPointer);
@ -80,7 +80,7 @@ void impl_testResize() {
typedef Kokkos::View<int**, DeviceType> view_type;
view_type view_2d("view_2d", sizes[0], sizes[1]);
const int* oldPointer = view_2d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_2d, sizes[0], sizes[1]);
const int* newPointer = view_2d.data();
EXPECT_TRUE(oldPointer == newPointer);
@ -89,7 +89,7 @@ void impl_testResize() {
typedef Kokkos::View<int***, DeviceType> view_type;
view_type view_3d("view_3d", sizes[0], sizes[1], sizes[2]);
const int* oldPointer = view_3d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_3d, sizes[0], sizes[1], sizes[2]);
const int* newPointer = view_3d.data();
EXPECT_TRUE(oldPointer == newPointer);
@ -98,7 +98,7 @@ void impl_testResize() {
typedef Kokkos::View<int****, DeviceType> view_type;
view_type view_4d("view_4d", sizes[0], sizes[1], sizes[2], sizes[3]);
const int* oldPointer = view_4d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_4d, sizes[0], sizes[1], sizes[2], sizes[3]);
const int* newPointer = view_4d.data();
EXPECT_TRUE(oldPointer == newPointer);
@ -108,7 +108,7 @@ void impl_testResize() {
view_type view_5d("view_5d", sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4]);
const int* oldPointer = view_5d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_5d, sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4]);
const int* newPointer = view_5d.data();
@ -119,7 +119,7 @@ void impl_testResize() {
view_type view_6d("view_6d", sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4], sizes[5]);
const int* oldPointer = view_6d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_6d, sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4], sizes[5]);
const int* newPointer = view_6d.data();
@ -130,7 +130,7 @@ void impl_testResize() {
view_type view_7d("view_7d", sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4], sizes[5], sizes[6]);
const int* oldPointer = view_7d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_7d, sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4], sizes[5], sizes[6]);
const int* newPointer = view_7d.data();
@ -141,7 +141,7 @@ void impl_testResize() {
view_type view_8d("view_8d", sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4], sizes[5], sizes[6], sizes[7]);
const int* oldPointer = view_8d.data();
EXPECT_TRUE(oldPointer != NULL);
EXPECT_TRUE(oldPointer != nullptr);
resize_dispatch(Tag{}, view_8d, sizes[0], sizes[1], sizes[2], sizes[3],
sizes[4], sizes[5], sizes[6], sizes[7]);
const int* newPointer = view_8d.data();

View File

@ -50,7 +50,7 @@ namespace Test {
template <class Device, class WorkSpec = size_t>
struct TestScan {
typedef Device execution_space;
typedef long int value_type;
typedef int64_t value_type;
Kokkos::View<int, Device, Kokkos::MemoryTraits<Kokkos::Atomic> > errors;
@ -98,10 +98,12 @@ struct TestScan {
Kokkos::parallel_scan(N, *this);
long long int total = 0;
int64_t total = 0;
Kokkos::parallel_scan(N, *this, total);
run_check(size_t((N + 1) * N / 2), size_t(total));
// We can't return a value in a constructor so use a lambda as wrapper to
// ignore it.
[&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total)); }();
check_error();
}
@ -129,10 +131,6 @@ struct TestScan {
(void)TestScan(i);
}
}
void run_check(const size_t& expected, const size_t& actual) {
ASSERT_EQ(expected, actual);
}
};
TEST(TEST_CATEGORY, scan) {

View File

@ -116,7 +116,7 @@ void test_shared_alloc() {
#endif
Kokkos::parallel_for(range, [=](size_t i) {
while (0 !=
while (nullptr !=
(r[i] = static_cast<RecordMemS*>(RecordBase::decrement(r[i])))) {
#ifdef KOKKOS_DEBUG
if (r[i]->use_count() == 1) RecordBase::is_sane(r[i]);
@ -157,7 +157,7 @@ void test_shared_alloc() {
#endif
Kokkos::parallel_for(range, [=](size_t i) {
while (0 !=
while (nullptr !=
(r[i] = static_cast<RecordMemS*>(RecordBase::decrement(r[i])))) {
#ifdef KOKKOS_DEBUG
if (r[i]->use_count() == 1) RecordBase::is_sane(r[i]);

View File

@ -843,11 +843,14 @@ struct TestMultipleDependence {
#undef TEST_SCHEDULER
#undef TEST_SCHEDULER_SUFFIX
// KOKKOS WORKAROUND WIN32: Theses tests hang with msvc
#ifndef _WIN32
#define TEST_SCHEDULER_SUFFIX _chase_lev
#define TEST_SCHEDULER Kokkos::ChaseLevTaskScheduler<TEST_EXECSPACE>
#include "TestTaskScheduler_single.hpp"
#undef TEST_SCHEDULER
#undef TEST_SCHEDULER_SUFFIX
#endif
#if 0
#define TEST_SCHEDULER_SUFFIX _fixed_mempool

View File

@ -100,7 +100,7 @@ struct TestTeamPolicy {
struct NoOpTag {};
KOKKOS_INLINE_FUNCTION
void operator()(const NoOpTag &, const team_member &member) const {}
void operator()(const NoOpTag &, const team_member & /*member*/) const {}
static void test_small_league_size() {
int bs = 8; // batch size (number of elements per batch)
@ -139,7 +139,7 @@ struct TestTeamPolicy {
struct ReduceTag {};
typedef long value_type;
typedef int64_t value_type;
KOKKOS_INLINE_FUNCTION
void operator()(const team_member &member, value_type &update) const {
@ -164,9 +164,9 @@ struct TestTeamPolicy {
policy_type_reduce(league_size, 1)
.team_size_max(functor, Kokkos::ParallelReduceTag());
const long N = team_size * league_size;
const int64_t N = team_size * league_size;
long total = 0;
int64_t total = 0;
Kokkos::parallel_reduce(policy_type(league_size, team_size), functor,
total);
@ -263,9 +263,8 @@ class TestReduceTeam {
value_type result[Repeat];
const unsigned long nw = nwork;
const unsigned long nsum =
nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
const uint64_t nw = nwork;
const uint64_t nsum = nw % 2 ? nw * ((nw + 1) / 2) : (nw / 2) * (nw + 1);
policy_type team_exec(nw, 1);
@ -284,7 +283,7 @@ class TestReduceTeam {
for (unsigned i = 0; i < Repeat; ++i) {
for (unsigned j = 0; j < Count; ++j) {
const unsigned long correct = 0 == j % 3 ? nw : nsum;
const uint64_t correct = 0 == j % 3 ? nw : nsum;
ASSERT_EQ((ScalarType)correct, result[i].value[j]);
}
}
@ -302,7 +301,7 @@ class ScanTeamFunctor {
public:
typedef DeviceType execution_space;
typedef Kokkos::TeamPolicy<ScheduleType, execution_space> policy_type;
typedef long int value_type;
typedef int64_t value_type;
Kokkos::View<value_type, execution_space> accum;
Kokkos::View<value_type, execution_space> total;
@ -319,7 +318,7 @@ class ScanTeamFunctor {
}
struct JoinMax {
typedef long int value_type;
typedef int64_t value_type;
KOKKOS_INLINE_FUNCTION
void join(value_type volatile &dst,
@ -332,31 +331,31 @@ class ScanTeamFunctor {
void operator()(const typename policy_type::member_type ind,
value_type &error) const {
if (0 == ind.league_rank() && 0 == ind.team_rank()) {
const long int thread_count = ind.league_size() * ind.team_size();
total() = (thread_count * (thread_count + 1)) / 2;
const int64_t thread_count = ind.league_size() * ind.team_size();
total() = (thread_count * (thread_count + 1)) / 2;
}
// Team max:
int long m = (long int)(ind.league_rank() + ind.team_rank());
ind.team_reduce(Kokkos::Max<int long>(m));
int64_t m = (int64_t)(ind.league_rank() + ind.team_rank());
ind.team_reduce(Kokkos::Max<int64_t>(m));
if (m != ind.league_rank() + (ind.team_size() - 1)) {
printf(
"ScanTeamFunctor[%d.%d of %d.%d] reduce_max_answer(%ld) != "
"reduce_max(%ld)\n",
ind.league_rank(), ind.team_rank(), ind.league_size(),
ind.team_size(),
(long int)(ind.league_rank() + (ind.team_size() - 1)), m);
ind.team_size(), (int64_t)(ind.league_rank() + (ind.team_size() - 1)),
m);
}
// Scan:
const long int answer = (ind.league_rank() + 1) * ind.team_rank() +
(ind.team_rank() * (ind.team_rank() + 1)) / 2;
const int64_t answer = (ind.league_rank() + 1) * ind.team_rank() +
(ind.team_rank() * (ind.team_rank() + 1)) / 2;
const long int result =
const int64_t result =
ind.team_scan(ind.league_rank() + 1 + ind.team_rank() + 1);
const long int result2 =
const int64_t result2 =
ind.team_scan(ind.league_rank() + 1 + ind.team_rank() + 1);
if (answer != result || answer != result2) {
@ -369,7 +368,7 @@ class ScanTeamFunctor {
error = 1;
}
const long int thread_rank =
const int64_t thread_rank =
ind.team_rank() + ind.team_size() * ind.league_rank();
ind.team_scan(1 + thread_rank, accum.data());
}
@ -379,14 +378,14 @@ template <class DeviceType, class ScheduleType>
class TestScanTeam {
public:
typedef DeviceType execution_space;
typedef long int value_type;
typedef int64_t value_type;
typedef Kokkos::TeamPolicy<ScheduleType, execution_space> policy_type;
typedef Test::ScanTeamFunctor<DeviceType, ScheduleType> functor_type;
TestScanTeam(const size_t nteam) { run_test(nteam); }
void run_test(const size_t nteam) {
typedef Kokkos::View<long int, Kokkos::HostSpace, Kokkos::MemoryUnmanaged>
typedef Kokkos::View<int64_t, Kokkos::HostSpace, Kokkos::MemoryUnmanaged>
result_type;
const unsigned REPEAT = 100000;
@ -405,9 +404,9 @@ class TestScanTeam {
nteam, team_exec.team_size_max(functor, Kokkos::ParallelReduceTag()));
for (unsigned i = 0; i < Repeat; ++i) {
long int accum = 0;
long int total = 0;
long int error = 0;
int64_t accum = 0;
int64_t total = 0;
int64_t error = 0;
Kokkos::deep_copy(functor.accum, total);
Kokkos::parallel_reduce(team_exec, functor, result_type(&error));
@ -445,7 +444,7 @@ struct SharedTeamFunctor {
shared_int_array_type;
// Tell how much shared memory will be required by this functor.
inline unsigned team_shmem_size(int team_size) const {
inline unsigned team_shmem_size(int /*team_size*/) const {
return shared_int_array_type::shmem_size(SHARED_COUNT) +
shared_int_array_type::shmem_size(SHARED_COUNT);
}
@ -462,7 +461,7 @@ struct SharedTeamFunctor {
"member( %d/%d , %d/%d ) Failed to allocate shared memory of size "
"%lu\n",
ind.league_rank(), ind.league_size(), ind.team_rank(),
ind.team_size(), static_cast<unsigned long>(SHARED_COUNT));
ind.team_size(), static_cast<uint64_t>(SHARED_COUNT));
++update; // Failure to allocate is an error.
} else {
@ -523,7 +522,6 @@ struct TestSharedTeam {
namespace Test {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
template <class MemorySpace, class ExecSpace, class ScheduleType>
struct TestLambdaSharedTeam {
TestLambdaSharedTeam() { run(); }
@ -568,7 +566,7 @@ struct TestLambdaSharedTeam {
if ((shared_A.data() == nullptr && SHARED_COUNT > 0) ||
(shared_B.data() == nullptr && SHARED_COUNT > 0)) {
printf("Failed to allocate shared memory of size %lu\n",
static_cast<unsigned long>(SHARED_COUNT));
static_cast<uint64_t>(SHARED_COUNT));
++update; // Failure to allocate is an error.
} else {
@ -601,7 +599,6 @@ struct TestLambdaSharedTeam {
}
};
#endif
#endif
} // namespace Test
@ -636,7 +633,7 @@ struct ScratchTeamFunctor {
(scratch_A.data() == nullptr && SHARED_TEAM_COUNT > 0) ||
(scratch_B.data() == nullptr && SHARED_THREAD_COUNT > 0)) {
printf("Failed to allocate shared memory of size %lu\n",
static_cast<unsigned long>(SHARED_TEAM_COUNT));
static_cast<uint64_t>(SHARED_TEAM_COUNT));
++update; // Failure to allocate is an error.
} else {
@ -739,22 +736,22 @@ KOKKOS_INLINE_FUNCTION int test_team_mulit_level_scratch_loop_body(
a_thread2(team.thread_scratch(0), 16);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
b_team1(team.team_scratch(1), 128000);
b_team1(team.team_scratch(1), 12800);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
b_thread1(team.thread_scratch(1), 16000);
b_thread1(team.thread_scratch(1), 1600);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
b_team2(team.team_scratch(1), 128000);
b_team2(team.team_scratch(1), 12800);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
b_thread2(team.thread_scratch(1), 16000);
b_thread2(team.thread_scratch(1), 1600);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
a_team3(team.team_scratch(0), 128);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
a_thread3(team.thread_scratch(0), 16);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
b_team3(team.team_scratch(1), 128000);
b_team3(team.team_scratch(1), 12800);
Kokkos::View<double *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
b_thread3(team.thread_scratch(1), 16000);
b_thread3(team.thread_scratch(1), 1600);
// The explicit types for 0 and 128 are here to test TeamThreadRange accepting
// different types for begin and end.
@ -775,7 +772,7 @@ KOKKOS_INLINE_FUNCTION int test_team_mulit_level_scratch_loop_body(
team.league_rank() * 100000;
});
Kokkos::parallel_for(Kokkos::TeamThreadRange(team, 0, 128000),
Kokkos::parallel_for(Kokkos::TeamThreadRange(team, 0, 12800),
[&](const int &i) {
b_team1(i) = 1000000 + i + team.league_rank() * 100000;
b_team2(i) = 2000000 + i + team.league_rank() * 100000;
@ -783,7 +780,7 @@ KOKKOS_INLINE_FUNCTION int test_team_mulit_level_scratch_loop_body(
});
team.team_barrier();
Kokkos::parallel_for(Kokkos::ThreadVectorRange(team, 16000),
Kokkos::parallel_for(Kokkos::ThreadVectorRange(team, 1600),
[&](const int &i) {
b_thread1(i) = 1000000 + 100000 * team.team_rank() +
16 - i + team.league_rank() * 100000;
@ -817,7 +814,7 @@ KOKKOS_INLINE_FUNCTION int test_team_mulit_level_scratch_loop_body(
});
Kokkos::parallel_for(
Kokkos::TeamThreadRange(team, 0, 128000), [&](const int &i) {
Kokkos::TeamThreadRange(team, 0, 12800), [&](const int &i) {
if (b_team1(i) != 1000000 + i + team.league_rank() * 100000) error++;
if (b_team2(i) != 2000000 + i + team.league_rank() * 100000) error++;
if (b_team3(i) != 3000000 + i + team.league_rank() * 100000) error++;
@ -825,7 +822,7 @@ KOKKOS_INLINE_FUNCTION int test_team_mulit_level_scratch_loop_body(
team.team_barrier();
Kokkos::parallel_for(
Kokkos::ThreadVectorRange(team, 16000), [&](const int &i) {
Kokkos::ThreadVectorRange(team, 1600), [&](const int &i) {
if (b_thread1(i) != 1000000 + 100000 * team.team_rank() + 16 - i +
team.league_rank() * 100000)
error++;
@ -879,11 +876,11 @@ struct ClassNoShmemSizeFunction {
const int per_team1 =
3 * Kokkos::View<
double *, ExecSpace,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(128000);
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(12800);
const int per_thread1 =
3 * Kokkos::View<
double *, ExecSpace,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(16000);
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(1600);
int team_size = 8;
if (team_size > ExecSpace::concurrency())
@ -952,11 +949,11 @@ struct ClassWithShmemSizeFunction {
const int per_team1 =
3 * Kokkos::View<
double *, ExecSpace,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(128000);
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(12800);
const int per_thread1 =
3 * Kokkos::View<
double *, ExecSpace,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(16000);
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(1600);
int team_size = 8;
if (team_size > ExecSpace::concurrency())
@ -1008,7 +1005,6 @@ struct ClassWithShmemSizeFunction {
template <class ExecSpace, class ScheduleType>
void test_team_mulit_level_scratch_test_lambda() {
#ifdef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
Kokkos::View<int, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> > errors;
Kokkos::View<int, ExecSpace> d_errors("Errors");
errors = d_errors;
@ -1023,13 +1019,13 @@ void test_team_mulit_level_scratch_test_lambda() {
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(16);
const int per_team1 =
3 * Kokkos::View<
double *, ExecSpace,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(128000);
3 *
Kokkos::View<double *, ExecSpace,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(12800);
const int per_thread1 =
3 *
Kokkos::View<double *, ExecSpace,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(16000);
Kokkos::MemoryTraits<Kokkos::Unmanaged> >::shmem_size(1600);
int team_size = 8;
if (team_size > ExecSpace::concurrency())
@ -1070,7 +1066,6 @@ void test_team_mulit_level_scratch_test_lambda() {
error);
ASSERT_EQ(error, 0);
#endif
#endif
}
} // namespace Test
@ -1102,7 +1097,7 @@ struct TestShmemSize {
TestShmemSize() { run(); }
void run() {
typedef Kokkos::View<long ***, ExecSpace> view_type;
typedef Kokkos::View<int64_t ***, ExecSpace> view_type;
size_t d1 = 5;
size_t d2 = 6;
@ -1110,7 +1105,7 @@ struct TestShmemSize {
size_t size = view_type::shmem_size(d1, d2, d3);
ASSERT_EQ(size, (d1 * d2 * d3 + 1) * sizeof(long));
ASSERT_EQ(size, (d1 * d2 * d3 + 1) * sizeof(int64_t));
test_layout_stride();
}
@ -1137,17 +1132,25 @@ namespace Test {
namespace {
template <class ExecSpace, class ScheduleType>
struct TestTeamBroadcast {
typedef typename Kokkos::TeamPolicy<ScheduleType, ExecSpace>::member_type
team_member;
template <class ExecSpace, class ScheduleType, class T, class Enabled = void>
struct TestTeamBroadcast;
TestTeamBroadcast(const size_t league_size) {}
template <class ExecSpace, class ScheduleType, class T>
struct TestTeamBroadcast<
ExecSpace, ScheduleType, T,
typename std::enable_if<(sizeof(T) == sizeof(char)), void>::type> {
using team_member =
typename Kokkos::TeamPolicy<ScheduleType, ExecSpace>::member_type;
using memory_space = typename ExecSpace::memory_space;
using value_type = T;
const value_type offset;
TestTeamBroadcast(const size_t /*league_size*/, const value_type os_)
: offset(os_) {}
struct BroadcastTag {};
typedef long value_type;
KOKKOS_INLINE_FUNCTION
void operator()(const team_member &teamMember, value_type &update) const {
int lid = teamMember.league_rank();
@ -1155,16 +1158,17 @@ struct TestTeamBroadcast {
int ts = teamMember.team_size();
value_type parUpdate = 0;
value_type value = tid * 3 + 1;
value_type value = (value_type)(tid % 0xFF) + offset;
// broadcast boolean and value to team from source thread
teamMember.team_broadcast(value, lid % ts);
Kokkos::parallel_reduce(
Kokkos::TeamThreadRange(teamMember, ts),
[&](const int j, value_type &teamUpdate) { teamUpdate += value; },
parUpdate);
[&](const int /*j*/, value_type &teamUpdate) { teamUpdate |= value; },
Kokkos::BOr<value_type, memory_space>(parUpdate));
if (teamMember.team_rank() == 0) update += parUpdate;
if (teamMember.team_rank() == 0) update |= parUpdate;
}
KOKKOS_INLINE_FUNCTION
@ -1175,21 +1179,22 @@ struct TestTeamBroadcast {
int ts = teamMember.team_size();
value_type parUpdate = 0;
value_type value = tid * 3 + 1;
value_type value = (value_type)(tid % 0xFF) + offset;
teamMember.team_broadcast([&](value_type &var) { var *= 2; }, value,
teamMember.team_broadcast([&](value_type &var) { var -= offset; }, value,
lid % ts);
Kokkos::parallel_reduce(
Kokkos::TeamThreadRange(teamMember, ts),
[&](const int j, value_type &teamUpdate) { teamUpdate += value; },
parUpdate);
[&](const int /*j*/, value_type &teamUpdate) { teamUpdate |= value; },
Kokkos::BOr<value_type, memory_space>(parUpdate));
if (teamMember.team_rank() == 0) update += parUpdate;
if (teamMember.team_rank() == 0) update |= parUpdate;
}
static void test_teambroadcast(const size_t league_size) {
TestTeamBroadcast functor(league_size);
static void test_teambroadcast(const size_t league_size,
const value_type off) {
TestTeamBroadcast functor(league_size, off);
typedef Kokkos::TeamPolicy<ScheduleType, ExecSpace> policy_type;
typedef Kokkos::TeamPolicy<ScheduleType, ExecSpace, BroadcastTag>
@ -1203,20 +1208,166 @@ struct TestTeamBroadcast {
ParallelReduceTag()); // printf("team_size=%d\n",team_size);
// team_broadcast with value
long total = 0;
value_type total = 0;
Kokkos::parallel_reduce(policy_type(league_size, team_size), functor,
Kokkos::BOr<value_type, Kokkos::HostSpace>(total));
value_type expected_result = 0;
for (unsigned int i = 0; i < league_size; i++) {
value_type val = (value_type((i % team_size % 0xFF)) + off);
expected_result |= val;
}
ASSERT_EQ(expected_result, total);
// printf("team_broadcast with value --"
//"expected_result=%x,"
//"total=%x\n",expected_result, total);
// team_broadcast with function object
total = 0;
Kokkos::parallel_reduce(policy_type_f(league_size, team_size), functor,
Kokkos::BOr<value_type, Kokkos::HostSpace>(total));
expected_result = 0;
for (unsigned int i = 0; i < league_size; i++) {
value_type val = ((value_type)((i % team_size % 0xFF)));
expected_result |= val;
}
ASSERT_EQ(expected_result, total);
// printf("team_broadcast with function object --"
// "expected_result=%x,"
// "total=%x\n",expected_result, total);
}
};
template <class ExecSpace, class ScheduleType, class T>
struct TestTeamBroadcast<
ExecSpace, ScheduleType, T,
typename std::enable_if<(sizeof(T) > sizeof(char)), void>::type> {
using team_member =
typename Kokkos::TeamPolicy<ScheduleType, ExecSpace>::member_type;
using value_type = T;
const value_type offset;
TestTeamBroadcast(const size_t /*league_size*/, const value_type os_)
: offset(os_) {}
struct BroadcastTag {};
KOKKOS_INLINE_FUNCTION
void operator()(const team_member &teamMember, value_type &update) const {
int lid = teamMember.league_rank();
int tid = teamMember.team_rank();
int ts = teamMember.team_size();
value_type parUpdate = 0;
value_type value = (value_type)(tid * 3) + offset;
// setValue is used to determine if the update should be
// performed at the bottom. The thread id must match the
// thread id used to broadcast the value. It is the
// thread id that matches the league rank mod team size
// this way each league rank will use a different thread id
// which is likely not 0
bool setValue = ((lid % ts) == tid);
// broadcast boolean and value to team from source thread
teamMember.team_broadcast(value, lid % ts);
teamMember.team_broadcast(setValue, lid % ts);
Kokkos::parallel_reduce(
Kokkos::TeamThreadRange(teamMember, ts),
[&](const int /*j*/, value_type &teamUpdate) { teamUpdate += value; },
parUpdate);
if (teamMember.team_rank() == 0 && setValue) update += parUpdate;
}
KOKKOS_INLINE_FUNCTION
void operator()(const BroadcastTag &, const team_member &teamMember,
value_type &update) const {
int lid = teamMember.league_rank();
int tid = teamMember.team_rank();
int ts = teamMember.team_size();
value_type parUpdate = 0;
value_type value = (value_type)(tid * 3) + offset;
// setValue is used to determine if the update should be
// performed at the bottom. The thread id must match the
// thread id used to broadcast the value. It is the
// thread id that matches the league rank mod team size
// this way each league rank will use a different thread id
// which is likely not 0. Note the logic is switched from
// above because the functor switches it back.
bool setValue = ((lid % ts) != tid);
teamMember.team_broadcast([&](value_type &var) { var *= 2; }, value,
lid % ts);
teamMember.team_broadcast([&](bool &bVar) { bVar = !bVar; }, setValue,
lid % ts);
Kokkos::parallel_reduce(
Kokkos::TeamThreadRange(teamMember, ts),
[&](const int /*j*/, value_type &teamUpdate) { teamUpdate += value; },
parUpdate);
if (teamMember.team_rank() == 0 && setValue) update += parUpdate;
}
template <class ScalarType>
static inline
typename std::enable_if<!std::is_integral<ScalarType>::value, void>::type
compare_test(ScalarType A, ScalarType B) {
if (std::is_same<ScalarType, double>::value) {
ASSERT_DOUBLE_EQ((double)A, (double)B);
} else if (std::is_same<ScalarType, float>::value) {
ASSERT_FLOAT_EQ((double)A, (double)B);
} else {
ASSERT_EQ(A, B);
}
}
template <class ScalarType>
static inline
typename std::enable_if<std::is_integral<ScalarType>::value, void>::type
compare_test(ScalarType A, ScalarType B) {
ASSERT_EQ(A, B);
}
static void test_teambroadcast(const size_t league_size,
const value_type off) {
TestTeamBroadcast functor(league_size, off);
typedef Kokkos::TeamPolicy<ScheduleType, ExecSpace> policy_type;
typedef Kokkos::TeamPolicy<ScheduleType, ExecSpace, BroadcastTag>
policy_type_f;
const int team_size =
policy_type_f(league_size, 1)
.team_size_max(
functor,
Kokkos::
ParallelReduceTag()); // printf("team_size=%d\n",team_size);
// team_broadcast with value
value_type total = 0;
Kokkos::parallel_reduce(policy_type(league_size, team_size), functor,
total);
value_type expected_result = 0;
for (unsigned int i = 0; i < league_size; i++) {
value_type val = ((i % team_size) * 3 + 1) * team_size;
value_type val =
(value_type((i % team_size) * 3) + off) * (value_type)team_size;
expected_result += val;
}
ASSERT_EQ(size_t(expected_result),
size_t(total)); // printf("team_broadcast with value --
// expected_result=%d,
// total=%d\n",expected_result, total);
compare_test(expected_result,
total); // printf("team_broadcast with value --
// expected_result=%d,
// total=%d\n",expected_result, total);
// team_broadcast with function object
total = 0;
@ -1226,13 +1377,14 @@ struct TestTeamBroadcast {
expected_result = 0;
for (unsigned int i = 0; i < league_size; i++) {
value_type val = ((i % team_size) * 3 + 1) * 2 * team_size;
value_type val = ((value_type)((i % team_size) * 3) + off) *
(value_type)(2 * team_size);
expected_result += val;
}
ASSERT_EQ(size_t(expected_result),
size_t(total)); // printf("team_broadcast with function object --
// expected_result=%d,
// total=%d\n",expected_result, total);
compare_test(expected_result,
total); // printf("team_broadcast with function object --
// expected_result=%d,
// total=%d\n",expected_result, total);
}
};

View File

@ -78,13 +78,13 @@ template <class T, int N, class PolicyType, int S>
struct FunctorFor {
double static_array[S];
KOKKOS_INLINE_FUNCTION
void operator()(const typename PolicyType::member_type& team) const {}
void operator()(const typename PolicyType::member_type& /*team*/) const {}
};
template <class T, int N, class PolicyType, int S>
struct FunctorReduce {
double static_array[S];
KOKKOS_INLINE_FUNCTION
void operator()(const typename PolicyType::member_type& team,
void operator()(const typename PolicyType::member_type& /*team*/,
MyArray<T, N>& lval) const {
for (int j = 0; j < N; j++) lval.values[j] += 1 + lval.values[0];
}
@ -191,7 +191,7 @@ struct PrintFunctor2 {
};
TEST(TEST_CATEGORY, team_policy_max_scalar_without_plus_equal_k) {
using ExecSpace = Kokkos::DefaultExecutionSpace;
using ExecSpace = TEST_EXECSPACE;
using ReducerType = Kokkos::MinMax<double, Kokkos::HostSpace>;
using ReducerValueType = typename ReducerType::value_type;
using DynamicScheduleType = Kokkos::Schedule<Kokkos::Dynamic>;

View File

@ -622,7 +622,7 @@ struct functor_vec_single {
Scalar value2 = 0;
Kokkos::parallel_reduce(
Kokkos::ThreadVectorRange(team, nStart, nEnd),
[&](int i, Scalar &val) { val += value; }, value2);
[&](int /*i*/, Scalar &val) { val += value; }, value2);
if (value2 != (value * (nEnd - nStart))) {
printf("FAILED vector_single broadcast %i %i %f %f\n", team.league_rank(),
@ -895,8 +895,7 @@ namespace Test {
// Computes y^T*A*x
// ( modified from kokkos-tutorials/GTC2016/Exercises/ThreeLevelPar )
#if (!defined(KOKKOS_ENABLE_CUDA)) || \
(defined(KOKKOS_ENABLE_CUDA_LAMBDA) && (8000 <= CUDA_VERSION))
#if (!defined(KOKKOS_ENABLE_CUDA)) || defined(KOKKOS_ENABLE_CUDA_LAMBDA)
template <typename ScalarType, class DeviceType>
class TestTripleNestedReduce {
public:

View File

@ -233,7 +233,7 @@ struct functor_teamvector_for {
typedef typename ExecutionSpace::scratch_memory_space shmem_space;
typedef Kokkos::View<Scalar*, shmem_space, Kokkos::MemoryUnmanaged>
shared_int;
unsigned team_shmem_size(int team_size) const {
unsigned team_shmem_size(int /*team_size*/) const {
return shared_int::shmem_size(131);
}

View File

@ -58,7 +58,7 @@ struct SumPlain {
SumPlain(type view_) : view(view_) {}
KOKKOS_INLINE_FUNCTION
void operator()(int i, Scalar& val) { val += Scalar(); }
void operator()(int /*i*/, Scalar& val) { val += Scalar(); }
};
template <class Scalar, class ExecutionSpace>
@ -80,7 +80,7 @@ struct SumInitJoinFinalValueType {
}
KOKKOS_INLINE_FUNCTION
void operator()(int i, value_type& val) const { val += value_type(); }
void operator()(int /*i*/, value_type& val) const { val += value_type(); }
};
template <class Scalar, class ExecutionSpace>
@ -102,7 +102,7 @@ struct SumInitJoinFinalValueType2 {
}
KOKKOS_INLINE_FUNCTION
void operator()(int i, value_type& val) const { val += value_type(); }
void operator()(int /*i*/, value_type& val) const { val += value_type(); }
};
template <class Scalar, class ExecutionSpace>
@ -157,7 +157,7 @@ struct SumWrongInitJoinFinalValueType {
}
KOKKOS_INLINE_FUNCTION
void operator()(int i, value_type& val) const { val += value_type(); }
void operator()(int /*i*/, value_type& val) const { val += value_type(); }
};
template <class Scalar, class ExecutionSpace>

View File

@ -841,6 +841,22 @@ struct TestViewMirror {
ASSERT_EQ(a_org(5), a_h3(5));
}
template <typename View>
static typename View::const_type view_const_cast(View const &v) {
return v;
}
static void test_mirror_copy_const_data_type() {
using ExecutionSpace = typename DeviceType::execution_space;
int const N = 100;
Kokkos::View<int *, ExecutionSpace> v("v", N);
Kokkos::deep_copy(v, 255);
auto v_m1 = Kokkos::create_mirror_view_and_copy(
Kokkos::DefaultHostExecutionSpace(), view_const_cast(v));
auto v_m2 = Kokkos::create_mirror_view_and_copy(ExecutionSpace(),
view_const_cast(v));
}
template <class MemoryTraits, class Space>
struct CopyUnInit {
typedef typename Kokkos::Impl::MirrorViewType<
@ -896,6 +912,7 @@ struct TestViewMirror {
test_mirror_view<Kokkos::MemoryTraits<Kokkos::Unmanaged> >();
test_mirror_copy<Kokkos::MemoryTraits<0> >();
test_mirror_copy<Kokkos::MemoryTraits<Kokkos::Unmanaged> >();
test_mirror_copy_const_data_type();
test_mirror_no_initialize<Kokkos::MemoryTraits<0> >();
test_mirror_no_initialize<Kokkos::MemoryTraits<Kokkos::Unmanaged> >();
}
@ -920,8 +937,6 @@ class TestViewAPI {
dView4_unmanaged;
typedef typename dView0::host_mirror_space host;
TestViewAPI() {}
static void run_test_view_operator_a() {
{
TestViewOperator<T, device> f;
@ -1034,12 +1049,12 @@ class TestViewAPI {
dView4 dx, dy, dz;
hView4 hx, hy, hz;
ASSERT_TRUE(dx.data() == 0);
ASSERT_TRUE(dy.data() == 0);
ASSERT_TRUE(dz.data() == 0);
ASSERT_TRUE(hx.data() == 0);
ASSERT_TRUE(hy.data() == 0);
ASSERT_TRUE(hz.data() == 0);
ASSERT_TRUE(dx.data() == nullptr);
ASSERT_TRUE(dy.data() == nullptr);
ASSERT_TRUE(dz.data() == nullptr);
ASSERT_TRUE(hx.data() == nullptr);
ASSERT_TRUE(hy.data() == nullptr);
ASSERT_TRUE(hz.data() == nullptr);
ASSERT_EQ(dx.extent(0), 0u);
ASSERT_EQ(dy.extent(0), 0u);
ASSERT_EQ(dz.extent(0), 0u);
@ -1096,11 +1111,11 @@ class TestViewAPI {
ASSERT_EQ(dx.use_count(), size_t(2));
ASSERT_FALSE(dx.data() == 0);
ASSERT_FALSE(const_dx.data() == 0);
ASSERT_FALSE(unmanaged_dx.data() == 0);
ASSERT_FALSE(unmanaged_from_ptr_dx.data() == 0);
ASSERT_FALSE(dy.data() == 0);
ASSERT_FALSE(dx.data() == nullptr);
ASSERT_FALSE(const_dx.data() == nullptr);
ASSERT_FALSE(unmanaged_dx.data() == nullptr);
ASSERT_FALSE(unmanaged_from_ptr_dx.data() == nullptr);
ASSERT_FALSE(dy.data() == nullptr);
ASSERT_NE(dx, dy);
ASSERT_EQ(dx.extent(0), unsigned(N0));
@ -1139,6 +1154,7 @@ class TestViewAPI {
Kokkos::deep_copy(typename hView4::execution_space(), dx, hx);
Kokkos::deep_copy(typename hView4::execution_space(), dy, dx);
Kokkos::deep_copy(typename hView4::execution_space(), hy, dy);
typename dView4::execution_space().fence();
for (size_t ip = 0; ip < N0; ++ip)
for (size_t i1 = 0; i1 < N1; ++i1)
@ -1149,6 +1165,7 @@ class TestViewAPI {
Kokkos::deep_copy(typename hView4::execution_space(), dx, T(0));
Kokkos::deep_copy(typename hView4::execution_space(), hx, dx);
typename dView4::execution_space().fence();
for (size_t ip = 0; ip < N0; ++ip)
for (size_t i1 = 0; i1 < N1; ++i1)
@ -1172,6 +1189,7 @@ class TestViewAPI {
Kokkos::deep_copy(typename dView4::execution_space(), dx, hx);
Kokkos::deep_copy(typename dView4::execution_space(), dy, dx);
Kokkos::deep_copy(typename dView4::execution_space(), hy, dy);
typename dView4::execution_space().fence();
for (size_t ip = 0; ip < N0; ++ip)
for (size_t i1 = 0; i1 < N1; ++i1)
@ -1182,6 +1200,7 @@ class TestViewAPI {
Kokkos::deep_copy(typename dView4::execution_space(), dx, T(0));
Kokkos::deep_copy(typename dView4::execution_space(), hx, dx);
typename dView4::execution_space().fence();
for (size_t ip = 0; ip < N0; ++ip)
for (size_t i1 = 0; i1 < N1; ++i1)
@ -1233,19 +1252,19 @@ class TestViewAPI {
ASSERT_NE(dx, dz);
dx = dView4();
ASSERT_TRUE(dx.data() == 0);
ASSERT_FALSE(dy.data() == 0);
ASSERT_FALSE(dz.data() == 0);
ASSERT_TRUE(dx.data() == nullptr);
ASSERT_FALSE(dy.data() == nullptr);
ASSERT_FALSE(dz.data() == nullptr);
dy = dView4();
ASSERT_TRUE(dx.data() == 0);
ASSERT_TRUE(dy.data() == 0);
ASSERT_FALSE(dz.data() == 0);
ASSERT_TRUE(dx.data() == nullptr);
ASSERT_TRUE(dy.data() == nullptr);
ASSERT_FALSE(dz.data() == nullptr);
dz = dView4();
ASSERT_TRUE(dx.data() == 0);
ASSERT_TRUE(dy.data() == 0);
ASSERT_TRUE(dz.data() == 0);
ASSERT_TRUE(dx.data() == nullptr);
ASSERT_TRUE(dy.data() == nullptr);
ASSERT_TRUE(dz.data() == nullptr);
}
static void run_test_deep_copy_empty() {
@ -1450,6 +1469,11 @@ class TestViewAPI {
}
static void run_test_error() {
#ifdef KOKKOS_ENABLE_OPENMPTARGET
if (std::is_same<typename dView1::memory_space,
Kokkos::Experimental::OpenMPTargetSpace>::value)
return;
#endif
auto alloc_size = std::numeric_limits<size_t>::max() - 42;
try {
auto should_always_fail = dView1("hello_world_failure", alloc_size);

View File

@ -204,13 +204,13 @@ TEST(TEST_CATEGORY, anonymous_space) { test_anonymous_space(); }
template <class ExecSpace>
struct TestViewOverloadResolution {
// Overload based on value_type and rank
static int foo(Kokkos::View<const double**, ExecSpace> a) { return 1; }
static int foo(Kokkos::View<const int**, ExecSpace> a) { return 2; }
static int foo(Kokkos::View<const double***, ExecSpace> a) { return 3; }
static int foo(Kokkos::View<const double**, ExecSpace> /*a*/) { return 1; }
static int foo(Kokkos::View<const int**, ExecSpace> /*a*/) { return 2; }
static int foo(Kokkos::View<const double***, ExecSpace> /*a*/) { return 3; }
// Overload based on compile time dimensions
static int bar(Kokkos::View<double * [3], ExecSpace> a) { return 4; }
static int bar(Kokkos::View<double * [4], ExecSpace> a) { return 5; }
static int bar(Kokkos::View<double * [3], ExecSpace> /*a*/) { return 4; }
static int bar(Kokkos::View<double * [4], ExecSpace> /*a*/) { return 5; }
static void test_function_overload() {
Kokkos::View<double**, typename ExecSpace::execution_space::array_layout,
@ -240,3 +240,5 @@ TEST(TEST_CATEGORY, view_overload_resolution) {
TestViewOverloadResolution<TEST_EXECSPACE>::test_function_overload();
}
} // namespace Test
#include <TestViewIsAssignable.hpp>

View File

@ -52,124 +52,446 @@ namespace Test {
namespace {
template <typename ExecSpace>
struct TestViewCopy {
using InExecSpace = ExecSpace;
static void test_view_copy(const int dim0, const int dim1, const int dim2) {
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_ROCM)
// ExecSpace = CudaUVM, CudaHostPinned
// This test will fail at runtime with an illegal memory access if something
// goes wrong Test 1: deep_copy from host_mirror_space to ExecSpace and
// ExecSpace back to host_mirror_space
{
typedef Kokkos::View<double****, InExecSpace> Rank4ViewType;
Rank4ViewType view_4;
view_4 = Rank4ViewType("view_4", dim0, dim1, dim2, dim2);
typedef typename Kokkos::Impl::is_space<
InExecSpace>::host_mirror_space::execution_space host_space_type;
Kokkos::View<double**, Kokkos::LayoutLeft, host_space_type> srcView(
"srcView", dim2, dim2);
// Strided dst view
auto dstView =
Kokkos::subview(view_4, 0, 0, Kokkos::ALL(), Kokkos::ALL());
// host_mirror_space to ExecSpace
Kokkos::deep_copy(dstView, srcView);
Kokkos::fence();
// ExecSpace to host_mirror_space
Kokkos::deep_copy(srcView, dstView);
Kokkos::fence();
template <class ViewType>
struct CheckResult {
using value_type = typename ViewType::non_const_value_type;
ViewType v;
value_type value;
CheckResult(ViewType v_, value_type value_) : v(v_), value(value_){};
KOKKOS_FUNCTION
void operator()(const int i, int& lsum) const {
for (int j = 0; j < static_cast<int>(v.extent(1)); j++) {
if (v.access(i, j) != value) lsum++;
}
}
};
// Test 2: deep_copy from Cuda to ExecSpace and ExecSpace back to Cuda
{
typedef Kokkos::View<double****, InExecSpace> Rank4ViewType;
Rank4ViewType view_4;
view_4 = Rank4ViewType("view_4", dim0, dim1, dim2, dim2);
#if defined(KOKKOS_ENABLE_CUDA)
typedef typename std::conditional<
Kokkos::Impl::MemorySpaceAccess<
Kokkos::CudaSpace,
typename InExecSpace::memory_space>::accessible,
Kokkos::CudaSpace, InExecSpace>::type space_type;
#endif
#if defined(KOKKOS_ENABLE_ROCM)
typedef typename std::conditional<
Kokkos::Impl::MemorySpaceAccess<
Kokkos::ROCmSpace,
typename InExecSpace::memory_space>::accessible,
Kokkos::ROCmSpace, InExecSpace>::type space_type;
#endif
Kokkos::View<double**, Kokkos::LayoutLeft, space_type> srcView(
"srcView", dim2, dim2);
// Strided dst view
auto dstView =
Kokkos::subview(view_4, 0, 0, Kokkos::ALL(), Kokkos::ALL());
// Cuda to ExecSpace
Kokkos::deep_copy(dstView, srcView);
Kokkos::fence();
// ExecSpace to Cuda
Kokkos::deep_copy(srcView, dstView);
Kokkos::fence();
}
// Test 3: deep_copy from host_space to ExecSpace and ExecSpace back to
// host_space
{
typedef Kokkos::View<double****, InExecSpace> Rank4ViewType;
Rank4ViewType view_4;
view_4 = Rank4ViewType("view_4", dim0, dim1, dim2, dim2);
typedef Kokkos::HostSpace host_space_type;
Kokkos::View<double**, Kokkos::LayoutLeft, host_space_type> srcView(
"srcView", dim2, dim2);
// Strided dst view
auto dstView =
Kokkos::subview(view_4, 0, 0, Kokkos::ALL(), Kokkos::ALL());
// host_space to ExecSpace
Kokkos::deep_copy(dstView, srcView);
Kokkos::fence();
// ExecSpace to host_space
Kokkos::deep_copy(srcView, dstView);
Kokkos::fence();
}
#endif
} // end test_view_copy
}; // end struct
template <class ViewType>
bool run_check(ViewType v, typename ViewType::value_type value) {
using exec_space = typename ViewType::memory_space::execution_space;
int errors = 0;
Kokkos::fence();
Kokkos::parallel_reduce(Kokkos::RangePolicy<exec_space>(0, v.extent(0)),
CheckResult<ViewType>(v, value), errors);
return errors == 0;
}
} // namespace
TEST(TEST_CATEGORY, view_copy_tests) {
// Only include this file to be compiled with CudaUVM and CudaHostPinned
TestViewCopy<TEST_EXECSPACE>::test_view_copy(4, 2, 3);
TestViewCopy<TEST_EXECSPACE>::test_view_copy(4, 2, 0);
int N = 10000;
int M = 10;
Kokkos::View<int**, Kokkos::LayoutRight, TEST_EXECSPACE> defaulted;
Kokkos::View<int**, Kokkos::LayoutRight, TEST_EXECSPACE> a("A", N, M);
Kokkos::View<int**, Kokkos::LayoutRight, TEST_EXECSPACE> b("B", N, M);
auto h_a = Kokkos::create_mirror(a);
auto h_b = Kokkos::create_mirror(b);
auto m_a = Kokkos::create_mirror_view(a);
auto s_a = Kokkos::subview(a, Kokkos::ALL, 1);
auto s_b = Kokkos::subview(b, Kokkos::ALL, 1);
auto hs_a = Kokkos::subview(h_a, Kokkos::ALL, 1);
auto hs_b = Kokkos::subview(h_b, Kokkos::ALL, 1);
auto dev = typename TEST_EXECSPACE::execution_space();
auto host = Kokkos::DefaultHostExecutionSpace();
constexpr bool DevExecCanAccessHost =
Kokkos::Impl::SpaceAccessibility<typename TEST_EXECSPACE::execution_space,
Kokkos::HostSpace>::accessible;
constexpr bool HostExecCanAccessDev = Kokkos::Impl::SpaceAccessibility<
typename Kokkos::HostSpace::execution_space,
typename TEST_EXECSPACE::memory_space>::accessible;
// Contiguous copies
{ Kokkos::deep_copy(defaulted, defaulted); }
{
Kokkos::deep_copy(a, 1);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(a, a);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(m_a, a);
ASSERT_TRUE(run_check(m_a, 1));
}
{
Kokkos::deep_copy(m_a, 2);
ASSERT_TRUE(run_check(m_a, 2));
}
{
Kokkos::deep_copy(a, m_a);
ASSERT_TRUE(run_check(a, 2));
}
{
Kokkos::deep_copy(b, 3);
ASSERT_TRUE(run_check(b, 3));
}
{
Kokkos::deep_copy(h_a, 4);
ASSERT_TRUE(run_check(h_a, 4));
}
{
Kokkos::deep_copy(a, b);
ASSERT_TRUE(run_check(a, 3));
}
{
Kokkos::deep_copy(h_b, h_a);
ASSERT_TRUE(run_check(h_b, 4));
}
{
Kokkos::deep_copy(h_a, a);
ASSERT_TRUE(run_check(h_a, 3));
}
{
Kokkos::deep_copy(b, h_b);
ASSERT_TRUE(run_check(b, 4));
}
// Non contiguous copies
{
Kokkos::deep_copy(s_a, 5);
ASSERT_TRUE(run_check(s_a, 5));
}
{
Kokkos::deep_copy(hs_a, 6);
ASSERT_TRUE(run_check(hs_a, 6));
}
{
Kokkos::deep_copy(s_b, s_a);
ASSERT_TRUE(run_check(s_b, 5));
}
{
Kokkos::deep_copy(hs_b, hs_a);
ASSERT_TRUE(run_check(hs_b, 6));
}
if (DevExecCanAccessHost || HostExecCanAccessDev) {
{
Kokkos::deep_copy(hs_b, s_b);
ASSERT_TRUE(run_check(hs_b, 5));
}
{
Kokkos::deep_copy(s_a, hs_a);
ASSERT_TRUE(run_check(s_a, 6));
}
}
// Contiguous copies
{ Kokkos::deep_copy(dev, defaulted, defaulted); }
{
Kokkos::deep_copy(dev, a, 1);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(dev, a, a);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(dev, m_a, a);
ASSERT_TRUE(run_check(m_a, 1));
}
{
Kokkos::deep_copy(dev, m_a, 2);
ASSERT_TRUE(run_check(m_a, 2));
}
{
Kokkos::deep_copy(dev, a, m_a);
ASSERT_TRUE(run_check(a, 2));
}
{
Kokkos::deep_copy(dev, b, 3);
ASSERT_TRUE(run_check(b, 3));
}
{
Kokkos::deep_copy(dev, h_a, 4);
ASSERT_TRUE(run_check(h_a, 4));
}
{
Kokkos::deep_copy(dev, a, b);
ASSERT_TRUE(run_check(a, 3));
}
{
Kokkos::deep_copy(dev, h_b, h_a);
ASSERT_TRUE(run_check(h_b, 4));
}
{
Kokkos::deep_copy(dev, h_a, a);
ASSERT_TRUE(run_check(h_a, 3));
}
{
Kokkos::deep_copy(dev, b, h_b);
ASSERT_TRUE(run_check(b, 4));
}
// Non contiguous copies
{
Kokkos::deep_copy(dev, s_a, 5);
ASSERT_TRUE(run_check(s_a, 5));
}
{
Kokkos::deep_copy(dev, hs_a, 6);
ASSERT_TRUE(run_check(hs_a, 6));
}
{
Kokkos::deep_copy(dev, s_b, s_a);
ASSERT_TRUE(run_check(s_b, 5));
}
{
Kokkos::deep_copy(dev, hs_b, hs_a);
ASSERT_TRUE(run_check(hs_b, 6));
}
if (DevExecCanAccessHost || HostExecCanAccessDev) {
{
Kokkos::deep_copy(dev, hs_b, s_b);
ASSERT_TRUE(run_check(hs_b, 5));
}
{
Kokkos::deep_copy(dev, s_a, hs_a);
ASSERT_TRUE(run_check(s_a, 6));
}
}
// Contiguous copies
{ Kokkos::deep_copy(host, defaulted, defaulted); }
{
Kokkos::deep_copy(host, a, 1);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(host, a, a);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(host, m_a, a);
ASSERT_TRUE(run_check(m_a, 1));
}
{
Kokkos::deep_copy(host, m_a, 2);
ASSERT_TRUE(run_check(m_a, 2));
}
{
Kokkos::deep_copy(host, a, m_a);
ASSERT_TRUE(run_check(a, 2));
}
{
Kokkos::deep_copy(host, b, 3);
ASSERT_TRUE(run_check(b, 3));
}
{
Kokkos::deep_copy(host, h_a, 4);
ASSERT_TRUE(run_check(h_a, 4));
}
{
Kokkos::deep_copy(host, a, b);
ASSERT_TRUE(run_check(a, 3));
}
{
Kokkos::deep_copy(host, h_b, h_a);
ASSERT_TRUE(run_check(h_b, 4));
}
{
Kokkos::deep_copy(host, h_a, a);
ASSERT_TRUE(run_check(h_a, 3));
}
{
Kokkos::deep_copy(host, b, h_b);
ASSERT_TRUE(run_check(b, 4));
}
// Non contiguous copies
{
Kokkos::deep_copy(host, s_a, 5);
ASSERT_TRUE(run_check(s_a, 5));
}
{
Kokkos::deep_copy(host, hs_a, 6);
ASSERT_TRUE(run_check(hs_a, 6));
}
{
Kokkos::deep_copy(host, s_b, s_a);
ASSERT_TRUE(run_check(s_b, 5));
}
{
Kokkos::deep_copy(host, hs_b, hs_a);
ASSERT_TRUE(run_check(hs_b, 6));
}
if (DevExecCanAccessHost || HostExecCanAccessDev) {
{
Kokkos::deep_copy(host, hs_b, s_b);
ASSERT_TRUE(run_check(hs_b, 5));
}
{
Kokkos::deep_copy(host, s_a, hs_a);
ASSERT_TRUE(run_check(s_a, 6));
}
}
}
TEST(TEST_CATEGORY, view_copy_tests_rank_0) {
Kokkos::View<int, TEST_EXECSPACE> defaulted;
Kokkos::View<int, TEST_EXECSPACE> a("A");
Kokkos::View<int, TEST_EXECSPACE> b("B");
auto h_a = Kokkos::create_mirror(a);
auto h_b = Kokkos::create_mirror(b);
auto m_a = Kokkos::create_mirror_view(a);
auto dev = typename TEST_EXECSPACE::execution_space();
auto host = Kokkos::DefaultHostExecutionSpace();
// No execution space
{ Kokkos::deep_copy(defaulted, defaulted); }
{
Kokkos::deep_copy(a, 1);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(a, a);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(m_a, a);
ASSERT_TRUE(run_check(m_a, 1));
}
{
Kokkos::deep_copy(m_a, 2);
ASSERT_TRUE(run_check(m_a, 2));
}
{
Kokkos::deep_copy(a, m_a);
ASSERT_TRUE(run_check(a, 2));
}
{
Kokkos::deep_copy(b, 3);
ASSERT_TRUE(run_check(b, 3));
}
{
Kokkos::deep_copy(h_a, 4);
ASSERT_TRUE(run_check(h_a, 4));
}
{
Kokkos::deep_copy(a, b);
ASSERT_TRUE(run_check(a, 3));
}
{
Kokkos::deep_copy(h_b, h_a);
ASSERT_TRUE(run_check(h_b, 4));
}
{
Kokkos::deep_copy(h_a, a);
ASSERT_TRUE(run_check(h_a, 3));
}
{
Kokkos::deep_copy(b, h_b);
ASSERT_TRUE(run_check(b, 4));
}
// Device
{ Kokkos::deep_copy(dev, defaulted, defaulted); }
{
Kokkos::deep_copy(dev, a, 1);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(dev, a, a);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(dev, m_a, a);
ASSERT_TRUE(run_check(m_a, 1));
}
{
Kokkos::deep_copy(dev, m_a, 2);
ASSERT_TRUE(run_check(m_a, 2));
}
{
Kokkos::deep_copy(dev, a, m_a);
ASSERT_TRUE(run_check(a, 2));
}
{
Kokkos::deep_copy(dev, b, 3);
ASSERT_TRUE(run_check(b, 3));
}
{
Kokkos::deep_copy(dev, h_a, 4);
ASSERT_TRUE(run_check(h_a, 4));
}
{
Kokkos::deep_copy(dev, a, b);
ASSERT_TRUE(run_check(a, 3));
}
{
Kokkos::deep_copy(dev, h_b, h_a);
ASSERT_TRUE(run_check(h_b, 4));
}
{
Kokkos::deep_copy(dev, h_a, a);
ASSERT_TRUE(run_check(h_a, 3));
}
{
Kokkos::deep_copy(dev, b, h_b);
ASSERT_TRUE(run_check(b, 4));
}
// Host
{ Kokkos::deep_copy(host, defaulted, defaulted); }
{
Kokkos::deep_copy(host, a, 1);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(host, a, a);
ASSERT_TRUE(run_check(a, 1));
}
{
Kokkos::deep_copy(host, m_a, a);
ASSERT_TRUE(run_check(m_a, 1));
}
{
Kokkos::deep_copy(host, m_a, 2);
ASSERT_TRUE(run_check(m_a, 2));
}
{
Kokkos::deep_copy(host, a, m_a);
ASSERT_TRUE(run_check(a, 2));
}
{
Kokkos::deep_copy(host, b, 3);
ASSERT_TRUE(run_check(b, 3));
}
{
Kokkos::deep_copy(host, h_a, 4);
ASSERT_TRUE(run_check(h_a, 4));
}
{
Kokkos::deep_copy(host, a, b);
ASSERT_TRUE(run_check(a, 3));
}
{
Kokkos::deep_copy(host, h_b, h_a);
ASSERT_TRUE(run_check(h_b, 4));
}
{
Kokkos::deep_copy(host, h_a, a);
ASSERT_TRUE(run_check(h_a, 3));
}
{
Kokkos::deep_copy(host, b, h_b);
ASSERT_TRUE(run_check(b, 4));
}
}
TEST(TEST_CATEGORY, view_copy_degenerated) {
// Only include this file to be compiled with CudaUVM and CudaHostPinned
Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v_um_def_1;
Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v_um_1(
reinterpret_cast<int*>(-1), 0);
Kokkos::View<int*> v_m_def_1;
Kokkos::View<int*> v_m_1("v_m_1", 0);
Kokkos::View<int*, TEST_EXECSPACE, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
v_um_def_1;
Kokkos::View<int*, TEST_EXECSPACE, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
v_um_1(reinterpret_cast<int*>(-1), 0);
Kokkos::View<int*, TEST_EXECSPACE> v_m_def_1;
Kokkos::View<int*, TEST_EXECSPACE> v_m_1("v_m_1", 0);
Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v_um_def_2;
Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v_um_2(
reinterpret_cast<int*>(-1), 0);
Kokkos::View<int*> v_m_def_2;
Kokkos::View<int*> v_m_2("v_m_2", 0);
Kokkos::View<int*, TEST_EXECSPACE, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
v_um_def_2;
Kokkos::View<int*, TEST_EXECSPACE, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
v_um_2(reinterpret_cast<int*>(-1), 0);
Kokkos::View<int*, TEST_EXECSPACE> v_m_def_2;
Kokkos::View<int*, TEST_EXECSPACE> v_m_2("v_m_2", 0);
Kokkos::deep_copy(v_um_def_1, v_um_def_2);
Kokkos::deep_copy(v_um_def_1, v_um_2);

View File

@ -0,0 +1,145 @@
#include <Kokkos_Core.hpp>
namespace Test {
namespace Impl {
template <class ViewTypeDst, class ViewTypeSrc>
struct TestAssignability {
using mapping_type =
Kokkos::Impl::ViewMapping<typename ViewTypeDst::traits,
typename ViewTypeSrc::traits,
typename ViewTypeDst::specialize>;
template <class MappingType>
static void try_assign(
ViewTypeDst& dst, ViewTypeSrc& src,
typename std::enable_if<MappingType::is_assignable>::type* = nullptr) {
dst = src;
}
template <class MappingType>
static void try_assign(
ViewTypeDst&, ViewTypeSrc&,
typename std::enable_if<!MappingType::is_assignable>::type* = nullptr) {
Kokkos::Impl::throw_runtime_exception(
"TestAssignability::try_assign: Unexpected call path");
}
template <class... Dimensions>
static void test(bool always, bool sometimes, Dimensions... dims) {
ViewTypeDst dst;
ViewTypeSrc src("SRC", dims...);
bool is_always_assignable =
Kokkos::is_always_assignable<ViewTypeDst, ViewTypeSrc>::value;
bool is_assignable = Kokkos::is_assignable(dst, src);
// Print out if there is an error with typeid so you can just filter the
// output with c++filt -t to see which assignment causes the error.
if (is_always_assignable != always || is_assignable != sometimes)
printf(
"is_always_assignable: %i (%i), is_assignable: %i (%i) [ %s ] to [ "
"%s ]\n",
is_always_assignable ? 1 : 0, always ? 1 : 0, is_assignable ? 1 : 0,
sometimes ? 1 : 0, typeid(ViewTypeSrc).name(),
typeid(ViewTypeDst).name());
if (sometimes) {
ASSERT_NO_THROW(try_assign<mapping_type>(dst, src));
}
ASSERT_EQ(always, is_always_assignable);
ASSERT_EQ(sometimes, is_assignable);
}
};
} // namespace Impl
TEST(TEST_CATEGORY, view_is_assignable) {
using namespace Kokkos;
using h_exec = typename DefaultHostExecutionSpace::memory_space;
using d_exec = typename TEST_EXECSPACE::memory_space;
using left = LayoutLeft;
using right = LayoutRight;
using stride = LayoutStride;
// Static/Dynamic Extents
Impl::TestAssignability<View<int*, left, d_exec>,
View<int*, left, d_exec>>::test(true, true, 10);
Impl::TestAssignability<View<int[10], left, d_exec>,
View<int*, left, d_exec>>::test(false, true, 10);
Impl::TestAssignability<View<int[5], left, d_exec>,
View<int*, left, d_exec>>::test(false, false, 10);
Impl::TestAssignability<View<int*, left, d_exec>,
View<int[10], left, d_exec>>::test(true, true);
Impl::TestAssignability<View<int[10], left, d_exec>,
View<int[10], left, d_exec>>::test(true, true);
Impl::TestAssignability<View<int[5], left, d_exec>,
View<int[10], left, d_exec>>::test(false, false);
Impl::TestAssignability<View<int**, left, d_exec>,
View<int**, left, d_exec>>::test(true, true, 10, 10);
Impl::TestAssignability<View<int * [10], left, d_exec>,
View<int**, left, d_exec>>::test(false, true, 10, 10);
Impl::TestAssignability<View<int * [5], left, d_exec>,
View<int**, left, d_exec>>::test(false, false, 10,
10);
Impl::TestAssignability<View<int**, left, d_exec>,
View<int * [10], left, d_exec>>::test(true, true, 10);
Impl::TestAssignability<View<int * [10], left, d_exec>,
View<int * [10], left, d_exec>>::test(true, true, 10);
Impl::TestAssignability<View<int * [5], left, d_exec>,
View<int * [10], left, d_exec>>::test(false, false,
10);
// Mismatch value_type
Impl::TestAssignability<View<int*, left, d_exec>,
View<double*, left, d_exec>>::test(false, false, 10);
// Layout assignment
Impl::TestAssignability<View<int*, left, d_exec>,
View<int*, right, d_exec>>::test(true, true, 10);
// This could be made possible (due to the degenerate nature of the views) but
// we do not allow this yet
// TestAssignability<View<int**,left,d_exec>,View<int**,right,d_exec>>::test(false,true,10,1);
Impl::TestAssignability<View<int**, left, d_exec>,
View<int**, right, d_exec>>::test(false, false, 10,
2);
Impl::TestAssignability<View<int**, stride, d_exec>,
View<int**, right, d_exec>>::test(true, true, 10, 2);
Impl::TestAssignability<View<int**, stride, d_exec>,
View<int**, left, d_exec>>::test(true, true, 10, 2);
// Space Assignment
bool expected = Kokkos::Impl::MemorySpaceAccess<d_exec, h_exec>::assignable;
Impl::TestAssignability<View<int*, left, d_exec>,
View<int*, left, h_exec>>::test(expected, expected,
10);
expected = Kokkos::Impl::MemorySpaceAccess<h_exec, d_exec>::assignable;
Impl::TestAssignability<View<int*, left, h_exec>,
View<int*, left, d_exec>>::test(expected, expected,
10);
// reference type and const-qualified types
using SomeViewType = View<int*, left, d_exec>;
#if defined(KOKKOS_ENABLE_CXX17)
static_assert(is_always_assignable_v<SomeViewType, SomeViewType>);
static_assert(is_always_assignable_v<SomeViewType, SomeViewType&>);
static_assert(is_always_assignable_v<SomeViewType, SomeViewType const>);
static_assert(is_always_assignable_v<SomeViewType, SomeViewType const&>);
static_assert(is_always_assignable_v<SomeViewType&, SomeViewType>);
static_assert(is_always_assignable_v<SomeViewType&, SomeViewType&>);
static_assert(is_always_assignable_v<SomeViewType&, SomeViewType const>);
static_assert(is_always_assignable_v<SomeViewType&, SomeViewType const&>);
#else
static_assert(is_always_assignable<SomeViewType, SomeViewType>::value, "");
static_assert(is_always_assignable<SomeViewType, SomeViewType&>::value, "");
static_assert(is_always_assignable<SomeViewType, SomeViewType const>::value,
"");
static_assert(is_always_assignable<SomeViewType, SomeViewType const&>::value,
"");
static_assert(is_always_assignable<SomeViewType&, SomeViewType>::value, "");
static_assert(is_always_assignable<SomeViewType&, SomeViewType&>::value, "");
static_assert(is_always_assignable<SomeViewType&, SomeViewType const>::value,
"");
static_assert(is_always_assignable<SomeViewType&, SomeViewType const&>::value,
"");
#endif
}
} // namespace Test

View File

@ -56,7 +56,7 @@ namespace Test {
TEST(TEST_CATEGORY, view_layoutstride_left_to_layoutleft_assignment) {
typedef TEST_EXECSPACE exec_space;
auto t = time(0);
auto t = time(nullptr);
srand(t); // Use current time as seed for random generator
printf("view_layoutstride_left_to_layoutleft_assignment: srand(%lu)\n",
size_t(t));
@ -338,7 +338,7 @@ TEST(TEST_CATEGORY, view_layoutstride_left_to_layoutleft_assignment) {
TEST(TEST_CATEGORY, view_layoutstride_right_to_layoutright_assignment) {
typedef TEST_EXECSPACE exec_space;
auto t = time(0);
auto t = time(nullptr);
srand(t); // Use current time as seed for random generator
printf("view_layoutstride_right_to_layoutright_assignment: srand(%lu)\n",
size_t(t));
@ -620,7 +620,7 @@ TEST(TEST_CATEGORY, view_layoutstride_right_to_layoutright_assignment) {
TEST(TEST_CATEGORY_DEATH, view_layoutstride_right_to_layoutleft_assignment) {
typedef TEST_EXECSPACE exec_space;
auto t = time(0);
auto t = time(nullptr);
srand(t); // Use current time as seed for random generator
printf("view_layoutstride_right_to_layoutleft_assignment: srand(%lu)\n",
size_t(t));
@ -771,7 +771,7 @@ TEST(TEST_CATEGORY_DEATH, view_layoutstride_right_to_layoutleft_assignment) {
TEST(TEST_CATEGORY_DEATH, view_layoutstride_left_to_layoutright_assignment) {
typedef TEST_EXECSPACE exec_space;
auto t = time(0);
auto t = time(nullptr);
srand(t); // Use current time as seed for random generator
printf("view_layoutstride_left_to_layoutright_assignment: srand(%lu)\n",
size_t(t));

View File

@ -112,9 +112,10 @@ struct TestViewLayoutTiled {
Kokkos::Iterate::Right, Kokkos::Iterate::Right, T0, T1, T2, T3>
LayoutRR_4D_2x4x4x2;
#if !defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
static void test_view_layout_tiled_2d(const int, const int) {
#else
static void test_view_layout_tiled_2d(const int N0, const int N1) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
const int FT = T0 * T1;
const int NT0 = int(std::ceil(N0 / T0));
@ -382,15 +383,14 @@ struct TestViewLayoutTiled {
ASSERT_EQ(counter_subview, long(0));
ASSERT_EQ(counter_inc, long(0));
} // end scope
#endif
#endif
} // end test_view_layout_tiled_2d
#if !defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
static void test_view_layout_tiled_3d(const int, const int, const int) {
#else
static void test_view_layout_tiled_3d(const int N0, const int N1,
const int N2) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
const int FT = T0 * T1 * T2;
const int NT0 = int(std::ceil(N0 / T0));
@ -680,14 +680,15 @@ struct TestViewLayoutTiled {
ASSERT_EQ(counter_subview, long(0));
ASSERT_EQ(counter_inc, long(0));
} // end scope
#endif
#endif
} // end test_view_layout_tiled_3d
#if !defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
static void test_view_layout_tiled_4d(const int, const int, const int,
const int){
#else
static void test_view_layout_tiled_4d(const int N0, const int N1,
const int N2, const int N3) {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
const int FT = T0 * T1 * T2 * T3;
const int NT0 = int(std::ceil(N0 / T0));
@ -1027,7 +1028,6 @@ struct TestViewLayoutTiled {
ASSERT_EQ(counter_subview, long(0));
ASSERT_EQ(counter_inc, long(0));
} // end scope
#endif
#endif
} // end test_view_layout_tiled_4d

View File

@ -77,7 +77,9 @@ void test_view_mapping() {
typedef Kokkos::Impl::ViewDimension<0, 0, 0, 0, 0, 0, 0, 0>
dim_s0_s0_s0_s0_s0_s0_s0_s0;
// Fully static dimensions should not be larger than an int.
// Fully static dimensions should not be larger than an int.
#ifndef _WIN32 // For some reason on Windows the first test here fails with
// size being 7 bytes on windows???
ASSERT_LE(sizeof(dim_0), sizeof(int));
ASSERT_LE(sizeof(dim_s2), sizeof(int));
ASSERT_LE(sizeof(dim_s2_s3), sizeof(int));
@ -98,7 +100,7 @@ void test_view_mapping() {
ASSERT_EQ(sizeof(dim_s0_s0_s0_s0_s0_s0), 6 * sizeof(unsigned));
ASSERT_LE(sizeof(dim_s0_s0_s0_s0_s0_s0_s0), 8 * sizeof(unsigned));
ASSERT_EQ(sizeof(dim_s0_s0_s0_s0_s0_s0_s0_s0), 8 * sizeof(unsigned));
#endif
static_assert(int(dim_0::rank) == int(0), "");
static_assert(int(dim_0::rank_dynamic) == int(0), "");
static_assert(int(dim_0::ArgN0) == 1, "");
@ -900,7 +902,7 @@ void test_view_mapping() {
ASSERT_TRUE(offset.span_is_contiguous());
Kokkos::Impl::ViewMapping<traits_t, void> v(
Kokkos::Impl::ViewCtorProp<int*>((int*)0), stride);
Kokkos::Impl::ViewCtorProp<int*>(nullptr), stride);
}
{
@ -1076,17 +1078,20 @@ void test_view_mapping() {
typedef typename Kokkos::Impl::HostMirror<Space>::Space::execution_space
host_exec_space;
Kokkos::parallel_for(
Kokkos::RangePolicy<host_exec_space>(0, 10), KOKKOS_LAMBDA(int) {
// 'a' is captured by copy, and the capture mechanism converts 'a' to
int errors = 0;
Kokkos::parallel_reduce(
Kokkos::RangePolicy<host_exec_space>(0, 10),
KOKKOS_LAMBDA(int, int& e) {
// an unmanaged copy. When the parallel dispatch accepts a move for
// the lambda, this count should become 1.
ASSERT_EQ(a.use_count(), 2);
if (a.use_count() != 2) ++e;
V x = a;
ASSERT_EQ(a.use_count(), 2);
ASSERT_EQ(x.use_count(), 2);
});
if (a.use_count() != 2) ++e;
if (x.use_count() != 2) ++e;
},
errors);
ASSERT_EQ(errors, 0);
#endif // #if !defined( KOKKOS_ENABLE_CUDA_LAMBDA )
}
}
@ -1106,7 +1111,7 @@ struct TestViewMapOperator {
#endif
KOKKOS_INLINE_FUNCTION
void test_left(size_t i0, long& error_count) const {
void test_left(size_t i0, int64_t& error_count) const {
#ifdef KOKKOS_ENABLE_DEPPRECATED_CODE
typename ViewType::value_type* const base_ptr = &v(0, 0, 0, 0, 0, 0, 0, 0);
#else
@ -1121,7 +1126,7 @@ struct TestViewMapOperator {
const size_t n6 = v.extent(6);
const size_t n7 = v.extent(7);
long offset = 0;
int64_t offset = 0;
for (size_t i7 = 0; i7 < n7; ++i7)
for (size_t i6 = 0; i6 < n6; ++i6)
@ -1131,9 +1136,10 @@ struct TestViewMapOperator {
for (size_t i2 = 0; i2 < n2; ++i2)
for (size_t i1 = 0; i1 < n1; ++i1) {
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
const long d = &v(i0, i1, i2, i3, i4, i5, i6, i7) - base_ptr;
const int64_t d =
&v(i0, i1, i2, i3, i4, i5, i6, i7) - base_ptr;
#else
const long d =
const int64_t d =
&v.access(i0, i1, i2, i3, i4, i5, i6, i7) - base_ptr;
#endif
if (d < offset) ++error_count;
@ -1144,7 +1150,7 @@ struct TestViewMapOperator {
}
KOKKOS_INLINE_FUNCTION
void test_right(size_t i0, long& error_count) const {
void test_right(size_t i0, int64_t& error_count) const {
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
typename ViewType::value_type* const base_ptr = &v(0, 0, 0, 0, 0, 0, 0, 0);
#else
@ -1159,7 +1165,7 @@ struct TestViewMapOperator {
const size_t n6 = v.extent(6);
const size_t n7 = v.extent(7);
long offset = 0;
int64_t offset = 0;
for (size_t i1 = 0; i1 < n1; ++i1)
for (size_t i2 = 0; i2 < n2; ++i2)
@ -1169,9 +1175,10 @@ struct TestViewMapOperator {
for (size_t i6 = 0; i6 < n6; ++i6)
for (size_t i7 = 0; i7 < n7; ++i7) {
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
const long d = &v(i0, i1, i2, i3, i4, i5, i6, i7) - base_ptr;
const int64_t d =
&v(i0, i1, i2, i3, i4, i5, i6, i7) - base_ptr;
#else
const long d =
const int64_t d =
&v.access(i0, i1, i2, i3, i4, i5, i6, i7) - base_ptr;
#endif
if (d < offset) ++error_count;
@ -1182,7 +1189,7 @@ struct TestViewMapOperator {
}
KOKKOS_INLINE_FUNCTION
void operator()(size_t i, long& error_count) const {
void operator()(size_t i, int64_t& error_count) const {
if (std::is_same<typename ViewType::array_layout,
Kokkos::LayoutLeft>::value) {
test_left(i, error_count);
@ -1245,7 +1252,7 @@ struct TestViewMapOperator {
v.extent(4) * v.extent(5) * v.extent(6) * v.extent(7),
v.span());
long error_count;
int64_t error_count;
Kokkos::RangePolicy<typename ViewType::execution_space> range(0,
v.extent(0));
Kokkos::parallel_reduce(range, *this, error_count);

View File

@ -55,7 +55,7 @@ void test_64bit() {
Kokkos::parallel_reduce(
Kokkos::RangePolicy<typename Device::execution_space,
Kokkos::IndexType<int64_t>>(0, N),
KOKKOS_LAMBDA(const int64_t& i, int64_t& lsum) { lsum += 1; }, sum);
KOKKOS_LAMBDA(const int64_t& /*i*/, int64_t& lsum) { lsum += 1; }, sum);
ASSERT_EQ(N, sum);
}
{

View File

@ -8,7 +8,7 @@ KOKKOS_ARCH_OPTIONS="None AMDAVX ARMv80 ARMv81 ARMv8-ThunderX \
Maxwell Maxwell50 Maxwell52 Maxwell53 Pascal60 Pascal61"
#KOKKOS_ARCH_OPTIONS="AMDAVX"
KOKKOS_DEVICE_OPTIONS="Cuda ROCm OpenMP Pthread Serial Qthreads"
KOKKOS_DEVICE_OPTIONS="Cuda ROCm OpenMP Pthread Serial"
#KOKKOS_DEVICE_OPTIONS="Cuda"
# Configure paths to enable environment query in Makefile.kokkos to work

View File

@ -56,20 +56,20 @@ foreach(KOKKOS_HOST_ARCH ${KOKKOS_HOST_ARCH_LIST})
set(NEWCONFH ${PREFIX}${KOKKOS_CONFIG_HEADER})
file(RENAME ${KOKKOS_CMAKEFILE} ${NEWCMAKE})
file(RENAME ${KOKKOS_CONFIG_HEADER} ${NEWCONFH})
add_test(NAME ${NEWCMAKE}-test
add_test(NAME ${NEWCMAKE}-test
COMMAND ${KOKKOS_TESTDIR}/testmake.sh ${NEWCMAKE} ${KOKKOS_HOST_ARCH} ${KOKKOS_DEV}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set_tests_properties(${NEWCMAKE}-test
set_tests_properties(${NEWCMAKE}-test
PROPERTIES PASS_REGULAR_EXPRESSION Passed
TIMEOUT 15
)
add_test(NAME ${NEWCONFH}-test
COMMAND ${KOKKOS_TESTDIR}/diffconfig.sh ${NEWCONFH}
add_test(NAME ${NEWCONFH}-test
COMMAND ${KOKKOS_TESTDIR}/diffconfig.sh ${NEWCONFH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set_tests_properties(${NEWCONFH}-test
set_tests_properties(${NEWCONFH}-test
PROPERTIES PASS_REGULAR_EXPRESSION Passed
TIMEOUT 15
)

View File

@ -1,17 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:11 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_AVX 1

View File

@ -1,18 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:20 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_ARMV80 1
#define KOKKOS_ARCH_ARMV8_THUNDERX 1

View File

@ -1,17 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:14 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_ARMV80 1

View File

@ -1,17 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:17 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_ARMV81 1

View File

@ -1,23 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:39 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_ENABLE_TM
#endif
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_X86_64
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_AVX2 1

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Tue Sep 26 15:19:44 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:36 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_X86_64
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_AVX2 1

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:45 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_KNC
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_KNC 1

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:48 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_X86_64
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_AVX512MIC 1

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:50 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:53 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:55 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:59 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Tue Sep 26 15:19:51 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:23:02 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:23:05 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:23:08 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Tue Sep 26 15:20:01 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Tue Sep 26 15:19:23 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:23:10 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,16 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:23:13 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:22 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_POWERPCBE
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_POWER7 1

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:25 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_POWERPCLE
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_POWER8 1

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:28 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_POWERPCLE
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_POWER9 1

View File

@ -1,23 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:42 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_ENABLE_TM
#endif
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_X86_64
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_AVX512XEON 1

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:34 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_X86_64
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_AVX 1

View File

@ -1,20 +0,0 @@
/* ---------------------------------------------
Makefile constructed configuration:
Fri Sep 22 17:22:31 MDT 2017
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
#else
#define KOKKOS_CORE_CONFIG_H
#endif
/* Execution Spaces */
#define KOKKOS_HAVE_QTHREADS 1
#ifndef __CUDA_ARCH__
#define KOKKOS_USE_ISA_X86_64
#endif
/* General Settings */
#define KOKKOS_HAVE_CXX11 1
#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
#define KOKKOS_ARCH_SSE42 1

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <cuda/TestCuda_Category.hpp>
#include <TestConcepts.hpp>

View File

@ -43,6 +43,4 @@
*/
#include <cuda/TestCuda_Category.hpp>
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#include <TestDeepCopy.hpp>
#endif

View File

@ -0,0 +1,47 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <cuda/TestCuda_Category.hpp>
#include <TestRangeRequire.hpp>

View File

@ -280,73 +280,6 @@ TEST(cuda, uvm) {
}
}
/* Removing UVM Allocs Test due to added time to complete overall unit test
* The issue verified with this unit test appears to no longer be an
* problem. Refer to github issue 1880 for more details
*
TEST( cuda, uvm_num_allocs )
{
// The max number of UVM allocations allowed is 65536.
#define MAX_NUM_ALLOCS 65536
if ( Kokkos::CudaUVMSpace::available() ) {
struct TestMaxUVMAllocs {
using view_type = Kokkos::View< double*, Kokkos::CudaUVMSpace >;
using view_of_view_type = Kokkos::View< view_type[ MAX_NUM_ALLOCS ]
, Kokkos::CudaUVMSpace >;
TestMaxUVMAllocs() : view_allocs_test( "view_allocs_test" )
{
for ( auto i = 0; i < MAX_NUM_ALLOCS; ++i ) {
// Kokkos will throw a runtime exception if an attempt is made to
// allocate more than the maximum number of uvm allocations.
// In this test, the max num of allocs occurs when i = MAX_NUM_ALLOCS
- 1
// since the 'outer' view counts as one UVM allocation, leaving
// 65535 possible UVM allocations, that is 'i in [0, 65535)'.
// The test will catch the exception thrown in this case and continue.
if ( i == ( MAX_NUM_ALLOCS - 1 ) ) {
EXPECT_ANY_THROW( { view_allocs_test( i ) = view_type( "inner_view",
1 ); } );
}
else {
if ( i < MAX_NUM_ALLOCS - 1000 ) {
EXPECT_NO_THROW( { view_allocs_test( i ) = view_type(
"inner_view", 1 ); } ); } else { // This might or might not throw depending on
compilation options. try { view_allocs_test( i ) = view_type( "inner_view", 1 );
}
catch ( ... ) {}
}
}
} // End allocation for loop.
for ( auto i = 0; i < MAX_NUM_ALLOCS - 1; ++i ) {
view_allocs_test( i ) = view_type();
} // End deallocation for loop.
view_allocs_test = view_of_view_type(); // Deallocate the view of views.
}
// Member.
view_of_view_type view_allocs_test;
};
// Trigger the test via the TestMaxUVMAllocs constructor.
TestMaxUVMAllocs();
}
#undef MAX_NUM_ALLOCS
}
*/
template <class MemSpace, class ExecSpace>
struct TestViewCudaAccessible {
enum { N = 1000 };

View File

@ -79,26 +79,100 @@ TEST(TEST_CATEGORY, team_reduce) {
Kokkos::Schedule<Kokkos::Dynamic> >::test_reduce(1000);
}
TEST(TEST_CATEGORY, team_broadcast) {
TestTeamBroadcast<TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast(0);
TestTeamBroadcast<TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast(0);
TEST(TEST_CATEGORY, team_broadcast_long) {
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
long>::test_teambroadcast(0, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
long>::test_teambroadcast(0, 1);
TestTeamBroadcast<TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast(2);
TestTeamBroadcast<TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast(2);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
long>::test_teambroadcast(2, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
long>::test_teambroadcast(2, 1);
TestTeamBroadcast<TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast(16);
TestTeamBroadcast<TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast(16);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
long>::test_teambroadcast(16, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
long>::test_teambroadcast(16, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::
test_teambroadcast(1000);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::
test_teambroadcast(1000);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, long
// >::
// test_teambroadcast(1000, 1);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>, long
// >::
// test_teambroadcast(1000, 1);
}
TEST(TEST_CATEGORY, team_broadcast_char) {
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
unsigned char>::test_teambroadcast(0, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
unsigned char>::test_teambroadcast(0, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
unsigned char>::test_teambroadcast(2, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
unsigned char>::test_teambroadcast(2, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
unsigned char>::test_teambroadcast(16, 1);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
unsigned char>::test_teambroadcast(16, 1);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, long
// >::
// test_teambroadcast(1000, 1);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>, long
// >::
// test_teambroadcast(1000, 1);
}
TEST(TEST_CATEGORY, team_broadcast_float) {
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
float>::test_teambroadcast(0, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
float>::test_teambroadcast(0, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
float>::test_teambroadcast(2, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
float>::test_teambroadcast(2, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
float>::test_teambroadcast(16, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
float>::test_teambroadcast(16, 1.3);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, float
// >::
// test_teambroadcast(1000, 1.3);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>, float
// >::
// test_teambroadcast(1000, 1.3);
}
TEST(TEST_CATEGORY, team_broadcast_double) {
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
double>::test_teambroadcast(0, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
double>::test_teambroadcast(0, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
double>::test_teambroadcast(2, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
double>::test_teambroadcast(2, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
double>::test_teambroadcast(16, 1.3);
TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
double>::test_teambroadcast(16, 1.3);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, double
// >::
// test_teambroadcast(1000, 1.3);
// TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic>,
// double >::
// test_teambroadcast(1000, 1.3);
}
} // namespace Test

View File

@ -58,7 +58,6 @@ TEST(TEST_CATEGORY, team_scratch_request) {
}
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if !defined(KOKKOS_ENABLE_CUDA) || (8000 <= CUDA_VERSION)
TEST(TEST_CATEGORY, team_lambda_shared_request) {
TestLambdaSharedTeam<Kokkos::HostSpace, TEST_EXECSPACE,
Kokkos::Schedule<Kokkos::Static> >();
@ -68,7 +67,6 @@ TEST(TEST_CATEGORY, team_lambda_shared_request) {
TEST(TEST_CATEGORY, scratch_align) { TestScratchAlignment<TEST_EXECSPACE>(); }
#endif
#endif
TEST(TEST_CATEGORY, shmem_size) { TestShmemSize<TEST_EXECSPACE>(); }

View File

@ -44,3 +44,4 @@
#include <cuda/TestCuda_Category.hpp>
#include <TestViewAPI_e.hpp>
#include <TestViewCopy.hpp>

View File

@ -61,7 +61,7 @@ TEST(defaultdevicetype, malloc) {
Kokkos::kokkos_free(data);
int* data2 = (int*)Kokkos::kokkos_malloc(0);
ASSERT_TRUE(data2 == NULL);
ASSERT_TRUE(data2 == nullptr);
Kokkos::kokkos_free(data2);
}

View File

@ -42,13 +42,12 @@
//@HEADER
*/
#ifndef KOKKOS_TEST_QTHREADS_HPP
#define KOKKOS_TEST_QTHREADS_HPP
#ifndef KOKKOS_TEST_HIPHOSTPINNED_HPP
#define KOKKOS_TEST_HIPHOSTPINNED_HPP
#include <gtest/gtest.h>
#define TEST_CATEGORY qthreads
#define TEST_CATEGORY_DEATH qthreads_DeathTest
#define TEST_EXECSPACE Kokkos::Qthreads
#define TEST_CATEGORY hip_hostpinned
#define TEST_EXECSPACE Kokkos::Experimental::HIPHostPinnedSpace
#endif

View File

@ -42,14 +42,13 @@
//@HEADER
*/
#include <qthreads/TestQthreads.hpp>
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestSharedAlloc.hpp>
namespace Test {
TEST_F(qthreads, view_subview_3d_from_5d_left) {
#if 0
TestViewSubview::test_3d_subview_5d_left< Kokkos::Qthreads >();
#endif
TEST(TEST_CATEGORY, impl_shared_alloc) {
test_shared_alloc<TEST_EXECSPACE, Kokkos::DefaultHostExecutionSpace>();
}
} // namespace Test

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewAPI_a.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewAPI_b.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewAPI_c.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewAPI_d.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewAPI_e.hpp>

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewCopy.hpp>

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewMapping_a.hpp>

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewMapping_b.hpp>

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIPHostPinned_Category.hpp>
#include <TestViewMapping_subview.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_complexdouble.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_complexfloat.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_double.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_float.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_int.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_longint.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_longlongint.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_unsignedint.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQqthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicOperations_unsignedlongint.hpp>

View File

@ -0,0 +1,47 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIP_Category.hpp>
#include <TestAtomicViews.hpp>

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIP_Category.hpp>
#include <TestAtomic.hpp>

View File

@ -0,0 +1,53 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#ifndef KOKKOS_TEST_HIP_HPP
#define KOKKOS_TEST_HIP_HPP
#include <gtest/gtest.h>
#define TEST_CATEGORY hip
#define TEST_EXECSPACE Kokkos::Experimental::HIP
#endif

View File

@ -0,0 +1,47 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIP_Category.hpp>
#include <TestComplex.hpp>

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIP_Category.hpp>
#include <TestConcepts.hpp>

View File

@ -0,0 +1,46 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <hip/TestHIP_Category.hpp>
#include <TestCrs.hpp>

View File

@ -42,5 +42,5 @@
//@HEADER
*/
#include <qthreads/TestQthreads_Category.hpp>
#include <hip/TestHIP_Category.hpp>
#include <TestDeepCopy.hpp>

Some files were not shown because too many files have changed in this diff Show More