Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a doc error about actors (Tutorial_algorithms)
[simgrid.git] / src / smpi / include / smpi_actor.hpp
1 /* Copyright (c) 2009-2019. 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   double simulated_ = 0 /* Used to time with simulated_start/elapsed */;
19   s4u::Mailbox* mailbox_;
20   s4u::Mailbox* mailbox_small_;
21   s4u::MutexPtr mailboxes_mutex_;
22   xbt_os_timer_t timer_;
23   MPI_Comm comm_self_   = MPI_COMM_NULL;
24   MPI_Comm comm_intra_  = MPI_COMM_NULL;
25   MPI_Comm* comm_world_ = nullptr;
26   SmpiProcessState state_;
27   int sampling_ = 0; /* inside an SMPI_SAMPLE_ block? */
28   std::string instance_id_;
29   bool replaying_ = false; /* is the process replaying a trace */
30   smpi_trace_call_location_t trace_call_loc_;
31   s4u::Actor* actor_                             = nullptr;
32   smpi_privatization_region_t privatized_region_ = nullptr;
33 #ifdef __linux__
34   int optind_                                     = 0; /*for getopt replacement */
35 #else
36   int optind_                                     = 1; /*for getopt replacement */
37 #endif
38   std::string tracing_category_                  = "";
39   MPI_Info info_env_;
40   void* bsend_buffer_ = nullptr; 
41   int bsend_buffer_size_ = 0; 
42   
43 #if HAVE_PAPI
44   /** Contains hardware data as read by PAPI **/
45   int papi_event_set_;
46   papi_counter_t papi_counter_data_;
47 #endif
48 public:
49   static simgrid::xbt::Extension<simgrid::s4u::Actor, ActorExt> EXTENSION_ID;
50
51   explicit ActorExt(s4u::Actor* actor);
52   ActorExt(const ActorExt&) = delete;
53   ActorExt& operator=(const ActorExt&) = delete;
54   ~ActorExt();
55   void finalize();
56   int finalized();
57   int initializing();
58   int initialized();
59   void mark_as_initialized();
60   void set_replaying(bool value);
61   bool replaying();
62   void set_tracing_category(const std::string& category) { tracing_category_ = category; }
63   const std::string& get_tracing_category() { return tracing_category_; }
64   smpi_trace_call_location_t* call_location();
65   void set_privatized_region(smpi_privatization_region_t region);
66   smpi_privatization_region_t privatized_region();
67   s4u::Mailbox* mailbox() { return mailbox_; }
68   s4u::Mailbox* mailbox_small() { return mailbox_small_; }
69   s4u::MutexPtr mailboxes_mutex();
70 #if HAVE_PAPI
71   int papi_event_set();
72   papi_counter_t& papi_counters();
73 #endif
74   xbt_os_timer_t timer();
75   void simulated_start();
76   double simulated_elapsed();
77   MPI_Comm comm_world();
78   MPI_Comm comm_self();
79   MPI_Comm comm_intra();
80   void set_comm_intra(MPI_Comm comm);
81   void set_sampling(int s);
82   int sampling();
83   static void init();
84   s4u::ActorPtr get_actor();
85   int get_optind();
86   void set_optind(int optind);
87   MPI_Info info_env();
88   void bsend_buffer(void** buf, int* size);
89   void set_bsend_buffer(void* buf, int size);
90 };
91
92 } // namespace smpi
93 } // namespace simgrid
94
95 #endif