Skip to content

StdFileSpace

nphtan edited this page May 19, 2021 · 1 revision

KokkosResilience::StdFileSpace

StdFileSpace is a memory spacec that governs access to StdFile data.

Header File: StdFileSpace.hpp

Synopsis

class StdFileSpace {
public:
//! Tag this class as a kokkos memory space
typedef KokkosResilience::StdFileSpace  file_space;   // used to uniquely identify file spaces
typedef KokkosResilience::StdFileSpace  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 */
StdFileSpace();
StdFileSpace( StdFileSpace && rhs ) = default;
StdFileSpace( const StdFileSpace & rhs ) = default;
StdFileSpace & operator = ( StdFileSpace && ) = default;
StdFileSpace & operator = ( const StdFileSpace & ) = default;
~StdFileSpace() = 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;
};

Public Members

Typedefs

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

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

  • size_type: Index type.

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

  • device_type: Preferred device type for this memory space.

Constructors

  • StdFilespace();

    Default constructor.

  • StdFileSpace( StdFileSpace && rhs ) = default;

    Move constructor generated by the compiler.

  • StdFileSpace( const StdFileSpace & rhs ) = default;

    Copy constructor generated by the compiler.

Operators

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

    Move assignment operator.

  • StdFileSpace & operator = ( const StdFileSpace & ) = 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.