#ifndef KOKKOS_OPENMP_HPP
#define KOKKOS_OPENMP_HPP
#include <Kokkos_Macros.hpp>
#if defined( KOKKOS_ENABLE_OPENMP)
#include <Kokkos_Core_fwd.hpp>
#include <cstddef>
#include <iosfwd>
#include <Kokkos_HostSpace.hpp>
#ifdef KOKKOS_ENABLE_HBWSPACE
#include <Kokkos_HBWSpace.hpp>
#endif
#include <Kokkos_ScratchSpace.hpp>
#include <Kokkos_Parallel.hpp>
#include <Kokkos_TaskScheduler.hpp>
#include <Kokkos_Layout.hpp>
#include <impl/Kokkos_Tags.hpp>
#include <vector>
namespace Kokkos {
namespace Impl {
class OpenMPExec;
}
class OpenMP {
public:
using execution_space = OpenMP;
using memory_space =
#ifdef KOKKOS_ENABLE_HBWSPACE
Experimental::HBWSpace;
#else
HostSpace;
#endif
using device_type = Kokkos::Device< execution_space, memory_space >;
using array_layout = LayoutRight;
using size_type = memory_space::size_type;
using scratch_memory_space = ScratchMemorySpace< OpenMP >;
inline
OpenMP() noexcept;
static void print_configuration( std::ostream & , const bool verbose = false );
inline
static bool in_parallel( OpenMP const& = OpenMP() ) noexcept;
static void impl_static_fence( OpenMP const& = OpenMP() ) noexcept;
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
static void fence( OpenMP const& = OpenMP() ) noexcept;
#else
void fence() const;
#endif
inline
static bool is_asynchronous( OpenMP const& = OpenMP() ) noexcept;
static std::vector<OpenMP> partition(...);
static OpenMP create_instance(...);
template <typename F>
static void partition_master( F const& f
, int requested_num_partitions = 0
, int requested_partition_size = 0
);
static int concurrency();
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
static void initialize( int thread_count,
int use_numa_count,
int use_cores_per_numa = 0);
static void initialize( int thread_count = -1 );
static bool is_initialized() noexcept;
static void finalize();
inline
static int thread_pool_size() noexcept;
KOKKOS_INLINE_FUNCTION
static int thread_pool_rank() noexcept;
inline
static int thread_pool_size( int depth );
static void sleep() {};
static void wake() {};
static int get_current_max_threads() noexcept;
inline
static int max_hardware_threads() noexcept;
KOKKOS_INLINE_FUNCTION
static int hardware_thread_id() noexcept;
#else
static void impl_initialize( int thread_count = -1 );
static bool impl_is_initialized() noexcept;
static void impl_finalize();
inline
static int impl_thread_pool_size() noexcept;
KOKKOS_INLINE_FUNCTION
static int impl_thread_pool_rank() noexcept;
inline
static int impl_thread_pool_size( int depth );
inline
static int impl_max_hardware_threads() noexcept;
KOKKOS_INLINE_FUNCTION
static int impl_hardware_thread_id() noexcept;
static int impl_get_current_max_threads() noexcept;
#endif
static constexpr const char* name() noexcept { return "OpenMP"; }
};
}
namespace Kokkos {
namespace Impl {
template<>
struct MemorySpaceAccess
< Kokkos::OpenMP::memory_space
, Kokkos::OpenMP::scratch_memory_space
>
{
enum { assignable = false };
enum { accessible = true };
enum { deepcopy = false };
};
template<>
struct VerifyExecutionCanAccessMemorySpace
< Kokkos::OpenMP::memory_space
, Kokkos::OpenMP::scratch_memory_space
>
{
enum { value = true };
inline static void verify( void ) { }
inline static void verify( const void * ) { }
};
} }
#include <OpenMP/Kokkos_OpenMP_Exec.hpp>
#include <OpenMP/Kokkos_OpenMP_Team.hpp>
#include <OpenMP/Kokkos_OpenMP_Parallel.hpp>
#include <OpenMP/Kokkos_OpenMP_Task.hpp>
#include <KokkosExp_MDRangePolicy.hpp>
#endif
#endif