Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid costly exceptions when looking into a map.
[simgrid.git] / src / smpi / include / private.hpp
1 /* Copyright (c) 2016. 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_PRIVATE_HPP
7 #define SMPI_PRIVATE_HPP
8
9 #include "src/instr/instr_smpi.h"
10 #include <unordered_map>
11 #include <vector>
12 #include "src/internal_config.h"
13
14 /**
15  * Get the address of the beginning of the memory page where addr is located.
16  * Note that we use an integer division here, so (a/b)*b is not a, unless a%b == 0
17  *
18  * This is used when privatizing.
19  */
20 #define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
21
22 #if HAVE_PAPI
23 typedef
24     std::vector<std::pair</* counter name */std::string, /* counter value */long long>> papi_counter_t;
25 XBT_PRIVATE papi_counter_t& smpi_process_papi_counters();
26 XBT_PRIVATE int smpi_process_papi_event_set();
27 #endif
28
29 extern std::unordered_map<std::string, double> location2speedup;
30
31 /** @brief Returns the last call location (filename, linenumber). Process-specific. */
32 extern "C" {
33 XBT_PUBLIC(smpi_trace_call_location_t*) smpi_process_get_call_location();
34 XBT_PUBLIC(smpi_trace_call_location_t*) smpi_trace_get_call_location();
35 }
36
37 typedef enum {
38   SMPI_PRIVATIZE_NONE    = 0,
39   SMPI_PRIVATIZE_MMAP    = 1,
40   SMPI_PRIVATIZE_DLOPEN  = 2,
41   SMPI_PRIVATIZE_DEFAULT = SMPI_PRIVATIZE_MMAP
42 } smpi_priv_strategies;
43
44 extern XBT_PRIVATE int smpi_privatize_global_variables;
45
46 #endif
47