Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stringify xbt::config and plugins
[simgrid.git] / src / smpi / include / smpi_actor.hpp
1 /* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SMPI_ACTOR_HPP
7 #define SMPI_ACTOR_HPP
8
9 #include "private.hpp"
10 #include "simgrid/s4u/Mailbox.hpp"
11 #include "src/instr/instr_smpi.hpp"
12 #include "xbt/synchro.h"
13
14 namespace simgrid {
15 namespace smpi {
16
17 class ActorExt {
18 private:
19   double simulated_ = 0 /* Used to time with simulated_start/elapsed */;
20   int* argc_        = nullptr;
21   char*** argv_     = nullptr;
22   simgrid::s4u::MailboxPtr mailbox_;
23   simgrid::s4u::MailboxPtr mailbox_small_;
24   xbt_mutex_t mailboxes_mutex_;
25   xbt_os_timer_t timer_;
26   MPI_Comm comm_self_   = MPI_COMM_NULL;
27   MPI_Comm comm_intra_  = MPI_COMM_NULL;
28   MPI_Comm* comm_world_ = nullptr;
29   void* data_           = nullptr; /* user data */
30   SmpiProcessState state_;
31   int sampling_ = 0; /* inside an SMPI_SAMPLE_ block? */
32   std::string instance_id_;
33   bool replaying_ = false; /* is the process replaying a trace */
34   simgrid::s4u::Barrier* finalization_barrier_;
35   smpi_trace_call_location_t trace_call_loc_;
36   simgrid::s4u::ActorPtr actor_                  = nullptr;
37   smpi_privatization_region_t privatized_region_ = nullptr;
38   int optind                                     = 0; /*for getopt replacement */
39 #if HAVE_PAPI
40   /** Contains hardware data as read by PAPI **/
41   int papi_event_set_;
42   papi_counter_t papi_counter_data_;
43 #endif
44 public:
45   explicit ActorExt(simgrid::s4u::ActorPtr actor, simgrid::s4u::Barrier* barrier);
46   ~ActorExt();
47   void set_data(int* argc, char*** argv);
48   void finalize();
49   int finalized();
50   int initialized();
51   void mark_as_initialized();
52   void set_replaying(bool value);
53   bool replaying();
54   void set_user_data(void* data);
55   void* get_user_data();
56   smpi_trace_call_location_t* call_location();
57   void set_privatized_region(smpi_privatization_region_t region);
58   smpi_privatization_region_t privatized_region();
59   smx_mailbox_t mailbox();
60   smx_mailbox_t mailbox_small();
61   xbt_mutex_t mailboxes_mutex();
62 #if HAVE_PAPI
63   int papi_event_set();
64   papi_counter_t& papi_counters();
65 #endif
66   xbt_os_timer_t timer();
67   void simulated_start();
68   double simulated_elapsed();
69   MPI_Comm comm_world();
70   MPI_Comm comm_self();
71   MPI_Comm comm_intra();
72   void set_comm_intra(MPI_Comm comm);
73   void set_sampling(int s);
74   int sampling();
75   static void init(int* argc, char*** argv);
76   simgrid::s4u::ActorPtr get_actor();
77   int get_optind();
78   void set_optind(int optind);
79 };
80
81 } // namespace smpi
82 } // namespace simgrid
83
84 #endif