Logo AND Algorithmique Numérique Distribuée

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