Update Kokkos to v2.04.11

This commit is contained in:
Stan Moore
2017-11-06 13:47:33 -07:00
parent 39df9f5d94
commit 16b5315845
117 changed files with 33239 additions and 1093 deletions

View File

@ -49,6 +49,7 @@ IF(Kokkos_ENABLE_Serial)
serial/TestSerial_SubView_c10.cpp
serial/TestSerial_SubView_c11.cpp
serial/TestSerial_SubView_c12.cpp
serial/TestSerial_SubView_c13.cpp
serial/TestSerial_Team.cpp
serial/TestSerial_TeamReductionScan.cpp
serial/TestSerial_TeamScratch.cpp
@ -96,6 +97,7 @@ IF(Kokkos_ENABLE_Pthread)
threads/TestThreads_SubView_c10.cpp
threads/TestThreads_SubView_c11.cpp
threads/TestThreads_SubView_c12.cpp
threads/TestThreads_SubView_c13.cpp
threads/TestThreads_Team.cpp
threads/TestThreads_TeamReductionScan.cpp
threads/TestThreads_TeamScratch.cpp
@ -143,6 +145,7 @@ IF(Kokkos_ENABLE_OpenMP)
openmp/TestOpenMP_SubView_c10.cpp
openmp/TestOpenMP_SubView_c11.cpp
openmp/TestOpenMP_SubView_c12.cpp
openmp/TestOpenMP_SubView_c13.cpp
openmp/TestOpenMP_Task.cpp
openmp/TestOpenMP_Team.cpp
openmp/TestOpenMP_TeamReductionScan.cpp
@ -184,6 +187,7 @@ IF(Kokkos_ENABLE_Qthreads)
qthreads/TestQthreads_SubView_c10.cpp
qthreads/TestQthreads_SubView_c11.cpp
qthreads/TestQthreads_SubView_c12.cpp
qthreads/TestQthreads_SubView_c13.cpp
qthreads/TestQthreads_Team.cpp
qthreads/TestQthreads_ViewAPI_a.cpp
qthreads/TestQthreads_ViewAPI_b.cpp
@ -235,6 +239,7 @@ IF(Kokkos_ENABLE_Cuda)
cuda/TestCuda_SubView_c10.cpp
cuda/TestCuda_SubView_c11.cpp
cuda/TestCuda_SubView_c12.cpp
cuda/TestCuda_SubView_c13.cpp
cuda/TestCuda_Task.cpp
cuda/TestCuda_Team.cpp
cuda/TestCuda_TeamReductionScan.cpp

View File

@ -56,6 +56,7 @@ else
OBJ_CUDA += TestCuda_SubView_c04.o TestCuda_SubView_c05.o TestCuda_SubView_c06.o
OBJ_CUDA += TestCuda_SubView_c07.o TestCuda_SubView_c08.o TestCuda_SubView_c09.o
OBJ_CUDA += TestCuda_SubView_c10.o TestCuda_SubView_c11.o TestCuda_SubView_c12.o
OBJ_CUDA += TestCuda_SubView_c13.o
endif
OBJ_CUDA += TestCuda_Reductions.o TestCuda_Scan.o
OBJ_CUDA += TestCuda_Complex.o
@ -169,6 +170,7 @@ else
OBJ_OPENMP += TestOpenMP_SubView_c04.o TestOpenMP_SubView_c05.o TestOpenMP_SubView_c06.o
OBJ_OPENMP += TestOpenMP_SubView_c07.o TestOpenMP_SubView_c08.o TestOpenMP_SubView_c09.o
OBJ_OPENMP += TestOpenMP_SubView_c10.o TestOpenMP_SubView_c11.o TestOpenMP_SubView_c12.o
OBJ_OPENMP += TestOpenMP_SubView_c13.o
endif
OBJ_OPENMP += TestOpenMP_Reductions.o TestOpenMP_Scan.o
OBJ_OPENMP += TestOpenMP_Complex.o
@ -258,6 +260,7 @@ else
OBJ_SERIAL += TestSerial_SubView_c04.o TestSerial_SubView_c05.o TestSerial_SubView_c06.o
OBJ_SERIAL += TestSerial_SubView_c07.o TestSerial_SubView_c08.o TestSerial_SubView_c09.o
OBJ_SERIAL += TestSerial_SubView_c10.o TestSerial_SubView_c11.o TestSerial_SubView_c12.o
OBJ_SERIAL += TestSerial_SubView_c13.o
endif
OBJ_SERIAL += TestSerial_Reductions.o TestSerial_Scan.o
OBJ_SERIAL += TestSerial_Complex.o

