YASK
Yet Another Stencil Kit: a software framework for creating HPC stencil code. Copyright 2014-2023 Intel Corporation.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
yask::yk_env Class Referenceabstract

Kernel environment. More...

#include <yask_kernel_api.hpp>

Public Member Functions

virtual int get_num_ranks () const =0
 Get number of MPI ranks.
 
virtual int get_rank_index () const =0
 Get MPI rank index.
 
virtual void global_barrier () const =0
 Wait until all ranks have reached this element.
 
virtual idx_t sum_over_ranks (idx_t rank_val) const =0
 Find sum of an idx_t value over all ranks.
 
virtual void assert_equality_over_ranks (idx_t rank_val, const std::string &descr) const =0
 Makes sure an idx_t values is the same over all ranks.
 
virtual void finalize ()=0
 Finalize the environment.
 
virtual YASK_NORETURN void exit (int code)=0
 Finalize the environment and exit.
 

Static Public Member Functions

static void set_debug_output (yask_output_ptr debug)
 Set object to receive debug output.
 
static void disable_debug_output ()
 Disable the debug output.
 
static yask_output_ptr get_debug_output ()
 Get object to receive debug output.
 
static void print_splash (int argc, char **argv, std::string invocation_leader="invocation: ")
 Print a YASK spash message to debug output.
 
static void set_trace_enabled (bool enable)
 Enable or disable additional debug tracing.
 
static bool is_trace_enabled ()
 Get whether tracing is enabled.
 

Detailed Description

Kernel environment.

Created via yk_factory::new_env().

Member Function Documentation

◆ set_debug_output()

static void yask::yk_env::set_debug_output ( yask_output_ptr  debug)
static

Set object to receive debug output.

This is a static method, implying the following:

  • This setting may be changed before creating a yk_env object.
  • Calling this method applies settings globally.
Parameters
[out]debugPointer to object to receive debug output. See yask_output_factory.

◆ disable_debug_output()

static void yask::yk_env::disable_debug_output ( )
static

Disable the debug output.

Shortcut for calling set_debug_output() with a yask_null_output_ptr;

◆ get_debug_output()

static yask_output_ptr yask::yk_env::get_debug_output ( )
static

Get object to receive debug output.

This is a static method, implying the following:

  • This method may be called before creating a yk_env object.
Returns
Pointer to yask_output set via set_debug_output or pointer to a yask_stdout_output if not set.

◆ print_splash()

static void yask::yk_env::print_splash ( int  argc,
char **  argv,
std::string  invocation_leader = "invocation: " 
)
inlinestatic

Print a YASK spash message to debug output.

Splash message contains the YASK copyright, URL, and version. If argc > 1, also prints invocation_leader followed by the program invocation string.

◆ set_trace_enabled()

static void yask::yk_env::set_trace_enabled ( bool  enable)
static

Enable or disable additional debug tracing.

This is a static method, implying the following:

  • This setting may be changed before creating a yk_env object.
  • Calling this method applies settings globally.

Must also compile with general tracing and/or memory-access tracing enabled.

◆ is_trace_enabled()

static bool yask::yk_env::is_trace_enabled ( )
static

Get whether tracing is enabled.

This is a static method, implying the following:

  • This method may be called before creating a yk_env object.
Returns
Whether tracing is enabled.

◆ get_num_ranks()

virtual int yask::yk_env::get_num_ranks ( ) const
pure virtual

Get number of MPI ranks.

Returns
Number of ranks in MPI communicator or one (1) if MPI is not enabled.

◆ get_rank_index()

virtual int yask::yk_env::get_rank_index ( ) const
pure virtual

Get MPI rank index.

Returns
Index of this MPI rank or zero (0) if MPI is not enabled.

◆ global_barrier()

virtual void yask::yk_env::global_barrier ( ) const
pure virtual

Wait until all ranks have reached this element.

If MPI is enabled, calls MPI_Barrier(). Otherwise, has no effect.

◆ sum_over_ranks()

virtual idx_t yask::yk_env::sum_over_ranks ( idx_t  rank_val) const
pure virtual

Find sum of an idx_t value over all ranks.

Must be called from all ranks.

Returns
sum of rank_val over all ranks or simply rank_val if MPI is not enabled.

◆ assert_equality_over_ranks()

virtual void yask::yk_env::assert_equality_over_ranks ( idx_t  rank_val,
const std::string &  descr 
) const
pure virtual

Makes sure an idx_t values is the same over all ranks.

Must be called from all ranks.

Exceptions
yask_exceptionif rank_val does not have the same value across all ranks. Exception contains message with description of the value.

Does nothing if MPI is not enabled.

◆ finalize()

virtual void yask::yk_env::finalize ( )
pure virtual

Finalize the environment.

If MPI is enabled and YASK initialized the MPI communicator, calls MPI_Finalize(). This function is automatically called when a yk_env object is destroyed. Cannot call global_barrier() or any MPI-dependent API after calling this.


The documentation for this class was generated from the following file: