Sierra Toolkit Version of the Day
sierra::Env Namespace Reference

Namespace Env contains the runtime environment bootstrap for the MPI, logging, command line argument parsing, runtime information and signal handling. More...

Classes

class  Startup
 Class Startup is a sentry class for starting the application. It ensures that the command line arguments, platform and MPI are ready to go at the start of the application. More...

Enumerations

enum  ExecType {
  EXEC_TYPE_WORLD = 0,
  EXEC_TYPE_FLUID = 1,
  EXEC_TYPE_LAG = 2,
  EXEC_TYPE_PEER = 3
}
 Enumeration ExecutableType defines the known types of coordinated executables that operate with a sierra application. Unfortunately, this scheme for coordination is currently defined by Gemini whose implementation forces a limit of two executables, namely it and a fluid code. The startup_multi_exec() function handles the creation of groups which are contiguous processor groups, each with lead processor being the least ranked processor in the group. More...

Functions

const std::string & product_name ()
 Function product_name returns the product's name. This name is used to query the product registry for information concerning this product.
const std::string & executable_file ()
 Function executable_file returns the path of this executable file. information.
const std::string & executable_date ()
 Function executable_date returns the build date of the executable file as a string in the form Mmm dd yyyy hh:mm::ss.
const std::string & startup_date ()
 Function startup_date returns the startup date of this application execution.
double start_time ()
 Function start_time returns the start time of this application execution.
bool developer_mode ()
 Function developer_mode returns true if the.
void setInputFileName (std::string name)
std::string getInputFileName ()
void set_input_file_required (bool value)
 Function set_input_file_required sets whether lack of an input file specification will automatically cause failure. The default behavior corresponds to true.
void set_check_subcycle (bool value)
 Function set_check_subcycle sets whether to check input file for subcycling. The default behavior corresponds to false.
const std::string & architecture ()
 Function architecture returns the platform executing this product. This is obtained during startup by searching for a file which contains this information.
const std::string working_directory ()
 Function working_directory returns the current working directory of this application execution.
std::ostream & output ()
 Function output returns the processor output log stream. This stream is connected via an mpi_filebuf to processor 0. Upon output_flush() the output from all processors is collected on processor 0 in a sequential by process and is logged to output file in a non-jumbled manner.
std::ostream & outputP0 ()
 Function outputP0 returns the processor output log stream on processor 0 and the null log stream on all other processors.
std::ostream & outputNull ()
 Function outputNull returns the null output stream. All data is simply discarded by the buffer associated with this stream.
const char * section_separator ()
 Function output_open opens an output file on processor zero for synchronous data output from all processors via the mpi_filebuf class. The output is synchronized via the output_flush() function and maintain in the output stream list so that it is flushed and closed on application rundown.
const char * subsection_separator ()
 Function subsection_separator returns a c-style string to be used as a output subsection separator.
std::string section_title (const std::string &title)
 Function section_title returns a section title. The title has date and time concatenated and right justified to the length of the section_separator. The date and time is 20 characters wide, so adjust your titles accordingly.
int parallel_size ()
 function parallel_size returns the number of processors in the current mpi communicator.
int parallel_rank ()
 function parallel_rank returns the rank of this processor in the current mpi communicator.
MPI_Comm parallel_comm ()
 Function parallel_comm returns the current MPI communicator used by the sierra environment.
MPI_Comm parallel_world_comm ()
 Function parallel_world_comm returns the MPI_COMM_WORLD communicator used by the sierra environment in a MPMD parallel application.
int parallel_lag_master ()
 Function parallel_lag_master returns the global rank of the Sierra lagrangian application.
int parallel_fluid_master ()
 Function parallel_lag_master returns the global rank of the Gemini Euler application.
int peer_group ()
 Function peer_group returns the peer group rank for an application of type EXEC_TYPE_PEER.
std::string get_program_path (const char *program)
void parse_options (MPI_Comm comm, int *argc, char ***argv)
void startup_multi_exec (MPI_Comm world_comm, ExecType my_executable_type, const std::vector< int > *peer_sizes)
bool StartupSierra (int *argc, char ***argv, const char *product_name, const char *build_date_time, ExecType mpi_key=EXEC_TYPE_WORLD, const std::vector< int > *peer_sizes=NULL)
 Initialize MPI related operations for sierra, outputs banner, etc. returns 1 if MPI was initialized, 0 otherwise.