View File

@ -467,6 +467,7 @@ TEST_F( TEST_CATEGORY, atomics )
ASSERT_TRUE( ( TestAtomic::Loop< float, TEST_EXECSPACE >( 100, 3 ) ) );
#ifndef KOKKOS_ENABLE_OPENMPTARGET
#ifndef KOKKOS_ENABLE_ROCM
ASSERT_TRUE( ( TestAtomic::Loop< Kokkos::complex<double>, TEST_EXECSPACE >( 100, 1 ) ) );
ASSERT_TRUE( ( TestAtomic::Loop< Kokkos::complex<double>, TEST_EXECSPACE >( 100, 2 ) ) );
ASSERT_TRUE( ( TestAtomic::Loop< Kokkos::complex<double>, TEST_EXECSPACE >( 100, 3 ) ) );
@ -475,6 +476,7 @@ TEST_F( TEST_CATEGORY, atomics )
ASSERT_TRUE( ( TestAtomic::Loop< TestAtomic::SuperScalar<4>, TEST_EXECSPACE >( 100, 2 ) ) );
ASSERT_TRUE( ( TestAtomic::Loop< TestAtomic::SuperScalar<4>, TEST_EXECSPACE >( 100, 3 ) ) );
#endif
#endif
}

View File

@ -71,11 +71,13 @@ 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
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());
r = sb*a; r_kk = b*a; ASSERT_FLOAT_EQ(r.real(),r_kk.real()); ASSERT_FLOAT_EQ(r.imag(),r_kk.imag());
r = sa; r_kk = a; ASSERT_FLOAT_EQ(r.real(),r_kk.real()); ASSERT_FLOAT_EQ(r.imag(),r_kk.imag());
#endif
}

View File

