Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #316 from bcamus/master
[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   simgrid::s4u::MailboxPtr mailbox_;
21   simgrid::s4u::MailboxPtr mailbox_small_;
22   xbt_mutex_t mailboxes_mutex_;
23   xbt_os_timer_t timer_;
24   MPI_Comm comm_self_   = MPI_COMM_NULL;
25   MPI_Comm comm_intra_  = MPI_COMM_NULL;
26   MPI_Comm* comm_world_ = nullptr;
27   SmpiProcessState state_;
28   int sampling_ = 0; /* inside an SMPI_SAMPLE_ block? */
29   std::string instance_id_;
30   bool replaying_ = false; /* is the process replaying a trace */
31   simgrid::s4u::Barrier* finalization_barrier_;
32   smpi_trace_call_location_t trace_call_loc_;
33   simgrid::s4u::ActorPtr actor_                  = nullptr;
34   smpi_privatization_region_t privatized_region_ = nullptr;
35   int optind                                     = 0; /*for getopt replacement */
36 #if HAVE_PAPI
37   /** Contains hardware data as read by PAPI **/
38   int papi_event_set_;
39   papi_counter_t papi_counter_data_;
40 #endif
41 public:
42   explicit ActorExt(simgrid::s4u::ActorPtr actor, simgrid::s4u::Barrier* barrier);
43   ~ActorExt();
44   void set_data(const char* instance_id);
45   void finalize();
46   int finalized();
47   int initializing();
48   int initialized();
49   void mark_as_initialized();
50   void set_replaying(bool value);
51   bool replaying();
52   smpi_trace_call_location_t* call_location();
53   void set_privatized_region(smpi_privatization_region_t region);
54   smpi_privatization_region_t privatized_region();
55   smx_mailbox_t mailbox();
56   smx_mailbox_t mailbox_small();
57   xbt_mutex_t mailboxes_mutex();
58 #if HAVE_PAPI
59   int papi_event_set();
60   papi_counter_t& papi_counters();
61 #endif
62   xbt_os_timer_t timer();
63   void simulated_start();
64   double simulated_elapsed();
65   MPI_Comm comm_world();
66   MPI_Comm comm_self();
67   MPI_Comm comm_intra();
68   void set_comm_intra(MPI_Comm comm);
69   void set_sampling(int s);
70   int sampling();
71   static void init();
72   simgrid::s4u::ActorPtr get_actor();
73   int get_optind();
74   void set_optind(int optind);
75 };
76
77 } // namespace smpi
78 } // namespace simgrid
79
80 #endif