Update Kokkos library in LAMMPS to v2.7.24
This commit is contained in:
@ -284,6 +284,7 @@ IF(Kokkos_ENABLE_Cuda)
|
||||
SOURCES
|
||||
UnitTestMainInit.cpp
|
||||
cuda/TestCudaHostPinned_SharedAlloc.cpp
|
||||
cuda/TestCudaHostPinned_ViewCopy.cpp
|
||||
cuda/TestCudaHostPinned_ViewAPI_a.cpp
|
||||
cuda/TestCudaHostPinned_ViewAPI_b.cpp
|
||||
cuda/TestCudaHostPinned_ViewAPI_c.cpp
|
||||
@ -293,6 +294,7 @@ IF(Kokkos_ENABLE_Cuda)
|
||||
cuda/TestCudaHostPinned_ViewMapping_b.cpp
|
||||
cuda/TestCudaHostPinned_ViewMapping_subview.cpp
|
||||
cuda/TestCudaUVM_SharedAlloc.cpp
|
||||
cuda/TestCudaUVM_ViewCopy.cpp
|
||||
cuda/TestCudaUVM_ViewAPI_a.cpp
|
||||
cuda/TestCudaUVM_ViewAPI_b.cpp
|
||||
cuda/TestCudaUVM_ViewAPI_c.cpp
|
||||
|
||||
@ -43,12 +43,12 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
|
||||
OBJ_CUDA += TestCuda_SharedAlloc.o TestCudaUVM_SharedAlloc.o TestCudaHostPinned_SharedAlloc.o
|
||||
OBJ_CUDA += TestCuda_RangePolicy.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_ViewMapping_a.o TestCuda_ViewMapping_b.o TestCuda_ViewMapping_subview.o
|
||||
OBJ_CUDA += TestCudaUVM_ViewAPI_a.o TestCudaUVM_ViewAPI_b.o TestCudaUVM_ViewAPI_c.o TestCudaUVM_ViewAPI_d.o TestCudaUVM_ViewAPI_e.o
|
||||
OBJ_CUDA += TestCuda_ViewMapping_a.o TestCuda_ViewMapping_b.o TestCuda_ViewMapping_subview.o TestCuda_ViewLayoutStrideAssignment.o
|
||||
OBJ_CUDA += TestCudaUVM_ViewCopy.o TestCudaUVM_ViewAPI_a.o TestCudaUVM_ViewAPI_b.o TestCudaUVM_ViewAPI_c.o TestCudaUVM_ViewAPI_d.o TestCudaUVM_ViewAPI_e.o
|
||||
OBJ_CUDA += TestCudaUVM_ViewMapping_a.o TestCudaUVM_ViewMapping_b.o TestCudaUVM_ViewMapping_subview.o
|
||||
OBJ_CUDA += TestCudaHostPinned_ViewAPI_a.o TestCudaHostPinned_ViewAPI_b.o TestCudaHostPinned_ViewAPI_c.o TestCudaHostPinned_ViewAPI_d.o TestCudaHostPinned_ViewAPI_e.o
|
||||
OBJ_CUDA += TestCudaHostPinned_ViewCopy.o TestCudaHostPinned_ViewAPI_a.o TestCudaHostPinned_ViewAPI_b.o TestCudaHostPinned_ViewAPI_c.o TestCudaHostPinned_ViewAPI_d.o TestCudaHostPinned_ViewAPI_e.o
|
||||
OBJ_CUDA += TestCudaHostPinned_ViewMapping_a.o TestCudaHostPinned_ViewMapping_b.o TestCudaHostPinned_ViewMapping_subview.o
|
||||
OBJ_CUDA += TestCuda_View_64bit.o
|
||||
OBJ_CUDA += TestCuda_View_64bit.o
|
||||
OBJ_CUDA += TestCuda_ViewOfClass.o
|
||||
OBJ_CUDA += TestCuda_SubView_a.o TestCuda_SubView_b.o
|
||||
OBJ_CUDA += TestCuda_SubView_c01.o TestCuda_SubView_c02.o TestCuda_SubView_c03.o
|
||||
@ -57,13 +57,14 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
|
||||
OBJ_CUDA += TestCuda_SubView_c10.o TestCuda_SubView_c11.o TestCuda_SubView_c12.o
|
||||
OBJ_CUDA += TestCuda_SubView_c13.o
|
||||
OBJ_CUDA += TestCuda_Reductions.o TestCuda_Scan.o
|
||||
OBJ_CUDA += TestCuda_Reductions_DeviceView.o
|
||||
OBJ_CUDA += TestCuda_Reducers_a.o TestCuda_Reducers_b.o TestCuda_Reducers_c.o TestCuda_Reducers_d.o
|
||||
OBJ_CUDA += TestCuda_Complex.o
|
||||
OBJ_CUDA += TestCuda_AtomicOperations_int.o TestCuda_AtomicOperations_unsignedint.o TestCuda_AtomicOperations_longint.o
|
||||
OBJ_CUDA += TestCuda_AtomicOperations_unsignedlongint.o TestCuda_AtomicOperations_longlongint.o TestCuda_AtomicOperations_double.o TestCuda_AtomicOperations_float.o
|
||||
OBJ_CUDA += TestCuda_AtomicViews.o TestCuda_Atomics.o
|
||||
OBJ_CUDA += TestCuda_Team.o TestCuda_TeamScratch.o
|
||||
OBJ_CUDA += TestCuda_TeamReductionScan.o
|
||||
OBJ_CUDA += TestCuda_TeamReductionScan.o TestCuda_TeamTeamSize.o
|
||||
OBJ_CUDA += TestCuda_Other.o
|
||||
OBJ_CUDA += TestCuda_MDRange_a.o TestCuda_MDRange_b.o TestCuda_MDRange_c.o TestCuda_MDRange_d.o TestCuda_MDRange_e.o
|
||||
OBJ_CUDA += TestCuda_Crs.o
|
||||
@ -84,13 +85,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ROCM), 1)
|
||||
OBJ_ROCM += TestROCm_AtomicOperations_int.o TestROCm_AtomicOperations_unsignedint.o TestROCm_AtomicOperations_longint.o
|
||||
OBJ_ROCM += TestROCm_AtomicOperations_unsignedlongint.o TestROCm_AtomicOperations_longlongint.o TestROCm_AtomicOperations_double.o TestROCm_AtomicOperations_float.o
|
||||
OBJ_ROCM += TestROCm_Atomics.o
|
||||
# complex failing
|
||||
OBJ_ROCM += TestROCm_AtomicViews.o
|
||||
OBJ_ROCM += TestROCm_Other.o
|
||||
# Compiles but runtime Segfaults:
|
||||
# OBJ_ROCM += TestROCm_MDRange_a.o TestROCm_MDRange_b.o TestROCm_MDRange_c.o TestROCm_MDRange_d.o TestROCm_MDRange_e.o
|
||||
# rocm.memory_pool
|
||||
OBJ_ROCM += TestROCm_Reductions.o
|
||||
OBJ_ROCM += TestROCm_MDRange_a.o TestROCm_MDRange_b.o TestROCm_MDRange_c.o TestROCm_MDRange_d.o TestROCm_MDRange_e.o
|
||||
OBJ_ROCM += TestROCm_MDRangeReduce_a.o TestROCm_MDRangeReduce_b.o TestROCm_MDRangeReduce_c.o TestROCm_MDRangeReduce_d.o TestROCm_MDRangeReduce_e.o
|
||||
OBJ_ROCM += TestROCm_Reductions.o
|
||||
OBJ_ROCM += TestROCm_Reducers_a.o TestROCm_Reducers_b.o TestROCm_Reducers_c.o TestROCm_Reducers_d.o
|
||||
OBJ_ROCM += TestROCm_Scan.o
|
||||
OBJ_ROCM += TestROCm_SharedAlloc.o
|
||||
@ -108,22 +107,22 @@ ifeq ($(KOKKOS_INTERNAL_USE_ROCM), 1)
|
||||
OBJ_ROCM += TestROCm_SubView_c10.o
|
||||
OBJ_ROCM += TestROCm_SubView_c11.o
|
||||
OBJ_ROCM += TestROCm_SubView_c12.o
|
||||
OBJ_ROCM += TestROCm_SubView_c13.o
|
||||
OBJ_ROCM += TestROCm_Team.o
|
||||
# compile fails / compiler segfaults
|
||||
#OBJ_ROCM += TestROCm_TeamReductionScan.o
|
||||
# compile fails
|
||||
OBJ_ROCM += TestROCm_TeamScratch.o
|
||||
OBJ_ROCM += TestROCm_TeamReductionScan.o
|
||||
OBJ_ROCM += TestROCm_TeamScratch.o TestROCm_TeamTeamSize.o
|
||||
OBJ_ROCM += TestROCm_ViewAPI_a.o TestROCm_ViewAPI_b.o TestROCm_ViewAPI_c.o TestROCm_ViewAPI_d.o TestROCm_ViewAPI_e.o
|
||||
OBJ_ROCM += TestROCm_ViewMapping_a.o
|
||||
OBJ_ROCM += TestROCm_ViewMapping_b.o
|
||||
OBJ_ROCM += TestROCm_ViewMapping_subview.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewAPI_a.o TestROCmHostPinned_ViewAPI_b.o TestROCmHostPinned_ViewAPI_c.o TestROCmHostPinned_ViewAPI_d.o TestROCmHostPinned_ViewAPI_e.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewCopy.o TestROCmHostPinned_ViewAPI_a.o TestROCmHostPinned_ViewAPI_b.o TestROCmHostPinned_ViewAPI_c.o TestROCmHostPinned_ViewAPI_d.o TestROCmHostPinned_ViewAPI_e.o
|
||||
OBJ_ROCM += TestROCmHostPinned_View_64bit.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewMapping_a.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewMapping_b.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewMapping_subview.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewMapping_a.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewMapping_b.o
|
||||
OBJ_ROCM += TestROCmHostPinned_ViewMapping_subview.o
|
||||
OBJ_ROCM += TestROCm_ViewOfClass.o
|
||||
OBJ_ROCM += TestROCm_Spaces.o
|
||||
OBJ_ROCM += TestROCm_Spaces.o
|
||||
OBJ_ROCM += TestROCm_Crs.o
|
||||
|
||||
TARGETS += KokkosCore_UnitTest_ROCm
|
||||
TEST_TARGETS += test-rocm
|
||||
@ -137,7 +136,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_PTHREADS), 1)
|
||||
OBJ_THREADS += TestThreads_RangePolicy.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_ViewMapping_a.o TestThreads_ViewMapping_b.o TestThreads_ViewMapping_subview.o
|
||||
OBJ_THREADS += TestThreads_ViewMapping_a.o TestThreads_ViewMapping_b.o TestThreads_ViewMapping_subview.o TestThreads_ViewLayoutStrideAssignment.o
|
||||
OBJ_THREADS += TestThreads_ViewOfClass.o
|
||||
OBJ_THREADS += TestThreads_SubView_a.o TestThreads_SubView_b.o
|
||||
OBJ_THREADS += TestThreads_SubView_c01.o TestThreads_SubView_c02.o TestThreads_SubView_c03.o
|
||||
@ -145,12 +144,13 @@ ifeq ($(KOKKOS_INTERNAL_USE_PTHREADS), 1)
|
||||
OBJ_THREADS += TestThreads_SubView_c07.o TestThreads_SubView_c08.o TestThreads_SubView_c09.o
|
||||
OBJ_THREADS += TestThreads_SubView_c10.o TestThreads_SubView_c11.o TestThreads_SubView_c12.o
|
||||
OBJ_THREADS += TestThreads_Reductions.o TestThreads_Scan.o
|
||||
OBJ_THREADS += TestThreads_Reductions_DeviceView.o
|
||||
OBJ_THREADS += TestThreads_Reducers_a.o TestThreads_Reducers_b.o TestThreads_Reducers_c.o TestThreads_Reducers_d.o
|
||||
OBJ_THREADS += TestThreads_Complex.o
|
||||
OBJ_THREADS += TestThreads_AtomicOperations_int.o TestThreads_AtomicOperations_unsignedint.o TestThreads_AtomicOperations_longint.o
|
||||
OBJ_THREADS += TestThreads_AtomicOperations_unsignedlongint.o TestThreads_AtomicOperations_longlongint.o TestThreads_AtomicOperations_double.o TestThreads_AtomicOperations_float.o
|
||||
OBJ_THREADS += TestThreads_AtomicViews.o TestThreads_Atomics.o
|
||||
OBJ_THREADS += TestThreads_Team.o TestThreads_TeamScratch.o
|
||||
OBJ_THREADS += TestThreads_Team.o TestThreads_TeamScratch.o TestThreads_TeamTeamSize.o
|
||||
OBJ_THREADS += TestThreads_TeamReductionScan.o
|
||||
OBJ_THREADS += TestThreads_Other.o
|
||||
OBJ_THREADS += TestThreads_MDRange_a.o TestThreads_MDRange_b.o TestThreads_MDRange_c.o TestThreads_MDRange_d.o TestThreads_MDRange_e.o
|
||||
@ -167,7 +167,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
|
||||
OBJ_OPENMP += TestOpenMP_RangePolicy.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_ViewMapping_a.o TestOpenMP_ViewMapping_b.o TestOpenMP_ViewMapping_subview.o
|
||||
OBJ_OPENMP += TestOpenMP_ViewMapping_a.o TestOpenMP_ViewMapping_b.o TestOpenMP_ViewMapping_subview.o TestOpenMP_ViewLayoutStrideAssignment.o
|
||||
OBJ_OPENMP += TestOpenMP_ViewOfClass.o
|
||||
OBJ_OPENMP += TestOpenMP_SubView_a.o TestOpenMP_SubView_b.o
|
||||
OBJ_OPENMP += TestOpenMP_SubView_c01.o TestOpenMP_SubView_c02.o TestOpenMP_SubView_c03.o
|
||||
@ -176,13 +176,14 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
|
||||
OBJ_OPENMP += TestOpenMP_SubView_c10.o TestOpenMP_SubView_c11.o TestOpenMP_SubView_c12.o
|
||||
OBJ_OPENMP += TestOpenMP_SubView_c13.o
|
||||
OBJ_OPENMP += TestOpenMP_Reductions.o TestOpenMP_Scan.o
|
||||
OBJ_OPENMP += TestOpenMP_Reductions_DeviceView.o
|
||||
OBJ_OPENMP += TestOpenMP_Reducers_a.o TestOpenMP_Reducers_b.o TestOpenMP_Reducers_c.o TestOpenMP_Reducers_d.o
|
||||
OBJ_OPENMP += TestOpenMP_Complex.o
|
||||
OBJ_OPENMP += TestOpenMP_AtomicOperations_int.o TestOpenMP_AtomicOperations_unsignedint.o TestOpenMP_AtomicOperations_longint.o
|
||||
OBJ_OPENMP += TestOpenMP_AtomicOperations_unsignedlongint.o TestOpenMP_AtomicOperations_longlongint.o TestOpenMP_AtomicOperations_double.o TestOpenMP_AtomicOperations_float.o
|
||||
OBJ_OPENMP += TestOpenMP_AtomicViews.o TestOpenMP_Atomics.o
|
||||
OBJ_OPENMP += TestOpenMP_Team.o TestOpenMP_TeamScratch.o
|
||||
OBJ_OPENMP += TestOpenMP_TeamReductionScan.o
|
||||
OBJ_OPENMP += TestOpenMP_TeamReductionScan.o TestOpenMP_TeamTeamSize.o
|
||||
OBJ_OPENMP += TestOpenMP_Other.o
|
||||
OBJ_OPENMP += TestOpenMP_MDRange_a.o TestOpenMP_MDRange_b.o TestOpenMP_MDRange_c.o TestOpenMP_MDRange_d.o TestOpenMP_MDRange_e.o
|
||||
OBJ_OPENMP += TestOpenMP_Crs.o
|
||||
@ -256,7 +257,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1)
|
||||
OBJ_SERIAL += TestSerial_RangePolicy.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_ViewMapping_a.o TestSerial_ViewMapping_b.o TestSerial_ViewMapping_subview.o
|
||||
OBJ_SERIAL += TestSerial_ViewMapping_a.o TestSerial_ViewMapping_b.o TestSerial_ViewMapping_subview.o TestSerial_ViewLayoutStrideAssignment.o
|
||||
OBJ_SERIAL += TestSerial_ViewOfClass.o
|
||||
OBJ_SERIAL += TestSerial_SubView_a.o TestSerial_SubView_b.o
|
||||
OBJ_SERIAL += TestSerial_SubView_c01.o TestSerial_SubView_c02.o TestSerial_SubView_c03.o
|
||||
@ -265,13 +266,14 @@ ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1)
|
||||
OBJ_SERIAL += TestSerial_SubView_c10.o TestSerial_SubView_c11.o TestSerial_SubView_c12.o
|
||||
OBJ_SERIAL += TestSerial_SubView_c13.o
|
||||
OBJ_SERIAL += TestSerial_Reductions.o TestSerial_Scan.o
|
||||
OBJ_SERIAL += TestSerial_Reductions_DeviceView.o
|
||||
OBJ_SERIAL += TestSerial_Reducers_a.o TestSerial_Reducers_b.o TestSerial_Reducers_c.o TestSerial_Reducers_d.o
|
||||
OBJ_SERIAL += TestSerial_Complex.o
|
||||
OBJ_SERIAL += TestSerial_AtomicOperations_int.o TestSerial_AtomicOperations_unsignedint.o TestSerial_AtomicOperations_longint.o
|
||||
OBJ_SERIAL += TestSerial_AtomicOperations_unsignedlongint.o TestSerial_AtomicOperations_longlongint.o TestSerial_AtomicOperations_double.o TestSerial_AtomicOperations_float.o
|
||||
OBJ_SERIAL += TestSerial_AtomicViews.o TestSerial_Atomics.o
|
||||
OBJ_SERIAL += TestSerial_Team.o TestSerial_TeamScratch.o
|
||||
OBJ_SERIAL += TestSerial_TeamReductionScan.o
|
||||
OBJ_SERIAL += TestSerial_TeamReductionScan.o TestSerial_TeamTeamSize.o
|
||||
OBJ_SERIAL += TestSerial_Other.o
|
||||
#HCC_WORKAROUND
|
||||
ifneq ($(KOKKOS_INTERNAL_COMPILER_HCC), 1)
|
||||
|
||||
@ -224,7 +224,8 @@ T AddLoop( int loop ) {
|
||||
|
||||
struct AddFunctorReduce< T, execution_space > f_add_red;
|
||||
f_add_red.data = data;
|
||||
Kokkos::parallel_reduce( loop, f_add_red );
|
||||
int dummy_result;
|
||||
Kokkos::parallel_reduce( loop, f_add_red , dummy_result );
|
||||
execution_space::fence();
|
||||
|
||||
return val;
|
||||
@ -309,7 +310,8 @@ T CASLoop( int loop ) {
|
||||
|
||||
struct CASFunctorReduce< T, execution_space > f_cas_red;
|
||||
f_cas_red.data = data;
|
||||
Kokkos::parallel_reduce( loop, f_cas_red );
|
||||
int dummy_result;
|
||||
Kokkos::parallel_reduce( loop, f_cas_red , dummy_result );
|
||||
execution_space::fence();
|
||||
|
||||
return val;
|
||||
@ -401,7 +403,8 @@ T ExchLoop( int loop ) {
|
||||
struct ExchFunctorReduce< T, execution_space > f_exch_red;
|
||||
f_exch_red.data = data;
|
||||
f_exch_red.data2 = data2;
|
||||
Kokkos::parallel_reduce( loop, f_exch_red );
|
||||
int dummy_result;
|
||||
Kokkos::parallel_reduce( loop, f_exch_red , dummy_result );
|
||||
execution_space::fence();
|
||||
|
||||
return val;
|
||||
@ -529,7 +532,7 @@ TEST_F( TEST_CATEGORY, atomics )
|
||||
ASSERT_TRUE( ( TestAtomic::Loop< float, TEST_EXECSPACE >( 100, 3 ) ) );
|
||||
|
||||
#ifndef KOKKOS_ENABLE_OPENMPTARGET
|
||||
#ifndef KOKKOS_ENABLE_ROCM
|
||||
#ifndef KOKKOS_ENABLE_ROCM // ROCM doesn't yet support atomics for >64bit types
|
||||
ASSERT_TRUE( ( TestAtomic::Loop< Kokkos::complex<double>, TEST_EXECSPACE >( 1, 1 ) ) );
|
||||
ASSERT_TRUE( ( TestAtomic::Loop< Kokkos::complex<double>, TEST_EXECSPACE >( 1, 2 ) ) );
|
||||
ASSERT_TRUE( ( TestAtomic::Loop< Kokkos::complex<double>, TEST_EXECSPACE >( 1, 3 ) ) );
|
||||
|
||||
@ -216,7 +216,7 @@ template< class DeviceType, bool PWRTest >
|
||||
double ReduceTestFunctor() {
|
||||
typedef Kokkos::TeamPolicy< DeviceType > policy_type;
|
||||
typedef Kokkos::View< double**, DeviceType > view_type;
|
||||
typedef Kokkos::View< double, typename view_type::host_mirror_space, Kokkos::MemoryUnmanaged > unmanaged_result;
|
||||
typedef Kokkos::View< double, Kokkos::HostSpace, Kokkos::MemoryUnmanaged > unmanaged_result;
|
||||
|
||||
view_type a( "A", 100, 5 );
|
||||
typename view_type::HostMirror h_a = Kokkos::create_mirror_view( a );
|
||||
@ -244,7 +244,7 @@ template< class DeviceType, bool PWRTest >
|
||||
double ReduceTestLambda() {
|
||||
typedef Kokkos::TeamPolicy< DeviceType > policy_type;
|
||||
typedef Kokkos::View< double**, DeviceType > view_type;
|
||||
typedef Kokkos::View< double, typename view_type::host_mirror_space, Kokkos::MemoryUnmanaged > unmanaged_result;
|
||||
typedef Kokkos::View< double, Kokkos::HostSpace, Kokkos::MemoryUnmanaged > unmanaged_result;
|
||||
|
||||
view_type a( "A", 100, 5 );
|
||||
typename view_type::HostMirror h_a = Kokkos::create_mirror_view( a );
|
||||
@ -327,12 +327,18 @@ bool Test( int test ) {
|
||||
};
|
||||
bool passed = true;
|
||||
|
||||
if ( res_functor != res_lambda ) {
|
||||
auto a = res_functor;
|
||||
auto b = res_lambda;
|
||||
// use a tolerant comparison because functors and lambdas vectorize differently
|
||||
// https://github.com/trilinos/Trilinos/issues/3233
|
||||
auto rel_err = (std::abs(b - a) / std::max(std::abs(a), std::abs(b)));
|
||||
auto tol = 1e-14;
|
||||
if (rel_err > tol) {
|
||||
passed = false;
|
||||
|
||||
std::cout << "CXX11 ( test = '"
|
||||
<< testnames[test] << "' FAILED : "
|
||||
<< res_functor << " != " << res_lambda
|
||||
<< testnames[test] << "' FAILED : relative error "
|
||||
<< rel_err << " > tolerance " << tol
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ struct TestComplexConstruction {
|
||||
ASSERT_FLOAT_EQ(h_results(7).real(),7.5); ASSERT_FLOAT_EQ(h_results(7).imag(),0.0);
|
||||
ASSERT_FLOAT_EQ(h_results(8).real(),double(8)); ASSERT_FLOAT_EQ(h_results(8).imag(),0.0);
|
||||
|
||||
#ifndef KOKKOS_ENABLE_ROCM
|
||||
#ifndef KOKKOS_ENABLE_ROCM // Copy construction conversion between Kokkos::complex and std::complex doesn't compile
|
||||
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; r_kk = a; ASSERT_FLOAT_EQ(r.real(),r_kk.real()); ASSERT_FLOAT_EQ(r.imag(),r_kk.imag());
|
||||
|
||||
@ -318,6 +318,24 @@ struct TestMDRange_2D {
|
||||
|
||||
ASSERT_EQ( sum, 2 * (N0 - s0) * (N1 - s1) );
|
||||
}
|
||||
// Test with reducers - scalar + label
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<2>, Kokkos::IndexType<int> > range_type;
|
||||
int s0 = 1;
|
||||
int s1 = 1;
|
||||
range_type range( {{ s0, s1 }}, {{ N0, N1 }}, {{ 3, 3 }} );
|
||||
|
||||
TestMDRange_2D functor( N0, N1 );
|
||||
|
||||
parallel_for( "rank2-parfor-label", range, functor );
|
||||
|
||||
value_type sum = 0.0;
|
||||
Kokkos::Sum< value_type > reducer_scalar( sum );
|
||||
|
||||
parallel_reduce( "rank2-reducer-label", range, functor, reducer_scalar );
|
||||
|
||||
ASSERT_EQ( sum, 2 * (N0 - s0) * (N1 - s1) );
|
||||
}
|
||||
// Test with reducers - scalar view
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<2>, Kokkos::IndexType<int> > range_type;
|
||||
@ -337,7 +355,31 @@ struct TestMDRange_2D {
|
||||
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 );
|
||||
}
|
||||
// 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> > range_type;
|
||||
range_type range( {{ 1, 1 }}, {{ N0, N1 }}, {{ 3, 3 }} );
|
||||
|
||||
Kokkos::View< double**, ExecSpace > v_in("v_in", N0, N1 );
|
||||
|
||||
parallel_for( "rank2-init-lambda", range, KOKKOS_LAMBDA ( const int i, const int j ) {
|
||||
v_in( i , j ) = (i+1) * (j+1) ;
|
||||
});
|
||||
|
||||
double min;
|
||||
Kokkos::Min< double > reducer_scalar( min );
|
||||
|
||||
parallel_reduce( "rank2-min-reducer", range, KOKKOS_LAMBDA ( const int i, const int j, double& min_val ) {
|
||||
min_val = fmin( v_in(i,j), min_val );
|
||||
}
|
||||
, reducer_scalar);
|
||||
|
||||
ASSERT_EQ( min, 4.0 );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
// Tagged operator test
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<2, Iterate::Default, Iterate::Default >, Kokkos::IndexType<int>, InitTag > range_type;
|
||||
@ -858,6 +900,22 @@ struct TestMDRange_3D {
|
||||
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 );
|
||||
}
|
||||
// Test with reducers - scalar + label
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<3>, Kokkos::IndexType<int> > range_type;
|
||||
range_type range( {{ 0, 0, 0 }}, {{ N0, N1, N2 }}, {{ 3, 3, 3 }} );
|
||||
|
||||
TestMDRange_3D functor( N0, N1, N2 );
|
||||
|
||||
parallel_for( "rank3-parfor-label", range, functor );
|
||||
|
||||
value_type sum = 0.0;
|
||||
Kokkos::Sum< value_type > reducer_scalar( sum );
|
||||
|
||||
parallel_reduce( "rank3-reducer-label", range, functor, reducer_scalar );
|
||||
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 );
|
||||
}
|
||||
// Test with reducers - scalar view
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<3>, Kokkos::IndexType<int> > range_type;
|
||||
@ -877,6 +935,31 @@ struct TestMDRange_3D {
|
||||
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 );
|
||||
}
|
||||
// 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> > range_type;
|
||||
|
||||
range_type range( {{ 1, 1, 1 }}, {{ N0, N1, N2 }}, {{ 3, 3, 3 }} );
|
||||
|
||||
Kokkos::View< double***, ExecSpace > v_in("v_in", N0, N1, N2 );
|
||||
|
||||
parallel_for( "rank3-init-lambda", range, KOKKOS_LAMBDA ( const int i, const int j, const int k ) {
|
||||
v_in( i, j, k ) = (i+1) * (j+1) * (k+1) ;
|
||||
});
|
||||
|
||||
double min;
|
||||
|
||||
parallel_reduce("rank3-min-reducer", range, KOKKOS_LAMBDA ( const int i, const int j, const int k, double& min_val ) {
|
||||
min_val = (v_in(i,j,k) < min_val) ? v_in(i,j,k) : min_val;
|
||||
}
|
||||
, Kokkos::Min<double>(min) );
|
||||
|
||||
ASSERT_EQ( min, 8.0 );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Tagged operator test
|
||||
{
|
||||
@ -1382,6 +1465,23 @@ struct TestMDRange_4D {
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 );
|
||||
}
|
||||
|
||||
// Test with reducers - scalar + label
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<4>, Kokkos::IndexType<int> > range_type;
|
||||
range_type range( {{ 0, 0, 0, 0 }}, {{ N0, N1, N2, N3 }}, {{ 3, 3, 3, 3 }} );
|
||||
|
||||
TestMDRange_4D functor( N0, N1, N2, N3 );
|
||||
|
||||
parallel_for( "rank4-parfor-label", range, functor );
|
||||
|
||||
value_type sum = 0.0;
|
||||
Kokkos::Sum< value_type > reducer_scalar( sum );
|
||||
|
||||
parallel_reduce( "rank4-reducer-label", range, functor, reducer_scalar );
|
||||
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 );
|
||||
}
|
||||
|
||||
// Test with reducers - scalar view
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<4>, Kokkos::IndexType<int> > range_type;
|
||||
@ -1402,6 +1502,32 @@ struct TestMDRange_4D {
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 );
|
||||
}
|
||||
|
||||
// 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> > range_type;
|
||||
|
||||
range_type range( {{ 1, 1, 1, 1 }}, {{ N0, N1, N2, N3 }}, {{ 3, 3, 3, 3 }} );
|
||||
|
||||
Kokkos::View< double****, ExecSpace > v_in("v_in", N0, N1, N2, N3 );
|
||||
|
||||
parallel_for( "rank4-init-lambda", range, KOKKOS_LAMBDA ( const int i, const int j, const int k, const int l ) {
|
||||
v_in( i, j, k, l ) = (i+1) * (j+1) * (k+1) * (l+1) ;
|
||||
});
|
||||
|
||||
double min;
|
||||
|
||||
parallel_reduce("rank4-min-reducer", range, KOKKOS_LAMBDA ( const int i, const int j, const int k, const int l, double& min_val ) {
|
||||
min_val = (v_in(i,j,k,l) < min_val) ? v_in(i,j,k,l) : min_val;
|
||||
}
|
||||
, Kokkos::Min<double>(min) );
|
||||
|
||||
ASSERT_EQ( min, 16.0 );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Tagged operator test
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<4, Iterate::Default, Iterate::Default >, Kokkos::IndexType<int>, InitTag > range_type;
|
||||
@ -1926,6 +2052,23 @@ struct TestMDRange_5D {
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 * N4 );
|
||||
}
|
||||
|
||||
// Test with reducers - scalar + label
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<5>, Kokkos::IndexType<int> > range_type;
|
||||
range_type range( {{ 0, 0, 0, 0, 0 }}, {{ N0, N1, N2, N3, N4 }}, {{ 3, 3, 3, 3, 3 }} );
|
||||
|
||||
TestMDRange_5D functor( N0, N1, N2, N3, N4 );
|
||||
|
||||
parallel_for( "rank5-parfor-label", range, functor );
|
||||
|
||||
value_type sum = 0.0;
|
||||
Kokkos::Sum< value_type > reducer_scalar( sum );
|
||||
|
||||
parallel_reduce( "rank5-reducer-label", range, functor, reducer_scalar );
|
||||
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 * N4 );
|
||||
}
|
||||
|
||||
// Test with reducers - scalar view
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<5>, Kokkos::IndexType<int> > range_type;
|
||||
@ -1946,6 +2089,32 @@ struct TestMDRange_5D {
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 * N4 );
|
||||
}
|
||||
|
||||
// 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> > range_type;
|
||||
|
||||
range_type range( {{ 1, 1, 1, 1, 1 }}, {{ N0, N1, N2, N3, N4 }}, {{ 3, 3, 3, 2, 2 }} );
|
||||
|
||||
Kokkos::View< double*****, ExecSpace > v_in("v_in", N0, N1, N2, N3, N4 );
|
||||
|
||||
parallel_for( "rank5-init-lambda", range, KOKKOS_LAMBDA ( const int i, const int j, const int k, const int l, const int m ) {
|
||||
v_in( i, j, k, l, m ) = (i+1) * (j+1) * (k+1) * (l+1) * (m+1) ;
|
||||
});
|
||||
|
||||
double min;
|
||||
|
||||
parallel_reduce("rank5-min-reducer", range, KOKKOS_LAMBDA ( const int i, const int j, const int k, const int l, const int m, double& min_val ) {
|
||||
min_val = (v_in(i,j,k,l,m) < min_val) ? v_in(i,j,k,l,m) : min_val;
|
||||
}
|
||||
, Kokkos::Min<double>(min) );
|
||||
|
||||
ASSERT_EQ( min, 32.0 );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Tagged operator test
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<5, Iterate::Default, Iterate::Default >, Kokkos::IndexType<int>, InitTag > range_type;
|
||||
@ -2401,6 +2570,23 @@ struct TestMDRange_6D {
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 * N4 * N5 );
|
||||
}
|
||||
|
||||
// Test with reducers - scalar + label
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<6>, Kokkos::IndexType<int> > range_type;
|
||||
range_type range( {{ 0, 0, 0, 0, 0, 0 }}, {{ N0, N1, N2, N3, N4, N5 }}, {{ 3, 3, 3, 3, 3, 2 }} );
|
||||
|
||||
TestMDRange_6D functor( N0, N1, N2, N3, N4, N5 );
|
||||
|
||||
parallel_for( "rank6-parfor-label", range, functor );
|
||||
|
||||
value_type sum = 0.0;
|
||||
Kokkos::Sum< value_type > reducer_scalar( sum );
|
||||
|
||||
parallel_reduce( "rank6-reducer-label", range, functor, reducer_scalar );
|
||||
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 * N4 * N5 );
|
||||
}
|
||||
|
||||
// Test with reducers - scalar view
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<6>, Kokkos::IndexType<int> > range_type;
|
||||
@ -2421,6 +2607,32 @@ struct TestMDRange_6D {
|
||||
ASSERT_EQ( sum, 2 * N0 * N1 * N2 * N3 * N4 * N5 );
|
||||
}
|
||||
|
||||
// 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> > range_type;
|
||||
|
||||
range_type range( {{ 1, 1, 1, 1, 1, 1 }}, {{ N0, N1, N2, N3, N4, N5 }}, {{ 3, 3, 3, 2, 2, 1 }} );
|
||||
|
||||
Kokkos::View< double******, ExecSpace > v_in("v_in", N0, N1, N2, N3, N4, N5 );
|
||||
|
||||
parallel_for( "rank6-init-lambda", range, KOKKOS_LAMBDA ( const int i, const int j, const int k, const int l, const int m, const int n ) {
|
||||
v_in( i, j, k, l, m, n ) = (i+1) * (j+1) * (k+1) * (l+1) * (m+1) * (n+1) ;
|
||||
});
|
||||
|
||||
double min;
|
||||
|
||||
parallel_reduce("rank6-min-reducer", range, KOKKOS_LAMBDA ( const int i, const int j, const int k, const int l, const int m, const int n, double& min_val ) {
|
||||
min_val = (v_in(i,j,k,l,m,n) < min_val) ? v_in(i,j,k,l,m,n) : min_val;
|
||||
}
|
||||
, Kokkos::Min<double>(min) );
|
||||
|
||||
ASSERT_EQ( min, 64.0 );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Tagged operator test
|
||||
{
|
||||
typedef typename Kokkos::MDRangePolicy< ExecSpace, Kokkos::Rank<6, Iterate::Default, Iterate::Default >, Kokkos::IndexType<int>, InitTag > range_type;
|
||||
|
||||
@ -44,8 +44,12 @@
|
||||
#include<TestMDRange.hpp>
|
||||
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_5d ) {
|
||||
#if !defined ( KOKKOS_ENABLE_ROCM ) // MDRange Reduce explicitly handled in its own cpp file
|
||||
TestMDRange_5D< TEST_EXECSPACE >::test_reduce5( 100, 10, 10, 10, 5 );
|
||||
#endif
|
||||
TestMDRange_5D< TEST_EXECSPACE >::test_for5( 100, 10, 10, 10, 5 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -45,10 +45,11 @@
|
||||
|
||||
namespace Test {
|
||||
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_6d ) {
|
||||
TestMDRange_6D< TEST_EXECSPACE >::test_for6( 10, 10, 10, 10, 5, 5 );
|
||||
#if !defined( KOKKOS_ENABLE_ROCM ) // MDRange Reduce explicitly handled in its own cpp file
|
||||
TestMDRange_6D< TEST_EXECSPACE >::test_reduce6( 100, 10, 10, 10, 5, 5 );
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -46,8 +46,10 @@
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_2d) {
|
||||
TestMDRange_2D< TEST_EXECSPACE >::test_for2( 100, 100 );
|
||||
#if !defined( KOKKOS_ENABLE_ROCM ) // MDRange Reduce explicitly handled in its own cpp file
|
||||
TestMDRange_2D< TEST_EXECSPACE >::test_reduce2( 100, 100 );
|
||||
#endif
|
||||
TestMDRange_2D< TEST_EXECSPACE >::test_for2( 100, 100 );
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_array_reduce ) {
|
||||
|
||||
@ -44,9 +44,12 @@
|
||||
#include<TestMDRange.hpp>
|
||||
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_3d) {
|
||||
TestMDRange_3D< TEST_EXECSPACE >::test_for3( 100, 10, 100 );
|
||||
#if !defined( KOKKOS_ENABLE_ROCM ) // MDRange Reduced explicitly handled in its own cpp file
|
||||
TestMDRange_3D< TEST_EXECSPACE >::test_reduce3( 100, 10, 100 );
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_neg_idx ) {
|
||||
@ -56,4 +59,5 @@ TEST_F( TEST_CATEGORY , mdrange_neg_idx ) {
|
||||
TestMDRange_5D_NegIdx< TEST_EXECSPACE >::test_5D_negidx( 128, 32, 8, 8, 4 );
|
||||
TestMDRange_6D_NegIdx< TEST_EXECSPACE >::test_6D_negidx( 128, 32, 8, 8, 4, 2 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -44,8 +44,12 @@
|
||||
#include<TestMDRange.hpp>
|
||||
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_4d ) {
|
||||
#if !defined( KOKKOS_ENABLE_ROCM ) // MDRange Reduce explicitly handled in its own cpp file
|
||||
TestMDRange_4D< TEST_EXECSPACE >::test_reduce4( 100, 10, 10, 10 );
|
||||
#endif
|
||||
TestMDRange_4D< TEST_EXECSPACE >::test_for4( 100, 10, 10, 10 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -626,7 +626,9 @@ TEST_F( TEST_CATEGORY, memory_pool )
|
||||
TestMemoryPool::test_host_memory_pool_stats<>();
|
||||
TestMemoryPool::test_memory_pool_v2< TEST_EXECSPACE >(false,false);
|
||||
TestMemoryPool::test_memory_pool_corners< TEST_EXECSPACE >(false,false);
|
||||
#ifdef KOKKOS_ENABLE_LARGE_MEM_TESTS
|
||||
TestMemoryPool::test_memory_pool_huge< TEST_EXECSPACE >();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -63,9 +63,11 @@ public:
|
||||
|
||||
const size_type nwork;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
ReduceFunctor( const size_type & arg_nwork )
|
||||
: nwork( arg_nwork ) {}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
ReduceFunctor( const ReduceFunctor & rhs )
|
||||
: nwork( rhs.nwork ) {}
|
||||
|
||||
@ -102,6 +104,7 @@ class ReduceFunctorFinal : public ReduceFunctor< long, DeviceType > {
|
||||
public:
|
||||
typedef typename ReduceFunctor< long, DeviceType >::value_type value_type;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
ReduceFunctorFinal( const size_t n )
|
||||
: ReduceFunctor< long, DeviceType >( n ) {}
|
||||
|
||||
|
||||
131
lib/kokkos/core/unit_test/TestReduceDeviceView.hpp
Normal file
131
lib/kokkos/core/unit_test/TestReduceDeviceView.hpp
Normal file
@ -0,0 +1,131 @@
|
||||
#include<Kokkos_Core.hpp>
|
||||
|
||||
namespace Test {
|
||||
namespace {
|
||||
|
||||
struct TestIsAsynchFunctor {
|
||||
Kokkos::View<double,TEST_EXECSPACE> atomic_test;
|
||||
TestIsAsynchFunctor(Kokkos::View<double,TEST_EXECSPACE> atomic_test_):atomic_test(atomic_test_){}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(const int) const {
|
||||
Kokkos::atomic_add(&atomic_test(),1.0);
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolicyType, class ReduceFunctor>
|
||||
void test_reduce_device_view(int64_t N, PolicyType policy, ReduceFunctor functor) {
|
||||
|
||||
using ExecSpace = TEST_EXECSPACE;
|
||||
|
||||
Kokkos::View<int64_t,TEST_EXECSPACE> result("Result");
|
||||
Kokkos::View<double,TEST_EXECSPACE> atomic_test("Atomic");
|
||||
int64_t reducer_result, view_result, scalar_result;
|
||||
|
||||
|
||||
Kokkos::Timer timer;
|
||||
|
||||
// Establish whether execspace is asynchronous
|
||||
Kokkos::parallel_for("Test::ReduceDeviceView::TestIsAsynch",Kokkos::RangePolicy<TEST_EXECSPACE>(0,1000000),
|
||||
TestIsAsynchFunctor(atomic_test));
|
||||
double time0 = timer.seconds();
|
||||
timer.reset();
|
||||
ExecSpace::execution_space::fence();
|
||||
double time_fence0 = timer.seconds();
|
||||
Kokkos::deep_copy(result,0);
|
||||
timer.reset();
|
||||
bool is_async = time0<time_fence0;
|
||||
|
||||
// Test Reducer
|
||||
|
||||
Kokkos::parallel_reduce("Test::ReduceDeviceView::TestReducer",policy, functor, Kokkos::Sum<int64_t,TEST_EXECSPACE>(result));
|
||||
double time1 = timer.seconds();
|
||||
// Check whether it was asyncronous
|
||||
timer.reset();
|
||||
ExecSpace::execution_space::fence();
|
||||
double time_fence1 = timer.seconds();
|
||||
Kokkos::deep_copy(reducer_result,result);
|
||||
Kokkos::deep_copy(result,0);
|
||||
ASSERT_EQ(N,reducer_result);
|
||||
timer.reset();
|
||||
|
||||
|
||||
// Test View
|
||||
Kokkos::parallel_reduce("Test::ReduceDeviceView::TestView",policy, functor, result);
|
||||
double time2 = timer.seconds();
|
||||
// Check whether it was asyncronous
|
||||
timer.reset();
|
||||
ExecSpace::execution_space::fence();
|
||||
double time_fence2 = timer.seconds();
|
||||
Kokkos::deep_copy(view_result,result);
|
||||
Kokkos::deep_copy(result,0);
|
||||
ASSERT_EQ(N,view_result);
|
||||
timer.reset();
|
||||
|
||||
|
||||
// Test Scalar
|
||||
Kokkos::parallel_reduce("Test::ReduceDeviceView::TestScalar",policy, functor, scalar_result);
|
||||
double time3 = timer.seconds();
|
||||
|
||||
// Check whether it was asyncronous
|
||||
timer.reset();
|
||||
ExecSpace::execution_space::fence();
|
||||
double time_fence3 = timer.seconds();
|
||||
|
||||
ASSERT_EQ(N,scalar_result);
|
||||
if(is_async) {
|
||||
ASSERT_TRUE(time1<time_fence1);
|
||||
}
|
||||
if(is_async) {
|
||||
ASSERT_TRUE(time2<time_fence2);
|
||||
ASSERT_TRUE(time3>time_fence3);
|
||||
}
|
||||
}
|
||||
|
||||
struct RangePolicyFunctor {
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int, int64_t& lsum) const {
|
||||
lsum += 1;
|
||||
}
|
||||
};
|
||||
|
||||
struct MDRangePolicyFunctor {
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int, const int, const int, int64_t& lsum) const {
|
||||
lsum += 1;
|
||||
}
|
||||
};
|
||||
|
||||
struct TeamPolicyFunctor {
|
||||
int M;
|
||||
TeamPolicyFunctor(int M_):M(M_){}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const Kokkos::TeamPolicy<TEST_EXECSPACE>::member_type& team, int64_t& lsum) const {
|
||||
for(int i=team.team_rank(); i<M; i+=team.team_size())
|
||||
lsum += 1;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_F( TEST_CATEGORY, reduce_device_view_range_policy )
|
||||
{
|
||||
int N=1000*1024*1024;
|
||||
test_reduce_device_view(N,Kokkos::RangePolicy<TEST_EXECSPACE>(0,N),RangePolicyFunctor());
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, reduce_device_view_mdrange_policy )
|
||||
{
|
||||
int N=1000*1024*1024;
|
||||
test_reduce_device_view(N,Kokkos::MDRangePolicy<TEST_EXECSPACE,Kokkos::Rank<3>>({0,0,0},{1000,1024,1024}),MDRangePolicyFunctor());
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, reduce_device_view_team_policy )
|
||||
{
|
||||
int N=1000*1024*1024;
|
||||
test_reduce_device_view(N,Kokkos::TeamPolicy<TEST_EXECSPACE>(1000*1024,Kokkos::AUTO),TeamPolicyFunctor(1024));
|
||||
}
|
||||
|
||||
} // namespace Test
|
||||
|
||||
@ -477,7 +477,7 @@ struct TestReducers {
|
||||
int reference_loc = -1;
|
||||
|
||||
for ( int i = 0; i < N; i++ ) {
|
||||
h_values( i ) = (Scalar) ( rand() % 100000 );
|
||||
h_values( i ) = (Scalar) ( rand() % 100000 + 2 );
|
||||
|
||||
if ( h_values( i ) < reference_min ) {
|
||||
reference_min = h_values( i );
|
||||
@ -485,7 +485,7 @@ struct TestReducers {
|
||||
}
|
||||
else if ( h_values( i ) == reference_min ) {
|
||||
// Make min unique.
|
||||
h_values( i ) += std::numeric_limits< Scalar >::epsilon();
|
||||
h_values( i ) += Scalar(1);
|
||||
}
|
||||
}
|
||||
Kokkos::deep_copy( values, h_values );
|
||||
@ -537,7 +537,7 @@ struct TestReducers {
|
||||
int reference_loc = -1;
|
||||
|
||||
for ( int i = 0; i < N; i++ ) {
|
||||
h_values( i ) = (Scalar) ( rand() % 100000 );
|
||||
h_values( i ) = (Scalar) ( rand() % 100000 + 2 );
|
||||
|
||||
if ( h_values( i ) > reference_max ) {
|
||||
reference_max = h_values( i );
|
||||
@ -545,7 +545,7 @@ struct TestReducers {
|
||||
}
|
||||
else if ( h_values( i ) == reference_max ) {
|
||||
// Make max unique.
|
||||
h_values( i ) -= std::numeric_limits< Scalar >::epsilon();
|
||||
h_values( i ) -= Scalar(1);
|
||||
}
|
||||
}
|
||||
Kokkos::deep_copy( values, h_values );
|
||||
@ -599,7 +599,7 @@ struct TestReducers {
|
||||
int reference_maxloc = -1;
|
||||
|
||||
for ( int i = 0; i < N; i++ ) {
|
||||
h_values( i ) = (Scalar) ( rand() % 100000 );
|
||||
h_values( i ) = (Scalar) ( rand() % 100000 + 2);
|
||||
}
|
||||
|
||||
for ( int i = 0; i < N; i++ ) {
|
||||
@ -609,7 +609,7 @@ struct TestReducers {
|
||||
}
|
||||
else if ( h_values( i ) == reference_max ) {
|
||||
// Make max unique.
|
||||
h_values( i ) -= std::numeric_limits< Scalar >::epsilon();
|
||||
h_values( i ) -= Scalar(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -620,7 +620,7 @@ struct TestReducers {
|
||||
}
|
||||
else if ( h_values( i ) == reference_min ) {
|
||||
// Make min unique.
|
||||
h_values( i ) += std::numeric_limits< Scalar >::epsilon();
|
||||
h_values( i ) += Scalar(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,9 +69,9 @@ struct TestScan {
|
||||
const value_type answer = n & 1 ? ( n * ( ( n + 1 ) / 2 ) ) : ( ( n / 2 ) * ( n + 1 ) );
|
||||
|
||||
if ( answer != update ) {
|
||||
errors()++;
|
||||
int fail = errors()++;
|
||||
|
||||
if ( errors() < 20 ) {
|
||||
if ( fail < 20 ) {
|
||||
printf( "TestScan(%d,%ld) != %ld\n", iwork, update, answer );
|
||||
}
|
||||
}
|
||||
@ -97,6 +97,7 @@ struct TestScan {
|
||||
long long int total = 0;
|
||||
Kokkos::parallel_scan( N, *this, total );
|
||||
run_check( size_t( ( N+1 )*N/2 ), size_t( total ) );
|
||||
check_error();
|
||||
}
|
||||
|
||||
TestScan( const WorkSpec & Start , const WorkSpec & N )
|
||||
@ -108,6 +109,13 @@ struct TestScan {
|
||||
errors = errors_a;
|
||||
|
||||
Kokkos::parallel_scan( exec_policy( Start , N ) , *this );
|
||||
check_error();
|
||||
}
|
||||
|
||||
void check_error() {
|
||||
int total_errors;
|
||||
Kokkos::deep_copy(total_errors, errors);
|
||||
ASSERT_EQ(total_errors,0);
|
||||
}
|
||||
|
||||
static void test_range( const WorkSpec & begin, const WorkSpec & end )
|
||||
|
||||
@ -61,7 +61,7 @@ struct TestTeamPolicy {
|
||||
|
||||
TestTeamPolicy( const size_t league_size )
|
||||
: m_flags( Kokkos::ViewAllocateWithoutInitializing( "flags" ),
|
||||
Kokkos::TeamPolicy< ScheduleType, ExecSpace >::team_size_max( *this ),
|
||||
Kokkos::TeamPolicy< ScheduleType, ExecSpace >(1,1).team_size_max( *this, Kokkos::ParallelReduceTag() ),
|
||||
league_size ) {}
|
||||
|
||||
struct VerifyInitTag {};
|
||||
@ -113,11 +113,14 @@ struct TestTeamPolicy {
|
||||
static void test_for( const size_t league_size )
|
||||
{
|
||||
TestTeamPolicy functor( league_size );
|
||||
typedef Kokkos::TeamPolicy< ScheduleType, ExecSpace > policy_type;
|
||||
typedef Kokkos::TeamPolicy< ScheduleType, ExecSpace, VerifyInitTag > policy_type_init;
|
||||
|
||||
const int team_size = Kokkos::TeamPolicy< ScheduleType, ExecSpace >::team_size_max( functor );
|
||||
const int team_size = policy_type(league_size,1).team_size_max( functor, Kokkos::ParallelForTag() );
|
||||
const int team_size_init = policy_type_init(league_size,1).team_size_max( functor, Kokkos::ParallelForTag() );
|
||||
|
||||
Kokkos::parallel_for( Kokkos::TeamPolicy< ScheduleType, ExecSpace >( league_size, team_size ), functor );
|
||||
Kokkos::parallel_for( Kokkos::TeamPolicy< ScheduleType, ExecSpace, VerifyInitTag >( league_size, team_size ), functor );
|
||||
Kokkos::parallel_for( policy_type( league_size, team_size ), functor );
|
||||
Kokkos::parallel_for( policy_type_init( league_size, team_size_init ), functor );
|
||||
|
||||
test_small_league_size();
|
||||
}
|
||||
@ -142,15 +145,19 @@ struct TestTeamPolicy {
|
||||
{
|
||||
TestTeamPolicy functor( league_size );
|
||||
|
||||
const int team_size = Kokkos::TeamPolicy< ScheduleType, ExecSpace >::team_size_max( functor );
|
||||
typedef Kokkos::TeamPolicy< ScheduleType, ExecSpace > policy_type;
|
||||
typedef Kokkos::TeamPolicy< ScheduleType, ExecSpace, ReduceTag > policy_type_reduce;
|
||||
|
||||
const int team_size = policy_type_reduce(league_size,1).team_size_max( functor, Kokkos::ParallelReduceTag() );
|
||||
|
||||
const long N = team_size * league_size;
|
||||
|
||||
long total = 0;
|
||||
|
||||
Kokkos::parallel_reduce( Kokkos::TeamPolicy< ScheduleType, ExecSpace >( league_size, team_size ), functor, total );
|
||||
Kokkos::parallel_reduce( policy_type( league_size, team_size ), functor, total );
|
||||
ASSERT_EQ( size_t( ( N - 1 ) * ( N ) ) / 2, size_t( total ) );
|
||||
|
||||
Kokkos::parallel_reduce( Kokkos::TeamPolicy< ScheduleType, ExecSpace, ReduceTag >( league_size, team_size ), functor, total );
|
||||
Kokkos::parallel_reduce( policy_type_reduce( league_size, team_size ), functor, total );
|
||||
ASSERT_EQ( ( size_t( N ) * size_t( N + 1 ) ) / 2, size_t( total ) );
|
||||
}
|
||||
};
|
||||
@ -177,8 +184,10 @@ public:
|
||||
|
||||
const size_type nwork;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
ReduceTeamFunctor( const size_type & arg_nwork ) : nwork( arg_nwork ) {}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
ReduceTeamFunctor( const ReduceTeamFunctor & rhs ) : nwork( rhs.nwork ) {}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
@ -244,10 +253,12 @@ public:
|
||||
const unsigned long nsum = nw % 2 ? nw * ( ( nw + 1 ) / 2 )
|
||||
: ( nw / 2 ) * ( nw + 1 );
|
||||
|
||||
const unsigned team_size = policy_type::team_size_recommended( functor_type( nwork ) );
|
||||
policy_type team_exec( nw, 1 );
|
||||
|
||||
const unsigned team_size = team_exec.team_size_recommended( functor_type( nwork ), Kokkos::ParallelReduceTag() );
|
||||
const unsigned league_size = ( nwork + team_size - 1 ) / team_size;
|
||||
|
||||
policy_type team_exec( league_size, team_size );
|
||||
team_exec = policy_type( league_size, team_size );
|
||||
|
||||
for ( unsigned i = 0; i < Repeat; ++i ) {
|
||||
result_type tmp( & result[i] );
|
||||
@ -370,7 +381,8 @@ public:
|
||||
|
||||
functor_type functor;
|
||||
|
||||
policy_type team_exec( nteam, policy_type::team_size_max( functor ) );
|
||||
policy_type team_exec( nteam, 1);
|
||||
team_exec = policy_type(nteam, team_exec.team_size_max(functor, Kokkos::ParallelReduceTag()));
|
||||
|
||||
for ( unsigned i = 0; i < Repeat; ++i ) {
|
||||
long int accum = 0;
|
||||
@ -475,7 +487,8 @@ struct TestSharedTeam {
|
||||
typedef Test::SharedTeamFunctor<ExecSpace, ScheduleType> Functor;
|
||||
typedef Kokkos::View< typename Functor::value_type, Kokkos::HostSpace, Kokkos::MemoryUnmanaged > result_type;
|
||||
|
||||
const size_t team_size = Kokkos::TeamPolicy< ScheduleType, ExecSpace >::team_size_max( Functor() );
|
||||
const size_t team_size = Kokkos::TeamPolicy< ScheduleType, ExecSpace >(8192, 1).team_size_max( Functor(),
|
||||
Kokkos::ParallelReduceTag() );
|
||||
|
||||
Kokkos::TeamPolicy< ScheduleType, ExecSpace > team_exec( 8192 / team_size, team_size );
|
||||
|
||||
@ -648,16 +661,20 @@ struct TestScratchTeam {
|
||||
typedef Kokkos::View< typename Functor::value_type, Kokkos::HostSpace, Kokkos::MemoryUnmanaged > result_type;
|
||||
typedef Kokkos::TeamPolicy< ScheduleType, ExecSpace > p_type;
|
||||
|
||||
const size_t team_size = p_type::team_size_max( Functor() );
|
||||
|
||||
p_type team_exec( 8192 / team_size, team_size );
|
||||
|
||||
typename Functor::value_type error_count = 0;
|
||||
|
||||
int thread_scratch_size = Functor::shared_int_array_type::shmem_size( Functor::SHARED_THREAD_COUNT );
|
||||
|
||||
p_type team_exec = p_type(8192,1).set_scratch_size( 1, Kokkos::PerTeam( Functor::shared_int_array_type::shmem_size( Functor::SHARED_TEAM_COUNT ) ),
|
||||
Kokkos::PerThread( thread_scratch_size + 3*sizeof(int)));
|
||||
|
||||
const size_t team_size = team_exec.team_size_max( Functor(), Kokkos::ParallelReduceTag() );
|
||||
|
||||
int team_scratch_size = Functor::shared_int_array_type::shmem_size( Functor::SHARED_TEAM_COUNT ) +
|
||||
Functor::shared_int_array_type::shmem_size( 3 * team_size );
|
||||
|
||||
int thread_scratch_size = Functor::shared_int_array_type::shmem_size( Functor::SHARED_THREAD_COUNT );
|
||||
team_exec = p_type(8192 / team_size, team_size );
|
||||
|
||||
Kokkos::parallel_reduce( team_exec.set_scratch_size( 1, Kokkos::PerTeam( team_scratch_size ),
|
||||
Kokkos::PerThread( thread_scratch_size ) ),
|
||||
@ -956,7 +973,7 @@ struct TestShmemSize {
|
||||
|
||||
size_t size = view_type::shmem_size( d1, d2, d3 );
|
||||
|
||||
ASSERT_EQ( size, d1 * d2 * d3 * sizeof( long ) );
|
||||
ASSERT_EQ( size, (d1 * d2 * d3 + 1)* sizeof( long ) );
|
||||
|
||||
test_layout_stride();
|
||||
}
|
||||
@ -973,3 +990,123 @@ struct TestShmemSize {
|
||||
};
|
||||
|
||||
} // namespace Test
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
namespace Test {
|
||||
|
||||
namespace {
|
||||
|
||||
template< class ExecSpace, class ScheduleType >
|
||||
struct TestTeamBroadcast {
|
||||
typedef typename Kokkos::TeamPolicy< ScheduleType, ExecSpace >::member_type team_member;
|
||||
|
||||
TestTeamBroadcast( const size_t league_size ) {}
|
||||
|
||||
struct BroadcastTag {};
|
||||
|
||||
typedef long value_type;
|
||||
|
||||
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 = tid * 3 + 1;
|
||||
|
||||
teamMember.team_broadcast(value, lid%ts);
|
||||
|
||||
Kokkos::parallel_reduce( Kokkos::TeamThreadRange( teamMember, ts ), [&] ( const int j, value_type &teamUpdate ) {
|
||||
teamUpdate += value;
|
||||
}, parUpdate );
|
||||
|
||||
if ( teamMember.team_rank() == 0 ) 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 = tid * 3 + 1;
|
||||
|
||||
teamMember.team_broadcast([&] (value_type & var) { var*=2; }, value, lid%ts);
|
||||
|
||||
Kokkos::parallel_reduce( Kokkos::TeamThreadRange( teamMember, ts ), [&] ( const int j, value_type &teamUpdate ) {
|
||||
teamUpdate += value;
|
||||
}, parUpdate );
|
||||
|
||||
if ( teamMember.team_rank() == 0 ) update += parUpdate;
|
||||
}
|
||||
|
||||
static void test_teambroadcast( const size_t league_size )
|
||||
{
|
||||
TestTeamBroadcast functor( league_size );
|
||||
|
||||
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
|
||||
long 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;
|
||||
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);
|
||||
|
||||
//team_broadcast with funtion object
|
||||
total = 0;
|
||||
|
||||
Kokkos::parallel_reduce( policy_type_f( league_size, team_size ), functor, total );
|
||||
|
||||
expected_result = 0;
|
||||
for (unsigned int i=0; i<league_size; i++){
|
||||
value_type val = ((i%team_size)*3+1)*2*team_size;
|
||||
expected_result+= val;
|
||||
}
|
||||
ASSERT_EQ( size_t( expected_result ), size_t( total ) ); //printf("team_broadcast with funtion object -- expected_result=%d, total=%d\n",expected_result, total);
|
||||
}
|
||||
};
|
||||
|
||||
template<class ExecSpace>
|
||||
struct TestScratchAlignment {
|
||||
struct TestScalar {
|
||||
double x,y,z;
|
||||
};
|
||||
TestScratchAlignment() {
|
||||
test(true);
|
||||
test(false);
|
||||
}
|
||||
typedef Kokkos::View<TestScalar*,typename ExecSpace::scratch_memory_space> ScratchView;
|
||||
typedef Kokkos::View<int*,typename ExecSpace::scratch_memory_space> ScratchViewInt;
|
||||
void test(bool allocate_small) {
|
||||
int shmem_size = ScratchView::shmem_size(11);
|
||||
if(allocate_small) shmem_size += ScratchViewInt::shmem_size(1);
|
||||
Kokkos::parallel_for(Kokkos::TeamPolicy<ExecSpace>(1,1).set_scratch_size(0,Kokkos::PerTeam(shmem_size)),
|
||||
KOKKOS_LAMBDA (const typename Kokkos::TeamPolicy<ExecSpace>::member_type& team) {
|
||||
if(allocate_small) ScratchViewInt p(team.team_scratch(0),1);
|
||||
ScratchView a(team.team_scratch(0),11);
|
||||
if(ptrdiff_t(a.data())%sizeof(TestScalar)!=0)
|
||||
Kokkos::abort("Error: invalid scratch view alignment\n");
|
||||
});
|
||||
Kokkos::fence();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace Test
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
146
lib/kokkos/core/unit_test/TestTeamTeamSize.hpp
Normal file
146
lib/kokkos/core/unit_test/TestTeamTeamSize.hpp
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <stdexcept>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <Kokkos_Core.hpp>
|
||||
|
||||
namespace Test {
|
||||
|
||||
namespace {
|
||||
template<class T,int N>
|
||||
class MyArray {
|
||||
public:
|
||||
T values[N];
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator+= (const MyArray& src) { for(int i=0; i<N; i++) values[i] += src.values[i]; }
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator= (const MyArray& src) { for(int i=0; i<N; i++) values[i] = src.values[i]; }
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator+= (const volatile MyArray& src) volatile { for(int i=0; i<N; i++) values[i] += src.values[i]; }
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator= (const volatile MyArray& src) volatile { for(int i=0; i<N; i++) values[i] = src.values[i]; }
|
||||
};
|
||||
|
||||
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 {
|
||||
}
|
||||
};
|
||||
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, MyArray<T,N>& lval) const {
|
||||
for(int j=0; j<N; j++)
|
||||
lval.values[j] += 1 + lval.values[0];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
typedef Kokkos::TeamPolicy<TEST_EXECSPACE> policy_type;
|
||||
typedef Kokkos::TeamPolicy<TEST_EXECSPACE, Kokkos::LaunchBounds<128,8> > policy_type_128_8;
|
||||
typedef Kokkos::TeamPolicy<TEST_EXECSPACE, Kokkos::LaunchBounds<1024,2> > policy_type_1024_2;
|
||||
|
||||
template<class T, int N, class PolicyType, int S>
|
||||
void test_team_policy_max_recommended_static_size(int scratch_size) {
|
||||
PolicyType p = PolicyType(10000, Kokkos::AUTO, 4).set_scratch_size(0,Kokkos::PerTeam(scratch_size));
|
||||
int team_size_max_for = p.team_size_max(FunctorFor<T,N,PolicyType,S>(),Kokkos::ParallelForTag());
|
||||
int team_size_rec_for = p.team_size_recommended(FunctorFor<T,N,PolicyType,S>(),Kokkos::ParallelForTag());
|
||||
int team_size_max_reduce = p.team_size_max(FunctorReduce<T,N,PolicyType,S>(),Kokkos::ParallelReduceTag());
|
||||
int team_size_rec_reduce = p.team_size_recommended(FunctorReduce<T,N,PolicyType,S>(),Kokkos::ParallelReduceTag());
|
||||
|
||||
ASSERT_TRUE( team_size_max_for >= team_size_rec_for );
|
||||
ASSERT_TRUE( team_size_max_reduce >= team_size_rec_reduce );
|
||||
ASSERT_TRUE( team_size_max_for >= team_size_max_reduce );
|
||||
|
||||
Kokkos::parallel_for(PolicyType(10000, team_size_max_for, 4).set_scratch_size(0,Kokkos::PerTeam(scratch_size)),
|
||||
FunctorFor<T,N,PolicyType,S>());
|
||||
Kokkos::parallel_for(PolicyType(10000, team_size_rec_for, 4).set_scratch_size(0,Kokkos::PerTeam(scratch_size)),
|
||||
FunctorFor<T,N,PolicyType,S>());
|
||||
MyArray<T,N> val;
|
||||
Kokkos::parallel_reduce(PolicyType(10000, team_size_max_reduce, 4).set_scratch_size(0,Kokkos::PerTeam(scratch_size)),
|
||||
FunctorReduce<T,N,PolicyType,S>(),val);
|
||||
Kokkos::parallel_reduce(PolicyType(10000, team_size_rec_reduce, 4).set_scratch_size(0,Kokkos::PerTeam(scratch_size)),
|
||||
FunctorReduce<T,N,PolicyType,S>(),val);
|
||||
Kokkos::fence();
|
||||
}
|
||||
|
||||
template<class T, int N, class PolicyType>
|
||||
void test_team_policy_max_recommended(int scratch_size) {
|
||||
test_team_policy_max_recommended_static_size<T,N,PolicyType,1>(scratch_size);
|
||||
test_team_policy_max_recommended_static_size<T,N,PolicyType,1000>(scratch_size);
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, team_policy_max_recommended )
|
||||
{
|
||||
int max_scratch_size = policy_type::scratch_size_max(0);
|
||||
test_team_policy_max_recommended<double,2,policy_type>(0);
|
||||
test_team_policy_max_recommended<double,2,policy_type>(max_scratch_size/3);
|
||||
test_team_policy_max_recommended<double,2,policy_type>(max_scratch_size);
|
||||
test_team_policy_max_recommended<double,2,policy_type_128_8>(0);
|
||||
test_team_policy_max_recommended<double,2,policy_type_128_8>(max_scratch_size/3/8);
|
||||
test_team_policy_max_recommended<double,2,policy_type_128_8>(max_scratch_size/8);
|
||||
test_team_policy_max_recommended<double,2,policy_type_1024_2>(0);
|
||||
test_team_policy_max_recommended<double,2,policy_type_1024_2>(max_scratch_size/3/2);
|
||||
test_team_policy_max_recommended<double,2,policy_type_1024_2>(max_scratch_size/2);
|
||||
|
||||
test_team_policy_max_recommended<double,16,policy_type>(0);
|
||||
test_team_policy_max_recommended<double,16,policy_type>(max_scratch_size/3);
|
||||
test_team_policy_max_recommended<double,16,policy_type>(max_scratch_size);
|
||||
test_team_policy_max_recommended<double,16,policy_type_128_8>(0);
|
||||
test_team_policy_max_recommended<double,16,policy_type_128_8>(max_scratch_size/3/8);
|
||||
test_team_policy_max_recommended<double,16,policy_type_128_8>(max_scratch_size/8);
|
||||
test_team_policy_max_recommended<double,16,policy_type_1024_2>(0);
|
||||
test_team_policy_max_recommended<double,16,policy_type_1024_2>(max_scratch_size/3/2);
|
||||
test_team_policy_max_recommended<double,16,policy_type_1024_2>(max_scratch_size/2);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Test
|
||||
@ -227,14 +227,13 @@ struct functor_team_for {
|
||||
|
||||
functor_team_for( Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag_ ) : flag( flag_ ) {}
|
||||
|
||||
unsigned team_shmem_size( int team_size ) const { return team_size * 13 * sizeof( Scalar ) + 8; }
|
||||
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 { return shared_int::shmem_size(team_size*13); }
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()( typename policy_type::member_type team ) const {
|
||||
typedef typename ExecutionSpace::scratch_memory_space shmem_space;
|
||||
typedef Kokkos::View< Scalar*, shmem_space, Kokkos::MemoryUnmanaged > shared_int;
|
||||
typedef typename shared_int::size_type size_type;
|
||||
|
||||
typedef typename shmem_space::size_type size_type;
|
||||
const size_type shmemSize = team.team_size() * 13;
|
||||
shared_int values = shared_int( team.team_shmem(), shmemSize );
|
||||
|
||||
@ -290,7 +289,9 @@ struct functor_team_reduce {
|
||||
|
||||
functor_team_reduce( Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag_ ) : flag( flag_ ) {}
|
||||
|
||||
unsigned team_shmem_size( int team_size ) const { return team_size * 13 * sizeof( Scalar ) + 8; }
|
||||
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 { return shared_int::shmem_size(team_size*13); }
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()( typename policy_type::member_type team ) const {
|
||||
@ -333,7 +334,9 @@ struct functor_team_reduce_reducer {
|
||||
|
||||
functor_team_reduce_reducer( Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag_ ) : flag( flag_ ) {}
|
||||
|
||||
unsigned team_shmem_size( int team_size ) const { return team_size * 13 * sizeof( Scalar ) + 8; }
|
||||
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 { return shared_int::shmem_size(team_size*13); }
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()( typename policy_type::member_type team ) const {
|
||||
@ -376,12 +379,12 @@ struct functor_team_vector_for {
|
||||
|
||||
functor_team_vector_for( Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag_ ) : flag( flag_ ) {}
|
||||
|
||||
unsigned team_shmem_size( int team_size ) const { return team_size * 13 * sizeof( Scalar ) + 8; }
|
||||
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 { return shared_int::shmem_size(team_size*13); }
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()( typename policy_type::member_type team ) const {
|
||||
typedef typename ExecutionSpace::scratch_memory_space shmem_space;
|
||||
typedef Kokkos::View< Scalar*, shmem_space, Kokkos::MemoryUnmanaged > shared_int;
|
||||
typedef typename shared_int::size_type size_type;
|
||||
|
||||
const size_type shmemSize = team.team_size() * 13;
|
||||
@ -442,7 +445,9 @@ struct functor_team_vector_reduce {
|
||||
Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag;
|
||||
functor_team_vector_reduce( Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag_ ) : flag( flag_ ) {}
|
||||
|
||||
unsigned team_shmem_size( int team_size ) const { return team_size * 13 * sizeof( Scalar ) + 8; }
|
||||
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 { return shared_int::shmem_size(team_size*13); }
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()( typename policy_type::member_type team ) const {
|
||||
@ -485,7 +490,9 @@ struct functor_team_vector_reduce_reducer {
|
||||
|
||||
functor_team_vector_reduce_reducer( Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag_ ) : flag( flag_ ) {}
|
||||
|
||||
unsigned team_shmem_size( int team_size ) const { return team_size * 13 * sizeof( Scalar ) + 8; }
|
||||
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 { return shared_int::shmem_size(team_size*13); }
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()( typename policy_type::member_type team ) const {
|
||||
@ -568,12 +575,12 @@ struct functor_vec_for {
|
||||
|
||||
functor_vec_for( Kokkos::View< int, Kokkos::LayoutLeft, ExecutionSpace > flag_ ) : flag( flag_ ) {}
|
||||
|
||||
unsigned team_shmem_size( int team_size ) const { return team_size * 13 * sizeof( Scalar ) + 8; }
|
||||
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 { return shared_int::shmem_size(team_size*13); }
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()( typename policy_type::member_type team ) const {
|
||||
typedef typename ExecutionSpace::scratch_memory_space shmem_space;
|
||||
typedef Kokkos::View< Scalar*, shmem_space, Kokkos::MemoryUnmanaged > shared_int;
|
||||
|
||||
shared_int values = shared_int( team.team_shmem(), team.team_size() * 13 );
|
||||
|
||||
@ -739,23 +746,16 @@ bool test_scalar( int nteams, int team_size, int test ) {
|
||||
functor_vec_red< Scalar, ExecutionSpace >( d_flag ) );
|
||||
}
|
||||
else if ( test == 1 ) {
|
||||
// WORKAROUND ROCM/CUDA
|
||||
// WORKAROUND CUDA
|
||||
#if defined(KOKKOS_ENABLE_CUDA)
|
||||
#if defined(KOKKOS_IMPL_CUDA_CLANG_WORKAROUND) || defined(KOKKOS_ARCH_PASCAL)
|
||||
if(!std::is_same<ExecutionSpace,Kokkos::Cuda>::value)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(KOKKOS_ENABLE_ROCM)
|
||||
if(!std::is_same<ExecutionSpace,Kokkos::Experimental::ROCm>::value)
|
||||
#endif
|
||||
Kokkos::parallel_for( Kokkos::TeamPolicy< ExecutionSpace >( nteams, team_size, 8 ),
|
||||
functor_vec_red_reducer< Scalar, ExecutionSpace >( d_flag ) );
|
||||
}
|
||||
else if ( test == 2 ) {
|
||||
// WORKAROUND ROCM
|
||||
#if defined(KOKKOS_ENABLE_ROCM)
|
||||
if(!std::is_same<ExecutionSpace,Kokkos::Experimental::ROCm>::value)
|
||||
#endif
|
||||
Kokkos::parallel_for( Kokkos::TeamPolicy< ExecutionSpace >( nteams, team_size, 8 ),
|
||||
functor_vec_scan< Scalar, ExecutionSpace >( d_flag ) );
|
||||
}
|
||||
@ -776,10 +776,6 @@ bool test_scalar( int nteams, int team_size, int test ) {
|
||||
functor_team_reduce< Scalar, ExecutionSpace >( d_flag ) );
|
||||
}
|
||||
else if ( test == 7 ) {
|
||||
// WORKAROUND ROCM
|
||||
#if defined(KOKKOS_ENABLE_ROCM)
|
||||
if(!std::is_same<ExecutionSpace,Kokkos::Experimental::ROCm>::value)
|
||||
#endif
|
||||
Kokkos::parallel_for( Kokkos::TeamPolicy< ExecutionSpace >( nteams, team_size ),
|
||||
functor_team_reduce_reducer< Scalar, ExecutionSpace >( d_flag ) );
|
||||
}
|
||||
@ -792,10 +788,6 @@ bool test_scalar( int nteams, int team_size, int test ) {
|
||||
functor_team_vector_reduce< Scalar, ExecutionSpace >( d_flag ) );
|
||||
}
|
||||
else if ( test == 10 ) {
|
||||
// WORKAROUND ROCM
|
||||
#if defined(KOKKOS_ENABLE_ROCM)
|
||||
if(!std::is_same<ExecutionSpace,Kokkos::Experimental::ROCm>::value)
|
||||
#endif
|
||||
Kokkos::parallel_for( Kokkos::TeamPolicy< ExecutionSpace >( nteams, team_size, 8 ),
|
||||
functor_team_vector_reduce_reducer< Scalar, ExecutionSpace >( d_flag ) );
|
||||
}
|
||||
@ -955,28 +947,22 @@ TEST_F( TEST_CATEGORY, triple_nested_parallelism )
|
||||
// With KOKKOS_DEBUG enabled, the functor uses too many registers to run
|
||||
// with a team size of 32 on GPUs, 16 is the max possible (at least on a K80 GPU)
|
||||
// See https://github.com/kokkos/kokkos/issues/1513
|
||||
#if defined(KOKKOS_DEBUG) && defined(KOKKOS_ENABLE_CUDA)
|
||||
#if defined(KOKKOS_ENABLE_DEBUG) && defined(KOKKOS_ENABLE_CUDA)
|
||||
if (!std::is_same<TEST_EXECSPACE, Kokkos::Cuda>::value) {
|
||||
#endif
|
||||
#ifdef KOKKOS_ENABLE_ROCM // ROCm doesn't support TeamSize 32x32
|
||||
if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::ROCm>::value) {
|
||||
if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::ROCm>::value)
|
||||
#endif
|
||||
TestTripleNestedReduce< double, TEST_EXECSPACE >( 8192, 2048, 32, 32 );
|
||||
#ifdef KOKKOS_ENABLE_ROCM
|
||||
}
|
||||
#endif
|
||||
TestTripleNestedReduce< double, TEST_EXECSPACE >( 8192, 2048, 32, 16 );
|
||||
#if defined(KOKKOS_DEBUG) && defined(KOKKOS_ENABLE_CUDA)
|
||||
#if defined(KOKKOS_ENABLE_DEBUG) && defined(KOKKOS_ENABLE_CUDA)
|
||||
}
|
||||
#endif
|
||||
TestTripleNestedReduce< double, TEST_EXECSPACE >( 8192, 2048, 16, 16 );
|
||||
#ifdef KOKKOS_ENABLE_ROCM // ROCm doesn't support team sizes not powers of two
|
||||
if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::ROCm>::value) {
|
||||
if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::ROCm>::value)
|
||||
#endif
|
||||
TestTripleNestedReduce< double, TEST_EXECSPACE >( 8192, 2048, 7, 16 );
|
||||
#ifdef KOKKOS_ENABLE_ROCM
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -45,11 +45,9 @@
|
||||
|
||||
namespace Test {
|
||||
|
||||
#if !defined(KOKKOS_ENABLE_ROCM)
|
||||
TEST_F( TEST_CATEGORY, view_api_a )
|
||||
{
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -45,13 +45,11 @@
|
||||
|
||||
namespace Test {
|
||||
|
||||
#if !defined(KOKKOS_ENABLE_ROCM)
|
||||
TEST_F( TEST_CATEGORY, view_api_b )
|
||||
{
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_view_operator_a();
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_mirror();
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_scalar();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -45,12 +45,10 @@
|
||||
|
||||
namespace Test {
|
||||
|
||||
#if !defined(KOKKOS_ENABLE_ROCM)
|
||||
TEST_F( TEST_CATEGORY, view_api_c )
|
||||
{
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_deep_copy_empty();
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_view_operator_b();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
|
||||
namespace Test {
|
||||
|
||||
#if !defined(KOKKOS_ENABLE_ROCM)
|
||||
TEST_F( TEST_CATEGORY, view_api_d )
|
||||
{
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_const();
|
||||
@ -54,6 +53,5 @@ TEST_F( TEST_CATEGORY, view_api_d )
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_vector();
|
||||
TestViewAPI< double, TEST_EXECSPACE >::run_test_view_operator_c();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
155
lib/kokkos/core/unit_test/TestViewCopy.hpp
Normal file
155
lib/kokkos/core/unit_test/TestViewCopy.hpp
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <gtest/gtest.h>
|
||||
|
||||
#include <Kokkos_Core.hpp>
|
||||
|
||||
namespace Test {
|
||||
|
||||
namespace {
|
||||
|
||||
template < typename ExecSpace >
|
||||
struct TestViewCopy {
|
||||
|
||||
using InExecSpace = ExecSpace;
|
||||
|
||||
static void test_view_copy()
|
||||
{
|
||||
#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
|
||||
{
|
||||
const int dim0 = 4;
|
||||
const int dim1 = 2;
|
||||
const int dim2 = 3;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// Test 2: deep_copy from Cuda to ExecSpace and ExecSpace back to Cuda
|
||||
{
|
||||
const int dim0 = 4;
|
||||
const int dim1 = 2;
|
||||
const int dim2 = 3;
|
||||
|
||||
typedef Kokkos::View<double****,InExecSpace> Rank4ViewType;
|
||||
Rank4ViewType view_4;
|
||||
view_4 = Rank4ViewType("view_4", dim0, dim1, dim2, dim2);
|
||||
|
||||
#if defined( KOKKOS_ENABLE_CUDA )
|
||||
typedef Kokkos::Cuda space_type;
|
||||
#endif
|
||||
#if defined( KOKKOS_ENABLE_ROCM )
|
||||
typedef Kokkos::Experimental::ROCm 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
|
||||
{
|
||||
const int dim0 = 4;
|
||||
const int dim1 = 2;
|
||||
const int dim2 = 3;
|
||||
|
||||
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
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_F( TEST_CATEGORY , view_copy_tests ) {
|
||||
//Only include this file to be compiled with CudaUVM and CudaHostPinned
|
||||
TestViewCopy< TEST_EXECSPACE >::test_view_copy();
|
||||
}
|
||||
|
||||
} // namespace Test
|
||||
740
lib/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp
Normal file
740
lib/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp
Normal file
@ -0,0 +1,740 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <gtest/gtest.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
|
||||
#include <Kokkos_Core.hpp>
|
||||
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , view_layoutstride_left_to_layoutleft_assignment )
|
||||
{
|
||||
typedef TEST_EXECSPACE exec_space ;
|
||||
|
||||
auto t = time(0);
|
||||
srand(t);// Use current time as seed for random generator
|
||||
printf("view_layoutstride_left_to_layoutleft_assignment: srand(%lu)\n",size_t(t));
|
||||
|
||||
{ // Assignment of rank-1 LayoutLeft = LayoutStride
|
||||
int ndims = 1;
|
||||
int dims [] = {10};
|
||||
int order [] = {0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-2 LayoutLeft = LayoutStride
|
||||
int ndims = 2;
|
||||
int dims [] = {10,9};
|
||||
int order [] = {0,1};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double**, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-3 LayoutLeft = LayoutStride
|
||||
int ndims = 3;
|
||||
int dims [] = {10,9,8};
|
||||
int order [] = {0,1,2};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double***, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-4 LayoutLeft = LayoutStride
|
||||
int ndims = 4;
|
||||
int dims [] = {10,9,8,7};
|
||||
int order [] = {0,1,2,3};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-5 LayoutLeft = LayoutStride
|
||||
int ndims = 5;
|
||||
int dims [] = {10,9,8,7,6};
|
||||
int order [] = {0,1,2,3,4};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-6 LayoutLeft = LayoutStride
|
||||
int ndims = 6;
|
||||
int dims [] = {10,9,8,7,6,5};
|
||||
int order [] = {0,1,2,3,4,5};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-7 LayoutLeft = LayoutStride
|
||||
int ndims = 7;
|
||||
int dims [] = {10,9,8,7,6,5,4};
|
||||
int order [] = {0,1,2,3,4,5,6};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-8 LayoutLeft = LayoutStride
|
||||
int ndims = 8;
|
||||
int dims [] = {10,9,8,7,6,5,4,3};
|
||||
int order [] = {0,1,2,3,4,5,6,7};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double********, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutLeft, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY , view_layoutstride_right_to_layoutright_assignment )
|
||||
{
|
||||
typedef TEST_EXECSPACE exec_space ;
|
||||
|
||||
auto t = time(0);
|
||||
srand(t);// Use current time as seed for random generator
|
||||
printf("view_layoutstride_right_to_layoutright_assignment: srand(%lu)\n",size_t(t));
|
||||
|
||||
{ // Assignment of rank-1 LayoutRight = LayoutStride
|
||||
int ndims = 1;
|
||||
int dims [] = {10};
|
||||
int order [] = {0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-2 LayoutRight = LayoutStride
|
||||
int ndims = 2;
|
||||
int dims [] = {10,9};
|
||||
int order [] = {1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double**, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-3 LayoutRight = LayoutStride
|
||||
int ndims = 3;
|
||||
int dims [] = {10,9,8};
|
||||
int order [] = {2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double***, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-4 LayoutRight = LayoutStride
|
||||
int ndims = 4;
|
||||
int dims [] = {10,9,8,7};
|
||||
int order [] = {3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-5 LayoutRight = LayoutStride
|
||||
int ndims = 5;
|
||||
int dims [] = {10,9,8,7,6};
|
||||
int order [] = {4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-6 LayoutRight = LayoutStride
|
||||
int ndims = 6;
|
||||
int dims [] = {10,9,8,7,6,5};
|
||||
int order [] = {5,4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-7 LayoutRight = LayoutStride
|
||||
int ndims = 7;
|
||||
int dims [] = {10,9,8,7,6,5,4};
|
||||
int order [] = {6,5,4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-8 LayoutRight = LayoutStride
|
||||
int ndims = 8;
|
||||
int dims [] = {10,9,8,7,6,5,4,3};
|
||||
int order [] = {7,6,5,4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double********, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutRight, exec_space > dst = src;
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY , view_layoutstride_right_to_layoutleft_assignment )
|
||||
{
|
||||
typedef TEST_EXECSPACE exec_space ;
|
||||
|
||||
auto t = time(0);
|
||||
srand(t);// Use current time as seed for random generator
|
||||
printf("view_layoutstride_right_to_layoutleft_assignment: srand(%lu)\n",size_t(t));
|
||||
|
||||
{ // Assignment of rank-1 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 1;
|
||||
int dims [] = {10};
|
||||
int order [] = {0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
dst = src;
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutLeft, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-2 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 2;
|
||||
int dims [] = {10,9};
|
||||
int order [] = {1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double**, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-3 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 3;
|
||||
int dims [] = {10,9,8};
|
||||
int order [] = {2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double***, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-4 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 4;
|
||||
int dims [] = {10,9,8,7};
|
||||
int order [] = {3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-5 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 5;
|
||||
int dims [] = {10,9,8,7,6};
|
||||
int order [] = {4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-6 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 6;
|
||||
int dims [] = {10,9,8,7,6,5};
|
||||
int order [] = {5,4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-7 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 7;
|
||||
int dims [] = {10,9,8,7,6,5,4};
|
||||
int order [] = {6,5,4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-8 LayoutLeft = LayoutStride (LayoutRight compatible)
|
||||
int ndims = 8;
|
||||
int dims [] = {10,9,8,7,6,5,4,3};
|
||||
int order [] = {7,6,5,4,3,2,1,0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double********, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutLeft, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY , view_layoutstride_left_to_layoutright_assignment )
|
||||
{
|
||||
typedef TEST_EXECSPACE exec_space ;
|
||||
|
||||
auto t = time(0);
|
||||
srand(t);// Use current time as seed for random generator
|
||||
printf("view_layoutstride_left_to_layoutright_assignment: srand(%lu)\n",size_t(t));
|
||||
|
||||
{ // Assignment of rank-1 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 1;
|
||||
int dims [] = {10};
|
||||
int order [] = {0};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutStride, exec_space >::HostMirror h_src = Kokkos::create_mirror_view( src );
|
||||
|
||||
for(size_t i=0; i<src.span(); i++) h_src.data()[i] = (double)rand() / RAND_MAX * (100);
|
||||
|
||||
Kokkos::deep_copy( src, h_src );
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
dst = src;
|
||||
|
||||
Kokkos::View< double*, Kokkos::LayoutRight, exec_space >::HostMirror h_dst = Kokkos::create_mirror_view( dst );
|
||||
|
||||
Kokkos::deep_copy( h_dst, dst );
|
||||
|
||||
bool test = true;
|
||||
for(size_t i=0; i<src.span();i++){
|
||||
if (h_src.data()[i]!=h_dst.data()[i]) {test = false;break;}
|
||||
}
|
||||
ASSERT_EQ( dst.span(), src.span() );
|
||||
ASSERT_EQ( test, true );
|
||||
}
|
||||
{ // Assignment of rank-2 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 2;
|
||||
int dims [] = {10,9};
|
||||
int order [] = {0,1};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double**, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double**, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-3 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 3;
|
||||
int dims [] = {10,9,8};
|
||||
int order [] = {0,1,2};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double***, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double***, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-4 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 4;
|
||||
int dims [] = {10,9,8,7};
|
||||
int order [] = {0,1,2,3};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double****, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-5 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 5;
|
||||
int dims [] = {10,9,8,7,6};
|
||||
int order [] = {0,1,2,3,4};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*****, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*****, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-6 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 6;
|
||||
int dims [] = {10,9,8,7,6,5};
|
||||
int order [] = {0,1,2,3,4,5};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double******, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-7 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 7;
|
||||
int dims [] = {10,9,8,7,6,5,4};
|
||||
int order [] = {0,1,2,3,4,5,6};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double*******, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double*******, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
{ // Assignment of rank-8 LayoutRight = LayoutStride (LayoutLeft compatible)
|
||||
int ndims = 8;
|
||||
int dims [] = {10,9,8,7,6,5,4,3};
|
||||
int order [] = {0,1,2,3,4,5,6,7};
|
||||
Kokkos::LayoutStride layout = Kokkos::LayoutStride::order_dimensions(ndims, order, dims);
|
||||
Kokkos::View< double********, Kokkos::LayoutStride, exec_space > src("LayoutStride", layout);
|
||||
|
||||
Kokkos::View< double********, Kokkos::LayoutRight, exec_space > dst;
|
||||
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
ASSERT_DEATH({dst=src;}, "View assignment must have compatible layouts");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1215
lib/kokkos/core/unit_test/TestViewLayoutTiled.hpp
Normal file
1215
lib/kokkos/core/unit_test/TestViewLayoutTiled.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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/TestCudaHostPinned_Category.hpp>
|
||||
#include <TestViewCopy.hpp>
|
||||
45
lib/kokkos/core/unit_test/cuda/TestCudaUVM_ViewCopy.cpp
Normal file
45
lib/kokkos/core/unit_test/cuda/TestCudaUVM_ViewCopy.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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/TestCudaUVM_Category.hpp>
|
||||
#include <TestViewCopy.hpp>
|
||||
@ -50,3 +50,4 @@
|
||||
#include<TestTile.hpp>
|
||||
|
||||
#include<TestViewCtorPropEmbeddedDim.hpp>
|
||||
#include<TestViewLayoutTiled.hpp>
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <TestReduceDeviceView.hpp>
|
||||
@ -68,6 +68,22 @@ TEST_F( TEST_CATEGORY, team_reduce )
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_reduce( 1000 );
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_reduce( 1000 );
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, team_broadcast )
|
||||
{
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 0 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 0 );
|
||||
|
||||
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> >::test_teambroadcast( 16 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 16 );
|
||||
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 1000 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 1000 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include <TestTeamVector.hpp>
|
||||
|
||||
@ -65,6 +65,10 @@ TEST_F( TEST_CATEGORY, team_lambda_shared_request )
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >();
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >();
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, scratch_align) {
|
||||
TestScratchAlignment< TEST_EXECSPACE >();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
45
lib/kokkos/core/unit_test/cuda/TestCuda_TeamTeamSize.cpp
Normal file
45
lib/kokkos/core/unit_test/cuda/TestCuda_TeamTeamSize.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <TestTeamTeamSize.hpp>
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <TestViewLayoutStrideAssignment.hpp>
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
#include<TestTile.hpp>
|
||||
|
||||
#include<TestViewCtorPropEmbeddedDim.hpp>
|
||||
#include<TestViewLayoutTiled.hpp>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <openmp/TestOpenMP_Category.hpp>
|
||||
#include <TestReduceDeviceView.hpp>
|
||||
@ -68,6 +68,21 @@ TEST_F( TEST_CATEGORY, team_reduce )
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_reduce( 1000 );
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_reduce( 1000 );
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, team_broadcast )
|
||||
{
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 0 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 0 );
|
||||
|
||||
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> >::test_teambroadcast( 16 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 16 );
|
||||
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 1000 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 1000 );
|
||||
}
|
||||
}
|
||||
|
||||
#include <TestTeamVector.hpp>
|
||||
|
||||
@ -65,6 +65,9 @@ TEST_F( TEST_CATEGORY, team_lambda_shared_request )
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >();
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >();
|
||||
}
|
||||
TEST_F( TEST_CATEGORY, scratch_align) {
|
||||
TestScratchAlignment< TEST_EXECSPACE >();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
46
lib/kokkos/core/unit_test/openmp/TestOpenMP_TeamTeamSize.cpp
Normal file
46
lib/kokkos/core/unit_test/openmp/TestOpenMP_TeamTeamSize.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <openmp/TestOpenMP_Category.hpp>
|
||||
#include <TestTeamTeamSize.hpp>
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <openmp/TestOpenMP_Category.hpp>
|
||||
#include <TestViewLayoutStrideAssignment.hpp>
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <rocm/TestROCmHostPinned_Category.hpp>
|
||||
#include <TestViewCopy.hpp>
|
||||
47
lib/kokkos/core/unit_test/rocm/TestROCm_Crs.cpp
Normal file
47
lib/kokkos/core/unit_test/rocm/TestROCm_Crs.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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<rocm/TestROCm_Category.hpp>
|
||||
#include<TestCrs.hpp>
|
||||
|
||||
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_a.cpp
Normal file
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_a.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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<rocm/TestROCm_Category.hpp>
|
||||
#include<TestMDRange.hpp>
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_5d_reduce ) {
|
||||
TestMDRange_5D< TEST_EXECSPACE >::test_reduce5( 100, 10, 10, 10, 5 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_b.cpp
Normal file
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_b.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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<rocm/TestROCm_Category.hpp>
|
||||
#include<TestMDRange.hpp>
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_6d_reduce ) {
|
||||
TestMDRange_6D< TEST_EXECSPACE >::test_reduce6( 10, 10, 10, 10, 10, 5 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_c.cpp
Normal file
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_c.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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<rocm/TestROCm_Category.hpp>
|
||||
#include<TestMDRange.hpp>
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_2d_reduce ) {
|
||||
TestMDRange_2D< TEST_EXECSPACE >::test_reduce2( 100, 100 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_d.cpp
Normal file
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_d.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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<rocm/TestROCm_Category.hpp>
|
||||
#include<TestMDRange.hpp>
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_3d_reduce ) {
|
||||
TestMDRange_3D< TEST_EXECSPACE >::test_reduce3( 100, 100, 5 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_e.cpp
Normal file
54
lib/kokkos/core/unit_test/rocm/TestROCm_MDRangeReduce_e.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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<rocm/TestROCm_Category.hpp>
|
||||
#include<TestMDRange.hpp>
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY , mdrange_4d_reduce ) {
|
||||
TestMDRange_4D< TEST_EXECSPACE >::test_reduce4( 100, 100, 10, 5 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
lib/kokkos/core/unit_test/rocm/TestROCm_SubView_c13.cpp
Normal file
54
lib/kokkos/core/unit_test/rocm/TestROCm_SubView_c13.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <rocm/TestROCmHostPinned_Category.hpp>
|
||||
#include <TestViewSubview.hpp>
|
||||
|
||||
namespace Test {
|
||||
|
||||
TEST_F( TEST_CATEGORY, view_test_unmanaged_subview_reset )
|
||||
{
|
||||
TestViewSubview::test_unmanaged_subview_reset< TEST_EXECSPACE >();
|
||||
}
|
||||
|
||||
} // namespace Test
|
||||
@ -46,7 +46,6 @@
|
||||
|
||||
namespace Test {
|
||||
|
||||
#if !defined(KOKKOS_ROCM_CLANG_WORKAROUND)
|
||||
TEST_F( TEST_CATEGORY, team_scan )
|
||||
{
|
||||
TestScanTeam< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >( 0 );
|
||||
@ -56,7 +55,6 @@ TEST_F( TEST_CATEGORY, team_scan )
|
||||
TestScanTeam< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >( 10000 );
|
||||
TestScanTeam< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >( 10000 );
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F( TEST_CATEGORY, team_long_reduce )
|
||||
{
|
||||
|
||||
@ -65,6 +65,10 @@ TEST_F( TEST_CATEGORY, team_lambda_shared_request )
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >();
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >();
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, scratch_align) {
|
||||
TestScratchAlignment< TEST_EXECSPACE >();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
49
lib/kokkos/core/unit_test/rocm/TestROCm_TeamTeamSize.cpp
Normal file
49
lib/kokkos/core/unit_test/rocm/TestROCm_TeamTeamSize.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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
|
||||
*/
|
||||
|
||||
// Doesn't work right now due to bug with static sized array member
|
||||
|
||||
//#include <rocm/TestROCm_Category.hpp>
|
||||
//#ifndef KOKKOS_IMPL_ROCM_CLANG_WORKAROUND
|
||||
//#include <TestTeamTeamSize.hpp>
|
||||
//#endif
|
||||
@ -50,3 +50,4 @@
|
||||
#include<TestTile.hpp>
|
||||
|
||||
#include<TestViewCtorPropEmbeddedDim.hpp>
|
||||
#include<TestViewLayoutTiled.hpp>
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <serial/TestSerial_Category.hpp>
|
||||
#include <TestReduceDeviceView.hpp>
|
||||
@ -68,6 +68,21 @@ TEST_F( TEST_CATEGORY, team_reduce )
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_reduce( 1000 );
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_reduce( 1000 );
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, team_broadcast )
|
||||
{
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 0 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 0 );
|
||||
|
||||
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> >::test_teambroadcast( 16 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 16 );
|
||||
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 1000 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 1000 );
|
||||
}
|
||||
}
|
||||
|
||||
#include <TestTeamVector.hpp>
|
||||
|
||||
@ -65,6 +65,10 @@ TEST_F( TEST_CATEGORY, team_lambda_shared_request )
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >();
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >();
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, scratch_align) {
|
||||
TestScratchAlignment< TEST_EXECSPACE >();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
45
lib/kokkos/core/unit_test/serial/TestSerial_TeamTeamSize.cpp
Normal file
45
lib/kokkos/core/unit_test/serial/TestSerial_TeamTeamSize.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <serial/TestSerial_Category.hpp>
|
||||
#include <TestTeamTeamSize.hpp>
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <serial/TestSerial_Category.hpp>
|
||||
#include <TestViewLayoutStrideAssignment.hpp>
|
||||
|
||||
55
lib/kokkos/core/unit_test/standalone/Makefile
Normal file
55
lib/kokkos/core/unit_test/standalone/Makefile
Normal file
@ -0,0 +1,55 @@
|
||||
KOKKOS_DEVICES=Cuda
|
||||
KOKKOS_CUDA_OPTIONS=enable_lambda
|
||||
KOKKOS_ARCH = "SNB,Kepler35"
|
||||
|
||||
MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
ifndef KOKKOS_PATH
|
||||
KOKKOS_PATH = $(MAKEFILE_PATH)../../../
|
||||
endif
|
||||
|
||||
SRC = $(wildcard $(MAKEFILE_PATH)*.cpp)
|
||||
HEADERS = $(wildcard $(MAKEFILE_PATH)*.hpp)
|
||||
HEADERS = $(wildcard $(MAKEFILE_PATH)/../*.hpp)
|
||||
|
||||
vpath %.cpp $(sort $(dir $(SRC)))
|
||||
|
||||
default: build
|
||||
echo "Start Build"
|
||||
|
||||
ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES)))
|
||||
CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper
|
||||
EXE = test.cuda
|
||||
else
|
||||
CXX = g++
|
||||
EXE = test.host
|
||||
endif
|
||||
|
||||
CXXFLAGS ?= -O3 -g
|
||||
override CXXFLAGS += -I$(MAKEFILE_PATH) -I$(KOKKOS_PATH)/core/unit_test -I$(KOKKOS_PATH)/tpls/gtest -DTESTFILE=$(TESTFILE)
|
||||
#SRC += $(KOKKOS_PATH)/tpls/gtest/gtest/gtest-all.cc
|
||||
|
||||
DEPFLAGS = -M
|
||||
LINK = ${CXX}
|
||||
LINKFLAGS =
|
||||
|
||||
OBJ = $(notdir $(SRC:.cpp=.o))
|
||||
LIB =
|
||||
|
||||
include $(KOKKOS_PATH)/Makefile.kokkos
|
||||
|
||||
build: $(EXE)
|
||||
|
||||
$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS) gtest-all.o
|
||||
$(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) gtest-all.o -o $(EXE)
|
||||
|
||||
clean: kokkos-clean
|
||||
rm -f *.o *.cuda *.host
|
||||
|
||||
# Compilation rules
|
||||
|
||||
%.o:%.cpp $(KOKKOS_CPP_DEPENDS) $(HEADERS)
|
||||
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< -o $(notdir $@)
|
||||
|
||||
gtest-all.o:$(KOKKOS_PATH)/tpls/gtest/gtest/gtest-all.cc
|
||||
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $(KOKKOS_PATH)/tpls/gtest/gtest/gtest-all.cc
|
||||
71
lib/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp
Normal file
71
lib/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <gtest/gtest.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <Kokkos_Core.hpp>
|
||||
|
||||
#ifdef KOKKOS_ENABLE_ROCM
|
||||
#include <rocm/TestROCm_Category.hpp>
|
||||
#endif
|
||||
#ifdef KOKKOS_ENABLE_CUDA
|
||||
#include <cuda/TestCuda_Category.hpp>
|
||||
#endif
|
||||
#ifdef KOKKOS_ENABLE_OPENMP
|
||||
#include <openmp/TestOpenMP_Category.hpp>
|
||||
#endif
|
||||
#ifdef KOKKOS_ENABLE_THREADS
|
||||
#include <threads/TestThreads_Category.hpp>
|
||||
#endif
|
||||
|
||||
#include <TestMemoryPool.hpp>
|
||||
|
||||
int main( int argc, char *argv[] ) {
|
||||
Kokkos::initialize(argc,argv);
|
||||
::testing::InitGoogleTest( &argc, argv );
|
||||
|
||||
int result = RUN_ALL_TESTS();
|
||||
Kokkos::finalize();
|
||||
return result;
|
||||
}
|
||||
@ -50,3 +50,4 @@
|
||||
#include<TestTile.hpp>
|
||||
|
||||
#include<TestViewCtorPropEmbeddedDim.hpp>
|
||||
#include<TestViewLayoutTiled.hpp>
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <threads/TestThreads_Category.hpp>
|
||||
#include <TestReduceDeviceView.hpp>
|
||||
@ -68,6 +68,21 @@ TEST_F( TEST_CATEGORY, team_reduce )
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_reduce( 1000 );
|
||||
TestTeamPolicy< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_reduce( 1000 );
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, team_broadcast )
|
||||
{
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 0 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 0 );
|
||||
|
||||
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> >::test_teambroadcast( 16 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 16 );
|
||||
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >::test_teambroadcast( 1000 );
|
||||
TestTeamBroadcast< TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >::test_teambroadcast( 1000 );
|
||||
}
|
||||
}
|
||||
|
||||
#include <TestTeamVector.hpp>
|
||||
|
||||
@ -65,6 +65,10 @@ TEST_F( TEST_CATEGORY, team_lambda_shared_request )
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> >();
|
||||
TestLambdaSharedTeam< Kokkos::HostSpace, TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> >();
|
||||
}
|
||||
|
||||
TEST_F( TEST_CATEGORY, scratch_align) {
|
||||
TestScratchAlignment< TEST_EXECSPACE >();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <threads/TestThreads_Category.hpp>
|
||||
#include <TestTeamTeamSize.hpp>
|
||||
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 2.0
|
||||
// Copyright (2014) Sandia Corporation
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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 <threads/TestThreads_Category.hpp>
|
||||
#include <TestViewLayoutStrideAssignment.hpp>
|
||||
|
||||
Reference in New Issue
Block a user