Skip to content

HDF5Space

nphtan edited this page May 19, 2021 · 1 revision

KokkosResilience::HDF5Space

HDF5Space is a memory space that governs access to HDF5 data.

Header File: HDF5Space.hpp

Synopsis

class HDF5Space {
public:
//! Tag this class as a kokkos memory space
typedef KokkosResilience::HDF5Space  file_space;   // used to uniquely identify file spaces
typedef KokkosResilience::HDF5Space  memory_space;
typedef size_t     size_type;

/// \typedef execution_space
/// \brief Default execution space for this memory space.
///
/// Every memory space has a default execution space.  This is
/// useful for things like initializing a View (which happens in
/// parallel using the View's default execution space).
#if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP )
typedef Kokkos::OpenMP    execution_space;
#elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS )
typedef Kokkos::Threads   execution_space;
//#elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_QTHREADS )
//  typedef Kokkos::Qthreads  execution_space;
#elif defined( KOKKOS_ENABLE_OPENMP )
typedef Kokkos::OpenMP    execution_space;
#elif defined( KOKKOS_ENABLE_THREADS )
typedef Kokkos::Threads   execution_space;
//#elif defined( KOKKOS_ENABLE_QTHREADS )
//  typedef Kokkos::Qthreads  execution_space;
#elif defined( KOKKOS_ENABLE_SERIAL )
typedef Kokkos::Serial    execution_space;
#else
#  error "At least one of the following host execution spaces must be defined: Kokkos::OpenMP, Kokkos::Threads, Kokkos::Qthreads, or Kokkos::Serial.  You might be seeing this message if you disabled the Kokkos::Serial device explicitly using the Kokkos_ENABLE_Serial:BOOL=OFF CMake option, but did not enable any of the other host execution space devices."
#endif

//! This memory space preferred device_type
typedef Kokkos::Device< execution_space, memory_space > device_type;

/**\brief  Default memory space instance */
HDF5Space();
HDF5Space( HDF5Space && rhs ) = default;
HDF5Space( const HDF5Space & rhs ) = default;
HDF5Space & operator = ( HDF5Space && ) = default;
HDF5Space & operator = ( const HDF5Space & ) = default;
~HDF5Space() = default;

/**\brief  Allocate untracked memory in the space */
void * allocate( const size_t arg_alloc_size, const std::string & path ) const;

/**\brief  Deallocate untracked memory in the space */
void deallocate( void * const arg_alloc_ptr
               , const size_t arg_alloc_size ) const;

/**\brief Return Name of the MemorySpace */
static constexpr const char* name() { return m_name; }

static void restore_all_views();
static void restore_view(const std::string name);
static void checkpoint_views();
static void checkpoint_create_view_targets();

static void set_default_path( const std::string path );
static std::string s_default_path;

static std::map<const std::string, KokkosHDF5Accessor> m_accessor_map;
};

Public Members

Typedefs

  • file space: Unique identifier for Kokkos::Resilience::HDF5Space.

  • memory_space: Identifier for the memory space. Defined as Kokkos::Resilience::HDF5Space.

  • size_type: Index type.

  • execution_space: The execution space for the HDF5Space. Default is determined by Kokkos settings.

  • device_type: Preferred device type for this memory space.

Constructors

  • HDF5space();

    Default constructor.

  • HDF5Space( HDF5Space && rhs ) = default;

    Move constructor generated by the compiler.

  • HDF5Space( const HDF5Space & rhs ) = default;

    Copy constructor generated by the compiler.

Operators

  • HDF5Space & operator = ( HDF5Space && ) = default;

    Move assignment operator.

  • HDF5Space & operator = ( const HDF5Space & ) = default;

    Copy assignment operator.

Functions

  • void * allocate( const size_t arg_alloc_size, const std::string & path ) const;

    Allocate untracked memory in the space

  • void deallocate( void * const arg_alloc_ptr
                   , const size_t arg_alloc_size ) const;

    Deallocate untracked memory in the space.

  • static constexpr const char* name();

    Return name of the memory space.

  • static void restore_all_views();

    Restores all Views in this memory space.

  • static void restore_view(const std::string name);

    Restore the View with the specified name.

  • static void checkpoint_views();

    Checkpoint Views in this space.

  • static void checkpoint_create_view_targets();
  • static void set_default_path( const std::string path );

    Set default path for the memory space to use for checkpointing.