![]() |
fpmas 1.6
|
Namespaces | |
namespace | api |
namespace | communication |
namespace | exceptions |
namespace | graph |
namespace | io |
namespace | load_balancing |
namespace | model |
namespace | random |
namespace | runtime |
namespace | scheduler |
namespace | synchro |
namespace | utils |
Typedefs | |
template<typename Agent > | |
using | TypedAgentPtr = api::utils::PtrWrapper< Agent > |
Functions | |
void | init (int argc, char **argv) |
void | finalize () |
void | seed (unsigned long seed) |
std::string | to_string (const api::graph::DistributedId &id) |
std::string | to_string (const api::model::DiscretePoint &point) |
template<> | |
void | register_types< void > () |
template<typename _T , typename... T> | |
void | register_types () |
template<> | |
void | register_types< void > () |
Main fpmas
namespace.
using fpmas::TypedAgentPtr = typedef api::utils::PtrWrapper<Agent> |
Typed Agent pointer.
Contrary to api::model::AgentPtr, that represents a polymorphic Agent (i.e. api::utils::PtrWrapper<api::model::Agent>), this pointer is used to wrap a concrete Agent type (e.g. api::utils::PtrWrapper<UserAgent1>).
This type is notably used to define json serialization rules for user defined Agent types.
Agent | concrete agent type |
void fpmas::init | ( | int | argc, |
char ** | argv | ||
) |
Initializes FPMAS.
This must be call before any MPI communication or Model initialization is performed.
fpmas::seed(fpmas::default_seed)
is called unless an other fpmas::seed()
was performed before fpmas::init()
void fpmas::finalize | ( | ) |
Finalizes FPMAS.
No FPMAS calls are assumed to be performed after this call. Moreover, notice that because this function calls MPI_Finalize
, all FPMAS related structures must have been destroyed to avoid unexpected behaviors. This can be easily achieved using blocks.
void fpmas::seed | ( | unsigned long | seed | ) |
Seeds internal random generators.
Currently calls:
Those are currently the only static random generators used internally in an FPMAS simulation, so seeding them ensures reproducibility.
The provided seed
is not passed directly to the generators: distinct seeds are generated using a deterministic method for each generator (if the same seed was provided to all generators, they would produce exactly the same sequence. Even if their use case is different, this might introduce some bias).
This method does not directly affect user defined random generators, but the provided seed is stored in the fpmas::random::seed
static variable, so that it can be used by user defined generators while controlling them with this fpmas::seed() method.
seed | random seed |
std::string fpmas::to_string | ( | const api::graph::DistributedId & | id | ) |
Converts an api::graph::DistributedId instance to a string representation, in the form [id.rank(), id.id()]
.
id | id to convert to std::string |
std::string fpmas::to_string | ( | const api::model::DiscretePoint & | point | ) |
DiscretePoint string conversion.
point | point to convert |
void fpmas::register_types< void > | ( | ) |
Register_types recursion base case.
void fpmas::register_types | ( | ) |
Recursive function template used to register a set of types into the adl_serializer<std::type_index> and io::datapack::base_io<std::type_index>, so that their corresponding std::type_index can be serialized.
The last type specified MUST be void for the recursion to be valid.
The FPMAS_REGISTER_AGENT_TYPES(...) macro can be used instead as a more expressive and user-friendly way to register types.
void fpmas::register_types< void > | ( | ) |
Register_types recursion base case.