@ -65,8 +65,8 @@ struct CountFillFunctor {
template< class ExecSpace >
void test_count_fill(std::int32_t nrows) {
Kokkos::Experimental::Crs<std::int32_t, ExecSpace, void, std::int32_t> graph;
Kokkos::Experimental::count_and_fill_crs(graph, nrows, CountFillFunctor<ExecSpace>());
Kokkos::Crs<std::int32_t, ExecSpace, void, std::int32_t> graph;
Kokkos::count_and_fill_crs(graph, nrows, CountFillFunctor<ExecSpace>());
ASSERT_EQ(graph.numRows(), nrows);
auto row_map = Kokkos::create_mirror_view(graph.row_map);
Kokkos::deep_copy(row_map, graph.row_map);

View File

@ -2489,6 +2489,303 @@ struct TestMDRange_6D {
}
};
template <typename ExecSpace >
struct TestMDRange_2D_NegIdx {
using value_type = double;
using DataType = int;
using ViewType = typename Kokkos::View< DataType**, ExecSpace >;
using HostViewType = typename ViewType::HostMirror;
ViewType input_view;
DataType lower_offset[2];
TestMDRange_2D_NegIdx( const DataType L0, const DataType L1, const DataType N0, const DataType N1 ) : input_view( "input_view", N0 - L0, N1 - L1 )
{
lower_offset[0] = L0;
lower_offset[1] = L1;
}
// When using negative indices, must offset View appropriately as views cannot take a negative index
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j ) const
{
input_view( i - lower_offset[0], j - lower_offset[1] ) = 1;
}
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, value_type &lsum ) const
{
lsum += input_view( i - lower_offset[0], j - lower_offset[1] ) * 2;
}
static void test_2D_negidx( const int N0, const int N1 )
{
using namespace Kokkos::Experimental;
{
typedef typename Kokkos::Experimental::MDRangePolicy< ExecSpace, Rank<2>, Kokkos::IndexType<int> > range_type;
typedef typename range_type::tile_type tile_type;
typedef typename range_type::point_type point_type;
const point_type lower{{-1, -1}};
const point_type upper{{N0, N1}};
const tile_type tile{{8,8}};
range_type range( point_type{{ lower[0], lower[1] }}, point_type{{ upper[0], upper[1] }}, tile_type{{ tile[0], tile[1] }} );
TestMDRange_2D_NegIdx functor( lower[0], lower[1], upper[0], upper[1] );
parallel_for( range, functor );
double sum = 0.0;
parallel_reduce( range, functor, sum );
ASSERT_EQ( sum, 2 * (upper[0] - lower[0]) * (upper[1] - lower[1]) );
}
}
};
template <typename ExecSpace >
struct TestMDRange_3D_NegIdx {
using value_type = double;
using DataType = int;
using ViewType = typename Kokkos::View< DataType***, ExecSpace >;
using HostViewType = typename ViewType::HostMirror;
ViewType input_view;
DataType lower_offset[3];
TestMDRange_3D_NegIdx( const DataType L0, const DataType L1, const DataType L2, const DataType N0, const DataType N1, const DataType N2 ) : input_view( "input_view", N0 - L0, N1 - L1, N2 - L2 )
{
lower_offset[0] = L0;
lower_offset[1] = L1;
lower_offset[2] = L2;
}
// When using negative indices, must offset View appropriately as views cannot take a negative index
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k ) const
{
input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2] ) = 1;
}
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k, value_type &lsum ) const
{
lsum += input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2] ) * 2;
}
static void test_3D_negidx( const int N0, const int N1, const int N2 )
{
using namespace Kokkos::Experimental;
{
typedef typename Kokkos::Experimental::MDRangePolicy< ExecSpace, Rank<3>, Kokkos::IndexType<int> > range_type;
typedef typename range_type::tile_type tile_type;
typedef typename range_type::point_type point_type;
const point_type lower{{-1, -1, -1}};
const point_type upper{{N0, N1, N2}};
const tile_type tile{{8,8,2}};
range_type range( point_type{{ lower[0], lower[1], lower[2] }}, point_type{{ upper[0], upper[1], upper[2] }}, tile_type{{ tile[0], tile[1], tile[2] }} );
TestMDRange_3D_NegIdx functor( lower[0], lower[1], lower[2], upper[0], upper[1], upper[2] );
parallel_for( range, functor );
double sum = 0.0;
parallel_reduce( range, functor, sum );
ASSERT_EQ( sum, 2 * (upper[0] - lower[0]) * (upper[1] - lower[1]) * (upper[2] - lower[2]) );
}
}
};
template <typename ExecSpace >
struct TestMDRange_4D_NegIdx {
using value_type = double;
using DataType = int;
using ViewType = typename Kokkos::View< DataType****, ExecSpace >;
using HostViewType = typename ViewType::HostMirror;
ViewType input_view;
DataType lower_offset[4];
TestMDRange_4D_NegIdx( const DataType L0, const DataType L1, const DataType L2, const DataType L3, const DataType N0, const DataType N1, const DataType N2, const DataType N3 ) : input_view( "input_view", N0 - L0, N1 - L1, N2 - L2, N3 - L3 )
{
lower_offset[0] = L0;
lower_offset[1] = L1;
lower_offset[2] = L2;
lower_offset[3] = L3;
}
// When using negative indices, must offset View appropriately as views cannot take a negative index
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k, const int l ) const
{
input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2], l - lower_offset[3] ) = 1;
}
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k, const int l, value_type &lsum ) const
{
lsum += input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2], l - lower_offset[3] ) * 2;
}
static void test_4D_negidx( const int N0, const int N1, const int N2, const int N3 )
{
using namespace Kokkos::Experimental;
{
typedef typename Kokkos::Experimental::MDRangePolicy< ExecSpace, Rank<4>, Kokkos::IndexType<int> > range_type;
typedef typename range_type::tile_type tile_type;
typedef typename range_type::point_type point_type;
const point_type lower{{-1, -1, -1, -1}};
const point_type upper{{N0, N1, N2, N3}};
const tile_type tile{{8,8,2,2}};
range_type range( point_type{{ lower[0], lower[1], lower[2], lower[3] }}, point_type{{ upper[0], upper[1], upper[2], upper[3] }}, tile_type{{ tile[0], tile[1], tile[2], tile[3] }} );
TestMDRange_4D_NegIdx functor( lower[0], lower[1], lower[2], lower[3], upper[0], upper[1], upper[2], upper[3] );
parallel_for( range, functor );
double sum = 0.0;
parallel_reduce( range, functor, sum );
ASSERT_EQ( sum, 2 * (upper[0] - lower[0]) * (upper[1] - lower[1]) * (upper[2] - lower[2]) * (upper[3] - lower[3]) );
}
}
};
template <typename ExecSpace >
struct TestMDRange_5D_NegIdx {
using value_type = double;
using DataType = int;
using ViewType = typename Kokkos::View< DataType*****, ExecSpace >;
using HostViewType = typename ViewType::HostMirror;
ViewType input_view;
DataType lower_offset[5];
TestMDRange_5D_NegIdx( const DataType L0, const DataType L1, const DataType L2, const DataType L3, const DataType L4, const DataType N0, const DataType N1, const DataType N2, const DataType N3, const DataType N4 ) : input_view( "input_view", N0 - L0, N1 - L1, N2 - L2, N3 - L3, N4 - L4 )
{
lower_offset[0] = L0;
lower_offset[1] = L1;
lower_offset[2] = L2;
lower_offset[3] = L3;
lower_offset[4] = L4;
}
// When using negative indices, must offset View appropriately as views cannot take a negative index
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k, const int l, const int m ) const
{
input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2], l - lower_offset[3], m - lower_offset[4] ) = 1;
}
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k, const int l, const int m, value_type &lsum ) const
{
lsum += input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2], l - lower_offset[3], m - lower_offset[4] ) * 2;
}
static void test_5D_negidx( const int N0, const int N1, const int N2, const int N3, const int N4 )
{
using namespace Kokkos::Experimental;
{
typedef typename Kokkos::Experimental::MDRangePolicy< ExecSpace, Rank<5>, Kokkos::IndexType<int> > range_type;
typedef typename range_type::tile_type tile_type;
typedef typename range_type::point_type point_type;
const point_type lower{{-1, -1, -1, -1, -1}};
const point_type upper{{N0, N1, N2, N3, N4}};
const tile_type tile{{8,4,2,2,2}};
range_type range( point_type{{ lower[0], lower[1], lower[2], lower[3], lower[4] }}, point_type{{ upper[0], upper[1], upper[2], upper[3], upper[4] }}, tile_type{{ tile[0], tile[1], tile[2], tile[3], tile[4] }} );
TestMDRange_5D_NegIdx functor( lower[0], lower[1], lower[2], lower[3], lower[4], upper[0], upper[1], upper[2], upper[3], upper[4] );
parallel_for( range, functor );
double sum = 0.0;
parallel_reduce( range, functor, sum );
ASSERT_EQ( sum, 2 * (upper[0] - lower[0]) * (upper[1] - lower[1]) * (upper[2] - lower[2]) * (upper[3] - lower[3]) * (upper[4] - lower[4]) );
}
}
};
template <typename ExecSpace >
struct TestMDRange_6D_NegIdx {
using value_type = double;
using DataType = int;
using ViewType = typename Kokkos::View< DataType******, ExecSpace >;
using HostViewType = typename ViewType::HostMirror;
ViewType input_view;
DataType lower_offset[6];
TestMDRange_6D_NegIdx( const DataType L0, const DataType L1, const DataType L2, const DataType L3, const DataType L4, const DataType L5, const DataType N0, const DataType N1, const DataType N2, const DataType N3, const DataType N4, const DataType N5 ) : input_view( "input_view", N0 - L0, N1 - L1, N2 - L2, N3 - L3, N4 - L4, N5 - L5 )
{
lower_offset[0] = L0;
lower_offset[1] = L1;
lower_offset[2] = L2;
lower_offset[3] = L3;
lower_offset[4] = L4;
lower_offset[5] = L5;
}
// When using negative indices, must offset View appropriately as views cannot take a negative index
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k, const int l, const int m, const int n ) const
{
input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2], l - lower_offset[3], m - lower_offset[4], n - lower_offset[5] ) = 1;
}
KOKKOS_INLINE_FUNCTION
void operator()( const int i, const int j, const int k, const int l, const int m, const int n, value_type &lsum ) const
{
lsum += input_view( i - lower_offset[0], j - lower_offset[1], k - lower_offset[2], l - lower_offset[3], m - lower_offset[4], n - lower_offset[5] ) * 2;
}
static void test_6D_negidx( const int N0, const int N1, const int N2, const int N3, const int N4, const int N5 )
{
using namespace Kokkos::Experimental;
{
typedef typename Kokkos::Experimental::MDRangePolicy< ExecSpace, Rank<6>, Kokkos::IndexType<int> > range_type;
typedef typename range_type::tile_type tile_type;
typedef typename range_type::point_type point_type;
const point_type lower{{-1, -1, -1, -1, -1, -1}};
const point_type upper{{N0, N1, N2, N3, N4, N5}};
const tile_type tile{{8,4,2,2,2,1}};
range_type range( point_type{{ lower[0], lower[1], lower[2], lower[3], lower[4], lower[5] }}, point_type{{ upper[0], upper[1], upper[2], upper[3], upper[4], upper[5] }}, tile_type{{ tile[0], tile[1], tile[2], tile[3], tile[4], tile[5] }} );
TestMDRange_6D_NegIdx functor( lower[0], lower[1], lower[2], lower[3], lower[4], lower[5], upper[0], upper[1], upper[2], upper[3], upper[4], upper[5] );
parallel_for( range, functor );
double sum = 0.0;
parallel_reduce( range, functor, sum );
ASSERT_EQ( sum, 2 * (upper[0] - lower[0]) * (upper[1] - lower[1]) * (upper[2] - lower[2]) * (upper[3] - lower[3]) * (upper[4] - lower[4]) * (upper[5] - lower[5]) );
}
}
};
} // namespace
TEST_F( TEST_CATEGORY , mdrange_for ) {
@ -2512,6 +2809,14 @@ TEST_F( TEST_CATEGORY , mdrange_array_reduce ) {
TestMDRange_ReduceArray_2D< TEST_EXECSPACE >::test_arrayreduce2( 4, 5 );
TestMDRange_ReduceArray_3D< TEST_EXECSPACE >::test_arrayreduce3( 4, 5, 10 );
}
TEST_F( TEST_CATEGORY , mdrange_neg_idx ) {
TestMDRange_2D_NegIdx< TEST_EXECSPACE >::test_2D_negidx( 128, 32 );
TestMDRange_3D_NegIdx< TEST_EXECSPACE >::test_3D_negidx( 128, 32, 8 );
TestMDRange_4D_NegIdx< TEST_EXECSPACE >::test_4D_negidx( 128, 32, 8, 8 );
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 );
}
//#endif
} // namespace Test

View File

@ -521,6 +521,101 @@ void test_memory_pool_corners( const bool print_statistics
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
template< class DeviceType , class Enable = void >
struct TestMemoryPoolHuge
{
TestMemoryPoolHuge() {}
enum : size_t { num_superblock = 0 };
using value_type = long ;
KOKKOS_INLINE_FUNCTION
void operator()( int i , long & err ) const noexcept {}
KOKKOS_INLINE_FUNCTION
void operator()( int i ) const noexcept {}
};
template< class DeviceType >
struct TestMemoryPoolHuge< DeviceType
, typename std::enable_if<
std::is_same< Kokkos::HostSpace
, typename DeviceType::memory_space >
::value >::type
>
{
typedef Kokkos::View< uintptr_t * , DeviceType > ptrs_type ;
typedef Kokkos::MemoryPool< DeviceType > pool_type ;
typedef typename DeviceType::memory_space memory_space ;
pool_type pool ;
ptrs_type ptrs ;
enum : size_t { min_block_size = 512
, max_block_size = 1lu << 31
, min_superblock_size = max_block_size
, num_superblock = 4
, total_alloc_size = num_superblock * max_block_size };
TestMemoryPoolHuge()
: pool( memory_space()
, total_alloc_size
, min_block_size
, max_block_size
, min_superblock_size )
, ptrs( "ptrs" , num_superblock )
{}
// Specify reduction argument value_type to
// avoid confusion with tag-dispatch.
using value_type = long ;
void operator()( int i , long & err ) const noexcept
{
if ( i < int(num_superblock) ) {
ptrs(i) = (uintptr_t) pool.allocate( max_block_size );
#if 0
printf("TestMemoryPoolHuge size(0x%lx) ptr(0x%lx)\n"
, max_block_size
, ptrs(i) );
#endif
if ( ! ptrs(i) ) {
Kokkos::abort("TestMemoryPoolHuge");
++err ;
}
}
}
void operator()( int i ) const noexcept
{
if ( i < int(num_superblock) ) {
pool.deallocate( (void*) ptrs(i) , max_block_size );
ptrs(i) = 0 ;
}
}
};
template< class DeviceType >
void test_memory_pool_huge()
{
typedef typename DeviceType::execution_space execution_space ;
typedef TestMemoryPoolHuge< DeviceType > functor_type ;
typedef Kokkos::RangePolicy< execution_space > policy_type ;
functor_type f ;
policy_type policy( 0 , functor_type::num_superblock );
long err = 0 ;
Kokkos::parallel_reduce( policy , f , err );
Kokkos::parallel_for( policy , f );
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
} // namespace TestMemoryPool
namespace Test {
@ -531,6 +626,7 @@ 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);
TestMemoryPool::test_memory_pool_huge< TEST_EXECSPACE >();
}
}

View File

@ -141,13 +141,13 @@ struct TestFib
enum { MinBlockSize = 64 };
enum { MaxBlockSize = 1024 };
enum { SuperBlockSize = 1u << 12 };
enum { SuperBlockSize = 4096 };
sched_type root_sched( memory_space()
, MemoryCapacity
, MinBlockSize
, MaxBlockSize
, SuperBlockSize );
, std::min(size_t(MaxBlockSize),MemoryCapacity)
, std::min(size_t(SuperBlockSize),MemoryCapacity) );
future_type f = Kokkos::host_spawn( Kokkos::TaskSingle( root_sched )
, TestFib( root_sched, i ) );
@ -205,11 +205,10 @@ struct TestTaskSpawn {
{
typedef typename sched_type::memory_space memory_space;
// enum { MemoryCapacity = 4000 }; // Triggers infinite loop in memory pool.
enum { MemoryCapacity = 16000 };
enum { MinBlockSize = 64 };
enum { MaxBlockSize = 1024 };
enum { SuperBlockSize = 1u << 12 };
enum { SuperBlockSize = 4096 };
sched_type sched( memory_space()
, MemoryCapacity
@ -277,11 +276,10 @@ struct TestTaskDependence {
{
typedef typename sched_type::memory_space memory_space;
// enum { MemoryCapacity = 4000 }; // Triggers infinite loop in memory pool.
enum { MemoryCapacity = 16000 };
enum { MinBlockSize = 64 };
enum { MaxBlockSize = 1024 };
enum { SuperBlockSize = 1u << 12 };
enum { SuperBlockSize = 4096 };
sched_type sched( memory_space()
, MemoryCapacity
@ -471,13 +469,11 @@ struct TestTaskTeam {
static void run( long n )
{
//const unsigned memory_capacity = 10000; // Causes memory pool infinite loop.
//const unsigned memory_capacity = 100000; // Fails with SPAN=1 for serial and OMP.
const unsigned memory_capacity = 400000;
enum { MinBlockSize = 64 };
enum { MaxBlockSize = 1024 };
enum { SuperBlockSize = 1u << 12 };
enum { SuperBlockSize = 4096 };
sched_type root_sched( typename sched_type::memory_space()
, memory_capacity
@ -600,12 +596,11 @@ struct TestTaskTeamValue {
static void run( long n )
{
//const unsigned memory_capacity = 10000; // Causes memory pool infinite loop.
const unsigned memory_capacity = 100000;
enum { MinBlockSize = 64 };
enum { MaxBlockSize = 1024 };
enum { SuperBlockSize = 1u << 12 };
enum { SuperBlockSize = 4096 };
sched_type root_sched( typename sched_type::memory_space()
, memory_capacity
@ -655,7 +650,6 @@ TEST_F( TEST_CATEGORY, task_fib )
TEST_F( TEST_CATEGORY, task_depend )
{
for ( int i = 0; i < 25; ++i ) {
printf("\nTest::task_depend %d\n",i);
TestTaskScheduler::TestTaskDependence< TEST_EXECSPACE >::run( i );
}
}

View File

@ -786,11 +786,40 @@ struct TestViewMirror
ASSERT_EQ( a_h.dimension_0(), a_d .dimension_0() );
}
template< class MemoryTraits >
void static test_mirror_copy() {
Kokkos::View< double*, Layout, Kokkos::HostSpace > a_org( "A", 10 );
a_org(5) = 42.0;
Kokkos::View< double*, Layout, Kokkos::HostSpace, MemoryTraits > a_h = a_org;
auto a_h2 = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), a_h );
auto a_d = Kokkos::create_mirror_view_and_copy( DeviceType(), a_h );
auto a_h3 = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), a_d );
int equal_ptr_h_h2 = a_h.data() == a_h2.data() ? 1 : 0;
int equal_ptr_h_d = a_h.data() == a_d.data() ? 1 : 0;
int equal_ptr_h2_d = a_h2.data() == a_d.data() ? 1 : 0;
int equal_ptr_h3_d = a_h3.data() == a_d.data() ? 1 : 0;
int is_same_memspace = std::is_same< Kokkos::HostSpace, typename DeviceType::memory_space >::value ? 1 : 0;
ASSERT_EQ( equal_ptr_h_h2, 1 );
ASSERT_EQ( equal_ptr_h_d, is_same_memspace );
ASSERT_EQ( equal_ptr_h2_d, is_same_memspace );
ASSERT_EQ( equal_ptr_h3_d, is_same_memspace );
ASSERT_EQ( a_h.dimension_0(), a_h3.dimension_0() );
ASSERT_EQ( a_h.dimension_0(), a_h2.dimension_0() );
ASSERT_EQ( a_h.dimension_0(), a_d .dimension_0() );
ASSERT_EQ( a_org(5), a_h3(5) );
}
void static testit() {
test_mirror< Kokkos::MemoryTraits<0> >();
test_mirror< Kokkos::MemoryTraits<Kokkos::Unmanaged> >();
test_mirror_view< Kokkos::MemoryTraits<0> >();
test_mirror_view< Kokkos::MemoryTraits<Kokkos::Unmanaged> >();
test_mirror_copy< Kokkos::MemoryTraits<0> >();
test_mirror_copy< Kokkos::MemoryTraits<Kokkos::Unmanaged> >();
}
};
@ -1312,10 +1341,12 @@ return;
}
};
#if !defined(KOKKOS_ENABLE_ROCM)
TEST_F( TEST_CATEGORY, view_api )
{
TestViewAPI< double, TEST_EXECSPACE >();
}
#endif
TEST_F( TEST_CATEGORY, view_remap )
{

View File

@ -1294,5 +1294,41 @@ void test_layoutright_to_layoutright() {
}
}
//----------------------------------------------------------------------------
template< class Space >
struct TestUnmanagedSubviewReset
{
Kokkos::View<int****,Space> a ;
KOKKOS_INLINE_FUNCTION
void operator()( int ) const noexcept
{
auto sub_a = Kokkos::subview(a,0,Kokkos::ALL,Kokkos::ALL,Kokkos::ALL);
for ( int i = 0 ; i < int(a.dimension(0)) ; ++i ) {
sub_a.assign_data( & a(i,0,0,0) );
if ( & sub_a(1,1,1) != & a(i,1,1,1) ) {
Kokkos::abort("TestUnmanagedSubviewReset");
}
}
}
TestUnmanagedSubviewReset()
: a( Kokkos::view_alloc() , 20 , 10 , 5 , 2 )
{}
};
template< class Space >
void test_unmanaged_subview_reset()
{
Kokkos::parallel_for
( Kokkos::RangePolicy< typename Space::execution_space >(0,1)
, TestUnmanagedSubviewReset<Space>()
);
}
} // namespace TestViewSubview
#endif

View File

@ -67,7 +67,7 @@ template< class ExecSpace >
struct TestWorkGraph {
using MemorySpace = typename ExecSpace::memory_space;
using Policy = Kokkos::Experimental::WorkGraphPolicy<std::int32_t, ExecSpace>;
using Policy = Kokkos::WorkGraphPolicy<std::int32_t, ExecSpace>;
using Graph = typename Policy::graph_type;
using RowMap = typename Graph::row_map_type;
using Entries = typename Graph::entries_type;
@ -117,6 +117,7 @@ struct TestWorkGraph {
m_graph.row_map = RowMap("row_map", hg.size() + 1); // row map always has one more
m_graph.entries = Entries("entries", hg.size() - 1); // all but the first have a parent
m_values = Values("values", hg.size());
//printf("%zu work items\n", hg.size());
auto h_row_map = Kokkos::create_mirror_view(m_graph.row_map);
auto h_entries = Kokkos::create_mirror_view(m_graph.entries);
auto h_values = Kokkos::create_mirror_view(m_values);
@ -156,17 +157,15 @@ struct TestWorkGraph {
} // anonymous namespace
TEST_F( TEST_CATEGORY, DISABLED_workgraph_fib )
TEST_F( TEST_CATEGORY, workgraph_fib )
{
#ifdef KOKKOS_IMPL_CUDA_CLANG_WORKAROUND
int limit = 15;
#else
int limit = 27;
#endif
for ( int i = 0; i < limit; ++i) {
TestWorkGraph< TEST_EXECSPACE > f(i);
f.test_for();
}
//TestWorkGraph< TEST_EXECSPACE > f(2);
//f.test_for();
}
} // namespace Test

View 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 H. Carter Edwards (hcedwar@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <cuda/TestCudaUVM_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

View File

@ -10,3 +10,4 @@
#include <cuda/TestCuda_SubView_c10.cpp>
#include <cuda/TestCuda_SubView_c11.cpp>
#include <cuda/TestCuda_SubView_c12.cpp>
#include <cuda/TestCuda_SubView_c13.cpp>

View 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 H. Carter Edwards (hcedwar@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <openmp/TestOpenMP_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

View File

@ -10,3 +10,4 @@
#include <openmp/TestOpenMP_SubView_c10.cpp>
#include <openmp/TestOpenMP_SubView_c11.cpp>
#include <openmp/TestOpenMP_SubView_c12.cpp>
#include <openmp/TestOpenMP_SubView_c13.cpp>

View File

@ -0,0 +1,55 @@
/*
//@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 H. Carter Edwards (hcedwar@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <qthreads/TestQthreads.hpp>
namespace Test {
TEST_F( qthreads, view_test_unmanaged_subview_reset )
{
#if 0
TestViewSubview::test_unmanaged_subview_reset< TEST_EXECSPACE >();
#endif
}
} // namespace Test

View File

@ -10,3 +10,4 @@
#include <qthreads/TestQthreads_SubView_c10.cpp>
#include <qthreads/TestQthreads_SubView_c11.cpp>
#include <qthreads/TestQthreads_SubView_c12.cpp>
#include <qthreads/TestQthreads_SubView_c13.cpp>

View 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 H. Carter Edwards (hcedwar@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <serial/TestSerial_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

View File

@ -10,3 +10,4 @@
#include <serial/TestSerial_SubView_c10.cpp>
#include <serial/TestSerial_SubView_c11.cpp>
#include <serial/TestSerial_SubView_c12.cpp>
#include <serial/TestSerial_SubView_c13.cpp>

View 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 H. Carter Edwards (hcedwar@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#include <threads/TestThreads_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