LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
exception.hpp File Reference
#include "lbann/comm.hpp"
#include <exception>
#include <iostream>
#include <sstream>
Include dependency graph for exception.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  lbann::exception
 The base exception for LBANN errors. More...
 

Namespaces

 lbann
 

Macros

#define LBANN_ERROR(...)
 
#define LBANN_WARNING(...)
 
#define LBANN_WARNING_WORLD_ROOT(...)
 
#define LBANN_MSG(...)
 
#define LBANN_ASSERT(cond)
 
#define LBANN_ASSERT_DEBUG(cond)
 
#define LBANN_ASSERT_WARNING(cond)
 

Typedefs

using lbann::lbann_exception = exception
 

Functions

template<typename... Args>
std::string lbann::build_string (Args &&... args)
 Build a string from the arguments. More...
 

Macro Definition Documentation

◆ LBANN_ASSERT

#define LBANN_ASSERT (   cond)
Value:
if (!(cond)) \
LBANN_ERROR("The assertion " #cond " failed.")

Definition at line 97 of file exception.hpp.

◆ LBANN_ASSERT_DEBUG

#define LBANN_ASSERT_DEBUG (   cond)

Definition at line 104 of file exception.hpp.

◆ LBANN_ASSERT_WARNING

#define LBANN_ASSERT_WARNING (   cond)
Value:
if (!(cond)) \
LBANN_WARNING("The assertion " #cond " failed.")

Definition at line 107 of file exception.hpp.

◆ LBANN_ERROR

#define LBANN_ERROR (   ...)
Value:
do { \
const int rank_LBANN_ERROR = lbann::get_rank_in_world(); \
throw ::lbann::exception(::lbann::build_string( \
"LBANN error", \
(rank_LBANN_ERROR >= 0 ? " on rank " + std::to_string(rank_LBANN_ERROR) \
: std::string()), \
" (", \
__FILE__, \
":", \
__LINE__, \
"): ", \
__VA_ARGS__)); \
} while (0)
std::string build_string(Args &&... args)
Build a string from the arguments.
Definition: exception.hpp:157
std::string to_string(El::Device const &d)
int get_rank_in_world()

Definition at line 37 of file exception.hpp.

◆ LBANN_MSG

#define LBANN_MSG (   ...)
Value:
do { \
const int rank_LBANN_MSG = lbann::get_rank_in_world(); \
if (rank_LBANN_MSG == 0) { \
std::cout << lbann::build_string( \
"LBANN message", \
(rank_LBANN_MSG >= 0 \
? " on rank " + std::to_string(rank_LBANN_MSG) \
: std::string()), \
" (", \
__FILE__, \
":", \
__LINE__, \
"): ", \
__VA_ARGS__) \
<< std::endl; \
} \
} while (0)
std::string build_string(Args &&... args)
Build a string from the arguments.
Definition: exception.hpp:157
std::string to_string(El::Device const &d)
int get_rank_in_world()

Definition at line 78 of file exception.hpp.

◆ LBANN_WARNING

#define LBANN_WARNING (   ...)
Value:
do { \
const int rank_LBANN_WARNING = lbann::get_rank_in_world(); \
std::cerr << lbann::build_string( \
"LBANN warning", \
(rank_LBANN_WARNING >= 0 \
? " on rank " + std::to_string(rank_LBANN_WARNING) \
: std::string()), \
" (", \
__FILE__, \
":", \
__LINE__, \
"): ", \
__VA_ARGS__) \
<< std::endl; \
} while (0)
std::string build_string(Args &&... args)
Build a string from the arguments.
Definition: exception.hpp:157
std::string to_string(El::Device const &d)
int get_rank_in_world()

Definition at line 53 of file exception.hpp.

◆ LBANN_WARNING_WORLD_ROOT

#define LBANN_WARNING_WORLD_ROOT (   ...)
Value:
do { \
if (lbann::get_rank_in_world() == 0) { \
LBANN_WARNING(__VA_ARGS__); \
} \
} while (0)
int get_rank_in_world()

Definition at line 70 of file exception.hpp.