Updating Kokkos lib

This commit is contained in:
Stan Moore
2017-02-13 10:50:34 -07:00
parent cb982f2f28
commit 383da816c2
180 changed files with 3657 additions and 1100 deletions

View File

@ -44,6 +44,7 @@ else
endif
OBJ_CUDA += TestCuda_ViewAPI_a.o TestCuda_ViewAPI_b.o TestCuda_ViewAPI_c.o TestCuda_ViewAPI_d.o
OBJ_CUDA += TestCuda_ViewAPI_e.o TestCuda_ViewAPI_f.o TestCuda_ViewAPI_g.o TestCuda_ViewAPI_h.o
OBJ_CUDA += TestCuda_ViewAPI_s.o
OBJ_CUDA += UnitTestMain.o gtest-all.o
TARGETS += KokkosCore_UnitTest_Cuda
TEST_TARGETS += test-cuda

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,7 @@ double AddTestFunctor() {
}
#if defined (KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined (KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
template<class DeviceType, bool PWRTest>
double AddTestLambda() {
@ -228,7 +228,7 @@ double ReduceTestFunctor() {
return result;
}
#if defined (KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined (KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
template<class DeviceType, bool PWRTest>
double ReduceTestLambda() {
@ -306,7 +306,7 @@ double TestVariantFunctor(int test) {
template<class DeviceType>
bool Test(int test) {
#ifdef KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA
#ifdef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
double res_functor = TestVariantFunctor<DeviceType>(test);
double res_lambda = TestVariantLambda<DeviceType>(test);

View File

@ -58,20 +58,20 @@ struct AddFunctor {
KOKKOS_INLINE_FUNCTION
void operator()(int i) const {
#ifdef KOKKOS_HAVE_PRAGMA_UNROLL
#ifdef KOKKOS_ENABLE_PRAGMA_UNROLL
#pragma unroll
#endif
#ifdef KOKKOS_HAVE_PRAGMA_IVDEP
#ifdef KOKKOS_ENABLE_PRAGMA_IVDEP
#pragma ivdep
#endif
#ifdef KOKKOS_HAVE_PRAGMA_VECTOR
#ifdef KOKKOS_ENABLE_PRAGMA_VECTOR
#pragma vector always
#endif
#ifdef KOKKOS_HAVE_PRAGMA_LOOPCOUNT
#ifdef KOKKOS_ENABLE_PRAGMA_LOOPCOUNT
#pragma loop count(128)
#endif
#ifndef KOKKOS_HAVE_DEBUG
#ifdef KOKKOS_HAVE_PRAGMA_SIMD
#ifndef KOKKOS_DEBUG
#ifdef KOKKOS_ENABLE_PRAGMA_SIMD
#pragma simd
#endif
#endif

View File

@ -45,7 +45,7 @@
#include <Kokkos_Core.hpp>
#if !defined(KOKKOS_HAVE_CUDA) || defined(__CUDACC__)
#if !defined(KOKKOS_ENABLE_CUDA) || defined(__CUDACC__)
//----------------------------------------------------------------------------
#include <TestAtomic.hpp>

View File

@ -44,11 +44,11 @@
#include <gtest/gtest.h>
#include <Kokkos_Core.hpp>
#ifdef KOKKOS_HAVE_OPENMP
#ifdef KOKKOS_ENABLE_OPENMP
#include <omp.h>
#endif
#if !defined(KOKKOS_HAVE_CUDA) || defined(__CUDACC__)
#if !defined(KOKKOS_ENABLE_CUDA) || defined(__CUDACC__)
//----------------------------------------------------------------------------
namespace Test {
@ -72,7 +72,7 @@ namespace Impl {
if(do_threads) {
int nthreads = 3;
#ifdef KOKKOS_HAVE_OPENMP
#ifdef KOKKOS_ENABLE_OPENMP
if(omp_get_max_threads() < 3)
nthreads = omp_get_max_threads();
#endif
@ -83,7 +83,7 @@ namespace Impl {
* Kokkos::hwloc::get_available_numa_count();
}
#ifdef KOKKOS_HAVE_SERIAL
#ifdef KOKKOS_ENABLE_SERIAL
if(std::is_same<Kokkos::Serial,Kokkos::DefaultExecutionSpace>::value ||
std::is_same<Kokkos::Serial,Kokkos::DefaultHostExecutionSpace>::value ) {
nthreads = 1;
@ -97,7 +97,7 @@ namespace Impl {
int numa = 1;
if(Kokkos::hwloc::available())
numa = Kokkos::hwloc::get_available_numa_count();
#ifdef KOKKOS_HAVE_SERIAL
#ifdef KOKKOS_ENABLE_SERIAL
if(std::is_same<Kokkos::Serial,Kokkos::DefaultExecutionSpace>::value ||
std::is_same<Kokkos::Serial,Kokkos::DefaultHostExecutionSpace>::value ) {
numa = 1;
@ -131,7 +131,7 @@ namespace Impl {
if(do_threads) {
int nthreads = 3;
#ifdef KOKKOS_HAVE_OPENMP
#ifdef KOKKOS_ENABLE_OPENMP
if(omp_get_max_threads() < 3)
nthreads = omp_get_max_threads();
#endif
@ -141,7 +141,7 @@ namespace Impl {
nthreads = Kokkos::hwloc::get_available_threads_per_core()
* Kokkos::hwloc::get_available_numa_count();
}
#ifdef KOKKOS_HAVE_SERIAL
#ifdef KOKKOS_ENABLE_SERIAL
if(std::is_same<Kokkos::Serial,Kokkos::DefaultExecutionSpace>::value ||
std::is_same<Kokkos::Serial,Kokkos::DefaultHostExecutionSpace>::value ) {
nthreads = 1;
@ -155,7 +155,7 @@ namespace Impl {
int numa = 1;
if(Kokkos::hwloc::available())
numa = Kokkos::hwloc::get_available_numa_count();
#ifdef KOKKOS_HAVE_SERIAL
#ifdef KOKKOS_ENABLE_SERIAL
if(std::is_same<Kokkos::Serial,Kokkos::DefaultExecutionSpace>::value ||
std::is_same<Kokkos::Serial,Kokkos::DefaultHostExecutionSpace>::value ) {
numa = 1;
@ -183,7 +183,7 @@ namespace Impl {
* Kokkos::hwloc::get_available_cores_per_numa()
* Kokkos::hwloc::get_available_threads_per_core();
} else {
#ifdef KOKKOS_HAVE_OPENMP
#ifdef KOKKOS_ENABLE_OPENMP
if(std::is_same<Kokkos::HostSpace::execution_space,Kokkos::OpenMP>::value) {
expected_nthreads = omp_get_max_threads();
} else
@ -191,7 +191,7 @@ namespace Impl {
expected_nthreads = 1;
}
#ifdef KOKKOS_HAVE_SERIAL
#ifdef KOKKOS_ENABLE_SERIAL
if(std::is_same<Kokkos::DefaultExecutionSpace,Kokkos::Serial>::value ||
std::is_same<Kokkos::DefaultHostExecutionSpace,Kokkos::Serial>::value )
expected_nthreads = 1;
@ -205,7 +205,7 @@ namespace Impl {
} else {
expected_numa = 1;
}
#ifdef KOKKOS_HAVE_SERIAL
#ifdef KOKKOS_ENABLE_SERIAL
if(std::is_same<Kokkos::DefaultExecutionSpace,Kokkos::Serial>::value ||
std::is_same<Kokkos::DefaultHostExecutionSpace,Kokkos::Serial>::value )
expected_numa = 1;
@ -213,7 +213,7 @@ namespace Impl {
}
ASSERT_EQ(Kokkos::HostSpace::execution_space::thread_pool_size(),expected_nthreads);
#ifdef KOKKOS_HAVE_CUDA
#ifdef KOKKOS_ENABLE_CUDA
if(std::is_same<Kokkos::DefaultExecutionSpace,Kokkos::Cuda>::value) {
int device;
cudaGetDevice( &device );

View File

@ -45,7 +45,7 @@
#include <Kokkos_Core.hpp>
#if !defined(KOKKOS_HAVE_CUDA) || defined(__CUDACC__)
#if !defined(KOKKOS_ENABLE_CUDA) || defined(__CUDACC__)
//----------------------------------------------------------------------------
#include <TestReduce.hpp>

View File

@ -45,7 +45,7 @@
#include <Kokkos_Core.hpp>
#if !defined(KOKKOS_HAVE_CUDA) || defined(__CUDACC__)
#if !defined(KOKKOS_ENABLE_CUDA) || defined(__CUDACC__)
//----------------------------------------------------------------------------
#include <TestReduce.hpp>

View File

@ -45,7 +45,7 @@
#include <Kokkos_Core.hpp>
#if !defined(KOKKOS_HAVE_CUDA) || defined(__CUDACC__)
#if !defined(KOKKOS_ENABLE_CUDA) || defined(__CUDACC__)
//----------------------------------------------------------------------------
#include <TestReduce.hpp>

View File

@ -45,7 +45,7 @@
#include <Kokkos_Core.hpp>
#if !defined(KOKKOS_HAVE_CUDA) || defined(__CUDACC__)
#if !defined(KOKKOS_ENABLE_CUDA) || defined(__CUDACC__)
//----------------------------------------------------------------------------
#include <TestAtomic.hpp>

View File

@ -56,7 +56,7 @@
//#define TESTMEMORYPOOL_PRINT_STATUS
#define STRIDE 1
#ifdef KOKKOS_HAVE_CUDA
#ifdef KOKKOS_ENABLE_CUDA
#define STRIDE_ALLOC 32
#else
#define STRIDE_ALLOC 1

View File

@ -470,7 +470,7 @@ public:
// Computes y^T*A*x
// (modified from kokkos-tutorials/GTC2016/Exercises/ThreeLevelPar )
#if ( ! defined( KOKKOS_HAVE_CUDA ) ) || defined( KOKKOS_CUDA_USE_LAMBDA )
#if ( ! defined( KOKKOS_ENABLE_CUDA ) ) || defined( KOKKOS_ENABLE_CUDA_LAMBDA )
template< typename ScalarType , class DeviceType >
class TestTripleNestedReduce
@ -540,7 +540,7 @@ public:
}
};
#else /* #if ( ! defined( KOKKOS_HAVE_CUDA ) ) || defined( KOKKOS_CUDA_USE_LAMBDA ) */
#else /* #if ( ! defined( KOKKOS_ENABLE_CUDA ) ) || defined( KOKKOS_ENABLE_CUDA_LAMBDA ) */
template< typename ScalarType , class DeviceType >
class TestTripleNestedReduce
@ -1034,7 +1034,7 @@ struct TestReduceCombinatoricalInstantiation {
template<class ... Args>
static void AddFunctorLambdaRange(Args... args) {
AddFunctor<0,Args...>(args...);
#ifdef KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA
#ifdef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
AddLambdaRange(typename std::conditional<std::is_same<ExecSpace,Kokkos::DefaultExecutionSpace>::value,void*,Kokkos::InvalidType>::type(), args...);
#endif
}
@ -1042,7 +1042,7 @@ struct TestReduceCombinatoricalInstantiation {
template<class ... Args>
static void AddFunctorLambdaTeam(Args... args) {
AddFunctor<1,Args...>(args...);
#ifdef KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA
#ifdef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
AddLambdaTeam(typename std::conditional<std::is_same<ExecSpace,Kokkos::DefaultExecutionSpace>::value,void*,Kokkos::InvalidType>::type(), args...);
#endif
}

View File

@ -53,6 +53,8 @@ struct TestScan {
typedef Device execution_space ;
typedef long int value_type ;
Kokkos::View<int,Device,Kokkos::MemoryTraits<Kokkos::Atomic> > errors;
KOKKOS_INLINE_FUNCTION
void operator()( const int iwork , value_type & update , const bool final_pass ) const
{
@ -69,7 +71,9 @@ struct TestScan {
const value_type answer = n & 1 ? ( n * ( ( n + 1 ) / 2 ) ) : ( ( n / 2 ) * ( n + 1 ) );
if ( answer != update ) {
printf("TestScan(%d,%ld) != %ld\n",iwork,update,answer);
errors()++;
if(errors()<20)
printf("TestScan(%d,%ld) != %ld\n",iwork,update,answer);
}
}
}
@ -83,11 +87,21 @@ struct TestScan {
{ update += input ; }
TestScan( const WorkSpec & N )
{ parallel_scan( N , *this ); }
{
Kokkos::View<int,Device > errors_a("Errors");
Kokkos::deep_copy(errors_a,0);
errors = errors_a;
parallel_scan( N , *this );
}
TestScan( const WorkSpec & Start , const WorkSpec & N )
{
typedef Kokkos::RangePolicy<execution_space> exec_policy ;
Kokkos::View<int,Device > errors_a("Errors");
Kokkos::deep_copy(errors_a,0);
errors = errors_a;
parallel_scan( exec_policy( Start , N ) , *this );
}

View File

@ -29,7 +29,8 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
//#undef _WIN32_WINNT
//#define _WIN32_WINNT 0x0602
#if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(__APPLE__) || defined(__ARM_ARCH_8A)
#if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || \
defined(__APPLE__) || defined(__ARM_ARCH_8A) || defined(_CRAYC)
// Skip for now

View File

@ -499,7 +499,7 @@ struct TestSharedTeam {
namespace Test {
#if defined (KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined (KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
template< class MemorySpace, class ExecSpace, class ScheduleType >
struct TestLambdaSharedTeam {
@ -519,7 +519,7 @@ struct TestLambdaSharedTeam {
const int SHARED_COUNT = 1000;
int team_size = 1;
#ifdef KOKKOS_HAVE_CUDA
#ifdef KOKKOS_ENABLE_CUDA
if(std::is_same<ExecSpace,Kokkos::Cuda>::value)
team_size = 128;
#endif
@ -841,7 +841,7 @@ struct ClassWithShmemSizeFunction {
template< class ExecSpace, class ScheduleType >
void test_team_mulit_level_scratch_test_lambda() {
#ifdef KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA
#ifdef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
Kokkos::View<int,ExecSpace,Kokkos::MemoryTraits<Kokkos::Atomic> > errors;
Kokkos::View<int,ExecSpace> d_errors("Errors");
errors = d_errors;
@ -885,7 +885,7 @@ struct TestMultiLevelScratchTeam {
void run()
{
#ifdef KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA
#ifdef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
Test::test_team_mulit_level_scratch_test_lambda<ExecSpace, ScheduleType>();
#endif
Test::ClassNoShmemSizeFunction<ExecSpace, ScheduleType> c1;

View File

@ -1,13 +1,13 @@
/*
//@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:
@ -36,7 +36,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
//
//
// ************************************************************************
//@HEADER
*/
@ -168,7 +168,7 @@ template<class Scalar, class ExecutionSpace>
void TestTemplateMetaFunctions() {
typedef typename Kokkos::View<Scalar*,ExecutionSpace> type;
type a("A",100);
/* #ifdef KOKKOS_HAVE_CXX11
/*
int sum_plain_has_init_arg = Kokkos::Impl::FunctorHasInit<SumPlain<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_plain_has_init_arg,0);
int sum_initjoinfinalvaluetype_has_init_arg = Kokkos::Impl::FunctorHasInit<SumInitJoinFinalValueType<Scalar,ExecutionSpace>, Scalar >::value;
@ -181,20 +181,8 @@ void TestTemplateMetaFunctions() {
//int sum_initjoinfinalvaluetypearray_has_init_arg = Kokkos::Impl::FunctorHasInit<SumInitJoinFinalValueTypeArray<Scalar,ExecutionSpace>, Scalar[] >::value;
//ASSERT_EQ(sum_initjoinfinalvaluetypearray_has_init_arg,1);
#else
int sum_plain_has_init_arg = Kokkos::Impl::FunctorHasInit<SumPlain<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_plain_has_init_arg,0);
int sum_initjoinfinalvaluetype_has_init_arg = Kokkos::Impl::FunctorHasInit<SumInitJoinFinalValueType<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_initjoinfinalvaluetype_has_init_arg,1);
int sum_wronginitjoinfinalvaluetype_has_init_arg = Kokkos::Impl::FunctorHasInit<SumWrongInitJoinFinalValueType<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_wronginitjoinfinalvaluetype_has_init_arg,1);
#endif
//printf("Values Init: %i %i %i\n",sum_plain_has_init_arg,sum_initjoinfinalvaluetype_has_init_arg,sum_wronginitjoinfinalvaluetype_has_init_arg);
#ifdef KOKKOS_HAVE_CXX11
int sum_plain_has_join_arg = Kokkos::Impl::FunctorHasJoin<SumPlain<Scalar,ExecutionSpace>, Scalar >::value;
ASSERT_EQ(sum_plain_has_join_arg,0);
int sum_initjoinfinalvaluetype_has_join_arg = Kokkos::Impl::FunctorHasJoin<SumInitJoinFinalValueType<Scalar,ExecutionSpace>, Scalar >::value;
@ -203,16 +191,7 @@ void TestTemplateMetaFunctions() {
ASSERT_EQ(sum_initjoinfinalvaluetype_has_join_arg2,1);
int sum_wronginitjoinfinalvaluetype_has_join_arg = Kokkos::Impl::FunctorHasJoin<SumWrongInitJoinFinalValueType<Scalar,ExecutionSpace>, Scalar >::value;
ASSERT_EQ(sum_wronginitjoinfinalvaluetype_has_join_arg,0);
#else
int sum_plain_has_join_arg = Kokkos::Impl::FunctorHasJoin<SumPlain<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_plain_has_join_arg,0);
int sum_initjoinfinalvaluetype_has_join_arg = Kokkos::Impl::FunctorHasJoin<SumInitJoinFinalValueType<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_initjoinfinalvaluetype_has_join_arg,1);
int sum_initjoinfinalvaluetype_has_join_arg2 = Kokkos::Impl::FunctorHasJoin<SumInitJoinFinalValueType2<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_initjoinfinalvaluetype_has_join_arg2,1);
int sum_wronginitjoinfinalvaluetype_has_join_arg = Kokkos::Impl::FunctorHasJoin<SumWrongInitJoinFinalValueType<Scalar,ExecutionSpace>, Scalar& >::value;
ASSERT_EQ(sum_wronginitjoinfinalvaluetype_has_join_arg,1);
#endif*/
*/
//printf("Values Join: %i %i %i\n",sum_plain_has_join_arg,sum_initjoinfinalvaluetype_has_join_arg,sum_wronginitjoinfinalvaluetype_has_join_arg);
}

View File

@ -1205,7 +1205,7 @@ public:
// For CUDA the constant random access View does not return
// an lvalue reference due to retrieving through texture cache
// therefore not allowed to query the underlying pointer.
#if defined( KOKKOS_HAVE_CUDA )
#if defined( KOKKOS_ENABLE_CUDA )
if ( ! std::is_same< typename device::execution_space , Kokkos::Cuda >::value )
#endif
{

View File

@ -993,7 +993,7 @@ void test_view_mapping()
ASSERT_EQ( a.use_count() , 1 );
ASSERT_EQ( b.use_count() , 0 );
#if ! defined ( KOKKOS_CUDA_USE_LAMBDA )
#if ! defined ( KOKKOS_ENABLE_CUDA_LAMBDA )
/* Cannot launch host lambda when CUDA lambda is enabled */
typedef typename Kokkos::Impl::HostMirror< Space >::Space::execution_space
@ -1011,7 +1011,7 @@ void test_view_mapping()
ASSERT_EQ( a.use_count() , 2 );
ASSERT_EQ( x.use_count() , 2 );
});
#endif /* #if ! defined ( KOKKOS_CUDA_USE_LAMBDA ) */
#endif /* #if ! defined ( KOKKOS_ENABLE_CUDA_LAMBDA ) */
}
}
@ -1370,6 +1370,16 @@ struct TestViewMappingAtomic {
long error_count = -1 ;
Kokkos::parallel_reduce( Kokkos::RangePolicy< ExecSpace , TagVerify >(0,N) , self , error_count );
ASSERT_EQ( 0 , error_count );
typename TestViewMappingAtomic::T_atom::HostMirror x_host = Kokkos::create_mirror_view(self.x);
Kokkos::deep_copy(x_host,self.x);
error_count = -1;
Kokkos::parallel_reduce( Kokkos::RangePolicy< Kokkos::DefaultHostExecutionSpace, TagVerify>(0,N),
[=] ( const TagVerify & , const int i , long & tmp_error_count ) {
if ( i < 2 ) { if ( x_host(i) != int(i + N / 2) ) ++tmp_error_count ; }
else { if ( x_host(i) != int(i) ) ++tmp_error_count ; }
}, error_count);
ASSERT_EQ( 0 , error_count );
Kokkos::deep_copy(self.x,x_host);
}
};

View File

@ -0,0 +1,82 @@
/*
//@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 <gtest/gtest.h>
#include <Kokkos_Core.hpp>
#include <stdexcept>
#include <sstream>
#include <iostream>
/*--------------------------------------------------------------------------*/
namespace Test {
template< typename SpaceDst , typename SpaceSrc >
void view_space_assign()
{
Kokkos::View<double*,SpaceDst> a =
Kokkos::View<double*,SpaceSrc>("a",1);
Kokkos::View<double*,Kokkos::LayoutLeft,SpaceDst> b =
Kokkos::View<double*,Kokkos::LayoutLeft,SpaceSrc>("b",1);
Kokkos::View<double*,Kokkos::LayoutRight,SpaceDst> c =
Kokkos::View<double*,Kokkos::LayoutRight,SpaceSrc>("c",1);
Kokkos::View<double*,SpaceDst,Kokkos::MemoryRandomAccess> d =
Kokkos::View<double*,SpaceSrc>("d",1);
Kokkos::View<double*,Kokkos::LayoutLeft,SpaceDst,Kokkos::MemoryRandomAccess> e =
Kokkos::View<double*,Kokkos::LayoutLeft,SpaceSrc>("e",1);
// Rank-one layout can assign:
Kokkos::View<double*,Kokkos::LayoutRight,SpaceDst> f =
Kokkos::View<double*,Kokkos::LayoutLeft,SpaceSrc>("f",1);
}
} // namespace Test
/*--------------------------------------------------------------------------*/

View File

@ -40,8 +40,8 @@
// ************************************************************************
//@HEADER
*/
#ifndef KOKKOS_TEST_CUDAHPP
#define KOKKOS_TEST_CUDAHPP
#ifndef KOKKOS_TEST_CUDA_HPP
#define KOKKOS_TEST_CUDA_HPP
#include <gtest/gtest.h>
#include <Kokkos_Macros.hpp>
@ -59,8 +59,12 @@
#include <TestViewAPI.hpp>
#include <TestViewOfClass.hpp>
#include <TestViewSubview.hpp>
#include <TestViewSpaceAssign.hpp>
#include <TestAtomic.hpp>
#include <TestAtomicOperations.hpp>
#include <TestAtomicViews.hpp>
#include <TestRange.hpp>
#include <TestTeam.hpp>
#include <TestReduce.hpp>

View File

@ -161,8 +161,43 @@ TEST_F( cuda , atomic_operations )
ASSERT_TRUE( ( TestAtomicOperations::AtomicOperationsTestNonIntegralType<float,Kokkos::Cuda>(start, end-i, 3 ) ) );
ASSERT_TRUE( ( TestAtomicOperations::AtomicOperationsTestNonIntegralType<float,Kokkos::Cuda>(start, end-i, 4 ) ) );
}
}
TEST_F( cuda , atomic_views_integral )
{
const long length = 1000000;
{
//Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 4 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 5 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 6 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 7 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Cuda>(length, 8 ) ) );
}
}
TEST_F( cuda , atomic_views_nonintegral )
{
const long length = 1000000;
{
//Non-Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Cuda>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Cuda>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Cuda>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Cuda>(length, 4 ) ) );
}
}
TEST_F( cuda , atomic_view_api )
{
TestAtomicViews::TestAtomicViewAPI<int, Kokkos::Cuda>();
}
} // namespace test

View File

@ -134,7 +134,7 @@ TEST_F( cuda , task_team )
//----------------------------------------------------------------------------
#if defined( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_CUDA )
#if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA )
TEST_F( cuda , cxx11 )
{
if ( std::is_same< Kokkos::DefaultExecutionSpace , Kokkos::Cuda >::value ) {
@ -171,7 +171,7 @@ TEST_F( cuda, tile_layout )
TestTile::test< Kokkos::Cuda , 8 , 8 >( 9 , 11 );
}
#if defined (KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined (KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
#if defined (KOKKOS_COMPILER_CLANG)
TEST_F( cuda , dispatch )
{

View File

@ -73,7 +73,7 @@ TEST_F( cuda , team_shared_request) {
// TestScratchTeam< Kokkos::Cuda , Kokkos::Schedule<Kokkos::Dynamic> >();
//}
#if defined(KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
TEST_F( cuda , team_lambda_shared_request) {
TestLambdaSharedTeam< Kokkos::CudaSpace, Kokkos::Cuda, Kokkos::Schedule<Kokkos::Static> >();
TestLambdaSharedTeam< Kokkos::CudaUVMSpace, Kokkos::Cuda, Kokkos::Schedule<Kokkos::Static> >();

View File

@ -0,0 +1,53 @@
/*
//@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/TestCuda.hpp>
namespace Test {
TEST_F( cuda , view_space_assign ) {
view_space_assign< Kokkos::HostSpace , Kokkos::CudaHostPinnedSpace >();
view_space_assign< Kokkos::CudaSpace , Kokkos::CudaUVMSpace >();
}
} // namespace test

View File

@ -40,8 +40,8 @@
// ************************************************************************
//@HEADER
*/
#ifndef KOKKOS_TEST_OPENMPHPP
#define KOKKOS_TEST_OPENMPHPP
#ifndef KOKKOS_TEST_OPENMP_HPP
#define KOKKOS_TEST_OPENMP_HPP
#include <gtest/gtest.h>
#include <Kokkos_Macros.hpp>
@ -65,6 +65,7 @@
#include <TestViewSubview.hpp>
#include <TestAtomic.hpp>
#include <TestAtomicOperations.hpp>
#include <TestAtomicViews.hpp>
#include <TestRange.hpp>
#include <TestTeam.hpp>
#include <TestReduce.hpp>

View File

@ -164,5 +164,41 @@ TEST_F( openmp , atomic_operations )
}
TEST_F( openmp , atomic_views_integral )
{
const long length = 1000000;
{
//Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 4 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 5 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 6 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 7 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::OpenMP>(length, 8 ) ) );
}
}
TEST_F( openmp , atomic_views_nonintegral )
{
const long length = 1000000;
{
//Non-Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::OpenMP>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::OpenMP>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::OpenMP>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::OpenMP>(length, 4 ) ) );
}
}
TEST_F( openmp , atomic_view_api )
{
TestAtomicViews::TestAtomicViewAPI<int, Kokkos::OpenMP>();
}
} // namespace test

View File

@ -136,7 +136,7 @@ TEST_F( openmp , task_team )
//----------------------------------------------------------------------------
#if defined( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_OPENMP )
#if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP )
TEST_F( openmp , cxx11 )
{
if ( std::is_same< Kokkos::DefaultExecutionSpace , Kokkos::OpenMP >::value ) {

View File

@ -72,7 +72,7 @@ TEST_F( openmp, team_scratch_request) {
TestScratchTeam< Kokkos::OpenMP , Kokkos::Schedule<Kokkos::Dynamic> >();
}
#if defined(KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
TEST_F( openmp , team_lambda_shared_request) {
TestLambdaSharedTeam< Kokkos::HostSpace, Kokkos::OpenMP , Kokkos::Schedule<Kokkos::Static> >();
TestLambdaSharedTeam< Kokkos::HostSpace, Kokkos::OpenMP , Kokkos::Schedule<Kokkos::Dynamic> >();

View File

@ -40,8 +40,8 @@
// ************************************************************************
//@HEADER
*/
#ifndef KOKKOS_TEST_SERIALHPP
#define KOKKOS_TEST_SERIALHPP
#ifndef KOKKOS_TEST_SERIAL_HPP
#define KOKKOS_TEST_SERIAL_HPP
#include <gtest/gtest.h>
#include <Kokkos_Macros.hpp>
@ -65,6 +65,9 @@
#include <TestViewSubview.hpp>
#include <TestAtomic.hpp>
#include <TestAtomicOperations.hpp>
#include <TestAtomicViews.hpp>
#include <TestRange.hpp>
#include <TestTeam.hpp>
#include <TestReduce.hpp>

View File

@ -164,5 +164,41 @@ TEST_F( serial , atomic_operations )
}
TEST_F( serial , atomic_views_integral )
{
const long length = 1000000;
{
//Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 4 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 5 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 6 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 7 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Serial>(length, 8 ) ) );
}
}
TEST_F( serial , atomic_views_nonintegral )
{
const long length = 1000000;
{
//Non-Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Serial>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Serial>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Serial>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Serial>(length, 4 ) ) );
}
}
TEST_F( serial , atomic_view_api )
{
TestAtomicViews::TestAtomicViewAPI<int, Kokkos::Serial>();
}
} // namespace test

View File

@ -121,7 +121,7 @@ TEST_F( serial , task_team )
//----------------------------------------------------------------------------
#if defined( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_SERIAL )
#if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL )
TEST_F( serial , cxx11 )
{
if ( std::is_same< Kokkos::DefaultExecutionSpace , Kokkos::Serial >::value ) {

View File

@ -67,7 +67,7 @@ TEST_F( serial, team_scratch_request) {
TestScratchTeam< Kokkos::Serial , Kokkos::Schedule<Kokkos::Dynamic> >();
}
#if defined(KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
TEST_F( serial , team_lambda_shared_request) {
TestLambdaSharedTeam< Kokkos::HostSpace, Kokkos::Serial , Kokkos::Schedule<Kokkos::Static> >();
TestLambdaSharedTeam< Kokkos::HostSpace, Kokkos::Serial , Kokkos::Schedule<Kokkos::Dynamic> >();

View File

@ -40,8 +40,8 @@
// ************************************************************************
//@HEADER
*/
#ifndef KOKKOS_TEST_THREADSHPP
#define KOKKOS_TEST_THREADSHPP
#ifndef KOKKOS_TEST_THREADS_HPP
#define KOKKOS_TEST_THREADS_HPP
#include <gtest/gtest.h>
#include <Kokkos_Macros.hpp>
@ -65,6 +65,7 @@
#include <TestViewSubview.hpp>
#include <TestAtomic.hpp>
#include <TestAtomicOperations.hpp>
#include <TestAtomicViews.hpp>
#include <TestRange.hpp>
#include <TestTeam.hpp>
#include <TestReduce.hpp>

View File

@ -164,5 +164,41 @@ TEST_F( threads , atomic_operations )
}
TEST_F( threads , atomic_views_integral )
{
const long length = 1000000;
{
//Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 4 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 5 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 6 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 7 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestIntegralType<long, Kokkos::Threads>(length, 8 ) ) );
}
}
TEST_F( threads , atomic_views_nonintegral )
{
const long length = 1000000;
{
//Non-Integral Types
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Threads>(length, 1 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Threads>(length, 2 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Threads>(length, 3 ) ) );
ASSERT_TRUE( ( TestAtomicViews::AtomicViewsTestNonIntegralType<double,Kokkos::Threads>(length, 4 ) ) );
}
}
TEST_F( threads , atomic_view_api )
{
TestAtomicViews::TestAtomicViewAPI<int, Kokkos::Threads>();
}
} // namespace test

View File

@ -136,7 +136,7 @@ TEST_F( threads , task_team )
//----------------------------------------------------------------------------
#if defined( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_THREADS )
#if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS )
TEST_F( threads , cxx11 )
{
if ( std::is_same< Kokkos::DefaultExecutionSpace , Kokkos::Threads >::value ) {

View File

@ -72,7 +72,7 @@ TEST_F( threads, team_scratch_request) {
TestScratchTeam< Kokkos::Threads , Kokkos::Schedule<Kokkos::Dynamic> >();
}
#if defined(KOKKOS_HAVE_CXX11_DISPATCH_LAMBDA)
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
TEST_F( threads , team_lambda_shared_request) {
TestLambdaSharedTeam< Kokkos::HostSpace, Kokkos::Threads , Kokkos::Schedule<Kokkos::Static> >();
TestLambdaSharedTeam< Kokkos::HostSpace, Kokkos::Threads , Kokkos::Schedule<Kokkos::Dynamic> >();