Logo AND Algorithmique Numérique Distribuée

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