void ShutDownSierra (bool mpiInitFlag)
bool is_comm_valid ()
void reset (MPI_Comm mpi_comm)
 Function reset determines new parallel_size and parallel_rank. Flushes, closes, and reopens log files.
void setMpiCommunicator (MPI_Comm communicator)
void output_flush ()
 Function output_flush flushes all output on all currently open synchronous outptu files which were opened via output_open.
void request_shutdown (bool shutdown)
bool is_shutdown_requested ()
void abort ()
 Function abort aborts the execution of the sierra application.
const std::string & get_param (const char *const option)
 Function query_env_param searches the command line options for the specified option. If not found, a const reference to an empty string is returned.
void set_param (const char *option, const std::string &value)
 Member function set_param assigns the value to the parameter option.
double wall_now ()
 Member function wall_now returns the epoch as a double precision value in seconds to "millisecond" accuracy.
double cpu_now ()
 Member function cpu_now returns the accumlated cpu time for the process as a double precision value in seconds to "millisecond" accuracy.
double vm_now ()
 Member function vm_now returns the virtual memory in use for the process as a double precision value in bytes.
void output_flush (std::ostream &stream)
 Function output_flush synchronously flushes stream which was created using an mpi_filebuf.
void startup_preparallel_platform ()
 Function startup_preparallel_platform ...
void get_heap_info (size_t &heap_size, size_t &largest_free)
 Member function get_heap_info returns the amount of heap memory used in bytes and the largest free block of memory in bytes.
size_t get_available_memory ()
 Function get_available_memory returns an estimation of the amount of memory available to the process.
void get_memory_info (size_t &memory_usage, size_t &faults)
 Function get_memory_info returns the total memory usage of the process and the number of page faults accumulated by the process.
std::string hostname ()
 Function hostname returns the hostname of the host running the application.
std::string domainname ()
 Function domainname returns the domainname of the domain running the application.
std::string username ()
 Function username returns the username of the user running the application.
std::string hardware ()
 Function hardware returns the hardware type of the host running the application.
std::string osname ()
 Function osname returns the operating system nameof the host running the application.
std::string osversion ()
 Function osversion returns the hardware type of the host running the application.
int pid ()
 Function pid returns the process id of the process running the application.
int pgrp ()
 Function pgrp returns the process group id of the process running the application.
bool path_access (const std::string &path, int mode)
 Function path_access returns true if the process has permission to access path with the specified mode.
bool path_exists (const std::string &path)
 Function path_exists returns true if the path exists.
bool path_read_access (const std::string &path)
 Function path_read_access returns true if the process has read access to the path.
bool path_write_access (const std::string &path)
 Function path_write_access returns true if the process has write access to the path.
bool write_lock (int fd)
 Function write_lock returns true if the process was able to place an exclusive lock on the specified file descriptor.
bool release_lock (int fd)
 Function release_lock returns true if the process was able to release a lock previously palced on the specified file descriptor.
bool read_lock (int fd)
 Function read_lock returns true if the process was able to place a shared lock on the specified file descriptor.
bool append_lock (int fd)
 Function append_lock returns true if the process was able to place an exclusive lock on the end of the specified file descriptor. Existing records may still be accessed.
size_t get_heap_usage ()
 Function get_heap_usage returns the number of bytes used by the heap.
void activate_signals ()
 Function activate_signals enables the signal handlers.
void deactivate_signals ()
 Function deactivate_signals disables the signal handlers.
sigjmp_buf * get_sigjmpbuf ()
 Function get_sigjmpbuf enables signal handling and returns a pointer to the jump buffer for ::sigsetjmp and ::siglongjmp().
void disable_siglongjmp ()
const std::string & get_signal_message ()
 Function disable_siglongjmp disables the long jump buffer. When signals are received, they return to the caller without long jumping to the set jump point.
bool HUP_received ()
 Function request_shutdown sets the shutdown requested flag so that future calls to shutdown_requested() return true;.
bool shutdown_requested ()
 Function shutdown_requested returns true if an application shutdown has requested via the request_shutdown has been called.

Variables

static const std::string PARAM_ON = "on"
 Option value when command line option specified without a parameter.

Detailed Description

Namespace Env contains the runtime environment bootstrap for the MPI, logging, command line argument parsing, runtime information and signal handling.

MPI Initialization

Output Log File

Command Line Options

Runtime Information

Signals and Long Jump

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines