Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
173e3577ddf23bfa5a4f6ce1cab6a72ee583f1a5
[simgrid.git] / src / smpi / smpi_process.hpp
1 /* Copyright (c) 2009-2010, 2012-2017. 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
11 #include <xbt/base.h>
12 #include "src/instr/instr_smpi.h"
13 #include "private.h"
14 #include "simgrid/s4u/Mailbox.hpp"
15
16 namespace simgrid{
17 namespace smpi{
18
19 class Process {
20   private:
21     double simulated_ = 0 /* Used to time with simulated_start/elapsed */;
22     int* argc_        = nullptr;
23     char*** argv_     = nullptr;
24     simgrid::s4u::MailboxPtr mailbox_;
25     simgrid::s4u::MailboxPtr mailbox_small_;
26     xbt_mutex_t mailboxes_mutex_;
27     xbt_os_timer_t timer_;
28     MPI_Comm comm_self_   = MPI_COMM_NULL;
29     MPI_Comm comm_intra_  = MPI_COMM_NULL;
30     MPI_Comm* comm_world_ = nullptr;
31     int index_            = MPI_UNDEFINED;
32     char state_;
33     int sampling_                   = 0; /* inside an SMPI_SAMPLE_ block? */
34     char* instance_id_              = nullptr;
35     bool replaying_                 = false; /* is the process replaying a trace */
36     msg_bar_t finalization_barrier_ = nullptr;
37     int return_value_               = 0;
38     smpi_trace_call_location_t trace_call_loc_;
39     smx_actor_t process_ = nullptr;
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(int index);
47     void set_data(int index, 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     smpi_trace_call_location_t* call_location();
55     int index();
56     MPI_Comm comm_world();
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(void);
62     papi_counter_t& papi_counters(void);
63 #endif
64     xbt_os_timer_t timer();
65     void simulated_start();
66     double simulated_elapsed();
67     MPI_Comm comm_self();
68     MPI_Comm comm_intra();
69     void set_comm_intra(MPI_Comm comm);
70     void set_sampling(int s);
71     int sampling();
72     msg_bar_t finalization_barrier();
73     void set_finalization_barrier(msg_bar_t bar);
74     int return_value();
75     void set_return_value(int val);
76     static void init(int *argc, char ***argv);
77     smx_actor_t process();
78 };
79
80
81 }
82 }
83
84 #endif