Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions
Tpetra_Details_ExecutionSpaces.hpp File Reference
#include <iostream>
#include <sstream>
#include <vector>
#include <Kokkos_Core.hpp>
#include <Teuchos_RCP.hpp>
#include "Tpetra_Details_Behavior.hpp"
#include "Tpetra_Details_Profiling.hpp"

Go to the source code of this file.

Classes

class  Tpetra::Details::Spaces::InstanceLifetimeManager< ExecSpace >
 Provides reusable Kokkos execution space instances. More...
 

Namespaces

namespace  Tpetra
 Namespace Tpetra contains the class and methods constituting the Tpetra library.
 
namespace  Tpetra::Details
 Nonmember function that computes a residual Computes R = B - A * X.
 

Enumerations

enum class  Tpetra::Details::Spaces::Priority
 Priority interface for Tpetra's managed execution spaces. More...
 

Functions

void Tpetra::Details::Spaces::lazy_init ()
 Should be called by all functions in the Tpetra::Details::Spaces namespace.
 
template<typename ExecSpace , Priority priority = Priority::medium>
ExecSpace Tpetra::Details::Spaces::make_instance ()
 Construct a Kokkos execution space instance with the following priority.
 
template<typename ExecSpace >
ExecSpace Tpetra::Details::Spaces::make_instance (const Priority &prio)
 Construct a Kokkos::Cuda execution space instance with the requested priority.
 
template<typename ExecSpace >
Teuchos::RCP< const ExecSpaceTpetra::Details::Spaces::space_instance (const Priority &priority, int i=0)
 get a strong Teuchos::RCP to Tpetra-managed Kokkos execution space instance i
 
template<typename S1 , typename S2 >
void Tpetra::Details::Spaces::exec_space_wait (const char *msg, const S1 &waitee, const S2 &)
 cause future work submitted to waiter to wait for the current work in waitee to finish
 

Detailed Description

Interface for Tpetra's managed Kokkos execution spaces This facility strives to provide:

  1. Caching previously-constructed spaces so they can be used on-demand in parts of Tpetra
  2. Spaces of different priorities where supported
  3. Fast sync of spaces where supported

For each Kokkos backend, there is a singleton instance manager. This singleton manages the lifetime of all instances for that Kokkos backend. These singletons are not meant to be accessed directly, but through top-level functions in this file.

Definition in file Tpetra_Details_ExecutionSpaces.hpp.

Enumeration Type Documentation

◆ Priority

Priority interface for Tpetra's managed execution spaces.

Priority is best-effort. low <= medium <= high, but it may be the case that priority levels are equivalent.

Definition at line 56 of file Tpetra_Details_ExecutionSpaces.hpp.

Function Documentation

◆ lazy_init()

void Tpetra::Details::Spaces::lazy_init ( )

Should be called by all functions in the Tpetra::Details::Spaces namespace.

Prepares resources for Kokkos::CUDA exec space instance sync Maps Tpetra::Priority to CUDA stream priorities

Definition at line 26 of file Tpetra_Details_ExecutionSpaces.cpp.

◆ make_instance() [1/2]

template<typename ExecSpace , Priority priority = Priority::medium>
ExecSpace Tpetra::Details::Spaces::make_instance ( )

Construct a Kokkos execution space instance with the following priority.

If priority is not supported, returns the default space instance

Definition at line 151 of file Tpetra_Details_ExecutionSpaces.hpp.

◆ make_instance() [2/2]

template<typename ExecSpace >
ExecSpace Tpetra::Details::Spaces::make_instance ( const Priority prio)

Construct a Kokkos::Cuda execution space instance with the requested priority.

This creates a stream with the requested priority, and attaches it to a new space

Construct a Kokkos execution space instance with the requested priority

Template Parameters
ExecSpacethe type of Kokkos execution space to produce
Parameters
prioThe Tpetra::Details::Spaces::Priority of the execution space to produce

Definition at line 193 of file Tpetra_Details_ExecutionSpaces.hpp.

◆ space_instance()

template<typename ExecSpace >
Teuchos::RCP< const ExecSpace > Tpetra::Details::Spaces::space_instance ( const Priority priority,
int  i = 0 
)

get a strong Teuchos::RCP to Tpetra-managed Kokkos execution space instance i

Parameters
prioritythe priority of the execution space instance
Template Parameters
ExecSpacethe type of Execution
Returns
a strong RCP<ExecSpace>

Definition at line 380 of file Tpetra_Details_ExecutionSpaces.hpp.

◆ exec_space_wait()

template<typename S1 , typename S2 >
void Tpetra::Details::Spaces::exec_space_wait ( const char msg,
const S1 waitee,
const S2  
)

cause future work submitted to waiter to wait for the current work in waitee to finish

Template Parameters
S1the type of waitee
S2the type of waiter
Parameters
msg
waiteeFuture work submitted to this stream will wait for work in waiter to finish
waiterFuture work submitted to waitee will wait for work in this stream to finish

For Kokkos::Cuda execution spaces, this function may return immediately (i.e., without synchronizing the host).

Definition at line 414 of file Tpetra_Details_ExecutionSpaces.hpp.