Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX.H File Reference

Runtime initialization/finalization helpers and global diagnostics. More...

#include <AMReX_Config.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_GpuPrint.H>
#include <AMReX_GpuAssert.H>
#include <AMReX_ccse-mpi.H>
#include <AMReX_Exception.H>
#include <AMReX_Extension.H>
#include <cstdint>
#include <cstring>
#include <functional>
#include <iostream>
#include <memory>
#include <string>
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

class  amrex::AMReX
 Runtime context stored for each active amrex::Initialize() call. More...
 

Namespaces

namespace  amrex
 
namespace  amrex::system
 Compile- and run-time configuration flags; defaults are set during Initialize() and may be updated later (e.g., via ParmParse or setters).
 

Typedefs

using amrex::PTR_TO_VOID_FUNC = void(*)()
 
using amrex::ErrorHandler = void(*)(const char *)
 

Enumerations

enum struct  amrex::FPExcept : std::uint8_t {
  amrex::none = 0B0000 , amrex::invalid = 0B0001 , amrex::zero = 0B0010 , amrex::overflow = 0B0100 ,
  amrex::all = 0B0111
}
 

Functions

std::string amrex::Version ()
 Return the AMReX version string reported by git describe.
 
AMReXamrex::Initialize (MPI_Comm mpi_comm, std::ostream &a_osout=std::cout, std::ostream &a_oserr=std::cerr, ErrorHandler a_errhandler=nullptr, int a_device_id=-1)
 Initialize AMReX using an existing MPI communicator.
 
AMReXamrex::Initialize (int &argc, char **&argv, const std::function< void()> &func_parm_parse, std::ostream &a_osout=std::cout, std::ostream &a_oserr=std::cerr, ErrorHandler a_errhandler=nullptr, int a_device_id=-1)
 Initialize AMReX from argc/argv with custom ParmParse handling.
 
AMReXamrex::Initialize (int &argc, char **&argv, bool build_parm_parse=true, MPI_Comm mpi_comm=MPI_COMM_WORLD, const std::function< void()> &func_parm_parse={}, std::ostream &a_osout=std::cout, std::ostream &a_oserr=std::cerr, ErrorHandler a_errhandler=nullptr, int a_device_id=-1)
 Initialize AMReX from argc/argv, optionally constructing ParmParse.
 
void amrex::Init_minimal (MPI_Comm mpi_comm=MPI_COMM_WORLD)
 Minimal initialization for utilities that need only part of AMReX.
 
bool amrex::Initialized ()
 Returns true if there are any currently-active and initialized AMReX instances (i.e. one for which amrex::Initialize has been called, and amrex::Finalize has not). Otherwise false.
 
void amrex::Finalize (AMReX *pamrex)
 Finalize AMReX state associated with the supplied instance pointer.
 
void amrex::Finalize ()
 Convenience overload that finalizes the instance at the top of the stack.
 
void amrex::Finalize_minimal ()
 Finalize a run that was initialized via Init_minimal().
 
void amrex::ExecOnFinalize (std::function< void()> func)
 Register a callback invoked during Finalize() (LIFO order).
 
void amrex::ExecOnInitialize (std::function< void()> func)
 Register a callback invoked early in Initialize().
 
template<class... Ts>
__host__ __device__ void amrex::ignore_unused (const Ts &...)
 No-op helper that marks variables as intentionally unused.
 
void amrex::Error (const std::string &msg)
 Print a message to stderr and abort the program.
 
void amrex::Error_host (const char *type, const char *msg)
 Host-side error sink invoked by GPU-friendly overloads.
 
__host__ __device__ void amrex::Error (const char *msg=nullptr)
 Print a message to stderr and abort the program.
 
void amrex::Warning (const std::string &msg)
 Print a warning message to the diagnostic stream and keep running.
 
void amrex::Warning_host (const char *msg)
 Print a warning message to the diagnostic stream (host only).
 
__host__ __device__ void amrex::Warning (const char *msg)
 Print a warning message to the diagnostic stream and keep running.
 
void amrex::Abort (const std::string &msg)
 Print a fatal-error message to stderr and abort execution.
 
__host__ __device__ void amrex::Abort (const char *msg=nullptr)
 Print a fatal-error message to stderr and abort execution.
 
void amrex::Assert_host (const char *EX, const char *file, int line, const char *msg, std::size_t msg_size=0)
 Host-side assertion helper used by BL_ASSERT().
 
__host__ __device__ void amrex::Assert (const char *EX, const char *file, int line)
 Device/host assertion helper used by BL_ASSERT.
 
__host__ __device__ void amrex::Assert (const char *EX, const char *file, int line, const char *msg)
 Assert helper that includes an additional message in the output.
 
void amrex::Assert (const char *EX, const char *file, int line, const std::string &msg)
 
void amrex::write_to_stderr_without_buffering (const char *str)
 Write directly to stderr after flushing standard I/O buffers.
 
void amrex::SetErrorHandler (ErrorHandler f)
 Install a custom error handler invoked by amrex::Error_host.
 
std::ostream & amrex::OutStream ()
 Stream that receives informational output (defaults to std::cout).
 
std::ostream & amrex::ErrorStream ()
 Stream that receives diagnostic output (defaults to std::cerr).
 
int amrex::Verbose () noexcept
 Return the verbosity level configured via ParmParse or SetVerbose().
 
void amrex::SetVerbose (int v) noexcept
 Override the verbosity level used by amrex::Print().
 
bool amrex::InitSNaN () noexcept
 Whether new allocations are filled with signaling NaNs when enabled.
 
void amrex::SetInitSNaN (bool v) noexcept
 Toggle whether new allocations are initialized with signaling NaNs.
 
std::string amrex::get_command ()
 Get the entire command line including the executable path.
 
int amrex::command_argument_count ()
 Get the number of command line arguments excluding argv[0].
 
std::string amrex::get_command_argument (int number)
 Fetch a copy of argv[number] (argv[0] is the executable path).
 
void amrex::GccPlacater ()
 
bool amrex::any (FPExcept a)
 Return true when a is not FPExcept::none (i.e., the mask is non-empty).
 
FPExcept amrex::operator| (FPExcept a, FPExcept b)
 Bitwise union of two floating-point exception masks.
 
FPExcept amrex::operator& (FPExcept a, FPExcept b)
 Bitwise intersection of two floating-point exception masks.
 
FPExcept amrex::getFPExcept ()
 Return currently enabled FP exceptions. Linux only.
 
FPExcept amrex::setFPExcept (FPExcept excepts)
 
FPExcept amrex::disableFPExcept (FPExcept excepts)
 Disable FP exceptions. Linux Only.
 
FPExcept amrex::enableFPExcept (FPExcept excepts)
 Enable FP exceptions. Linux Only.
 

Variables

constexpr bool amrex::system::NDebug = true
 
constexpr bool amrex::system::Debug = false
 

Detailed Description

Runtime initialization/finalization helpers and global diagnostics.