#include <iostream>
#include <sstream>
#include <Kokkos_Core.hpp>
#include <grow_array.hpp>
int main( int argc , char ** argv )
{
int num_threads = 4 ;
int use_numa = 1 ;
int use_core = 1 ;
int length_array = 1000000 ;
int span_values = 100000000 ;
if ( Kokkos::hwloc::available() ) {
use_numa = Kokkos::hwloc::get_available_numa_count();
use_core = Kokkos::hwloc::get_available_cores_per_numa() - 1 ;
num_threads = use_numa * use_core * Kokkos::hwloc::get_available_threads_per_core();
}
#if defined( KOKKOS_ENABLE_SERIAL )
{
std::cout << "Kokkos::Serial" << std::endl ;
Kokkos::Serial::initialize( num_threads , use_numa , use_core );
Example::grow_array< Kokkos::Serial >( length_array , span_values );
Kokkos::Serial::finalize ();
}
#endif
#if defined( KOKKOS_ENABLE_THREADS )
{
std::cout << "Kokkos::Threads" << std::endl ;
Kokkos::Threads::initialize( num_threads , use_numa , use_core );
Example::grow_array< Kokkos::Threads >( length_array , span_values );
Kokkos::Threads::finalize();
}
#endif
#if defined( KOKKOS_ENABLE_OPENMP )
{
std::cout << "Kokkos::OpenMP" << std::endl ;
Kokkos::OpenMP::initialize();
Example::grow_array< Kokkos::OpenMP >( length_array , span_values );
Kokkos::OpenMP::finalize();
}
#endif
#if defined( KOKKOS_ENABLE_CUDA )
{
std::cout << "Kokkos::Cuda" << std::endl ;
Kokkos::HostSpace::execution_space::initialize(1);
Kokkos::Cuda::initialize();
Example::grow_array< Kokkos::Cuda >( length_array , span_values );
Kokkos::Cuda::finalize();
Kokkos::HostSpace::execution_space::finalize();
}
#endif
return 0 ;
}