MAM_DataStructures.h 2.45 KB
Newer Older
1
2
#ifndef MAM_DATA_STRUCTURES_H
#define MAM_DATA_STRUCTURES_H
3
4
5
6

/*
 * Shows available data structures for inner ussage.
 */
7
8
#include <stdlib.h>
#include <stdio.h>
9
#include <mpi.h>
10
#include <pthread.h>
11
#include "MAM_Constants.h"
12

13
14
#define DEBUG_FUNC(debug_string, rank, numP) printf("MaM [P%d/%d]: %s -- %s:%s:%d\n", rank, numP, debug_string, __FILE__, __func__, __LINE__)

15
16
/* --- MAM INNER CONSTANTS --- */
#define MAM_ROOT 0
17
18
19
enum mam_inner_states{MAM_I_UNRESERVED, MAM_I_NOT_STARTED, MAM_I_RMS_COMPLETED, MAM_I_SPAWN_PENDING, MAM_I_SPAWN_SINGLE_PENDING, 
	MAM_I_SPAWN_SINGLE_COMPLETED, MAM_I_SPAWN_ADAPT_POSTPONE, MAM_I_SPAWN_COMPLETED, MAM_I_DIST_PENDING, MAM_I_DIST_COMPLETED, 
	MAM_I_SPAWN_ADAPT_PENDING, MAM_I_USER_START, MAM_I_USER_PENDING, MAM_I_USER_COMPLETED, MAM_I_SPAWN_ADAPTED, MAM_I_COMPLETED};
20

21
22
23
24
25
26
#define MAM_USE_VALGRIND 1
#define MAM_USE_EXTRAE 2

#define MAM_VALGRIND_SCRIPT "./worker_valgrind.sh"
#define MAM_EXTRAE_SCRIPT "./worker_extrae.sh"

27
28
29
30
31
32
/* --- TIME CAPTURE STRUCTURE --- */
typedef struct {
  // Spawn, Sync and Async time
  double spawn_start, spawn_time;
  double sync_start,  sync_end;
  double async_start, async_end;
33
  double user_start, user_end;
34
35
36
37
38
39
40
  double malleability_start, malleability_end;

  MPI_Datatype times_type;
} malleability_times_t;

/* --- GLOBAL STRUCTURES --- */
typedef struct {
41
42
43
44
45
  unsigned int spawn_method;
  unsigned int spawn_dist;
  unsigned int spawn_strategies;
  unsigned int red_method;
  unsigned int red_strategies;
46

47
  int external_usage; // Whether a different application should be called by Spawn and which
48
  int slurm_jid; //DMR ADDITION - Which is the original Slurm JobId
49

50
51
52
  malleability_times_t *times;
} malleability_config_t;

iker_martin's avatar
iker_martin committed
53
typedef struct { 
54
55
  int myId, numP, numC, zombie;
  int root, root_collectives;
56
  int num_parents, root_parents, gid;
57
  pthread_t async_thread;
58
  MPI_Comm comm, thread_comm, original_comm;
59
60
  MPI_Comm intercomm, tmp_comm;
  MPI_Comm *user_comm;
61
  MPI_Datatype struct_type;
62
63
64
65

  // Specific vars for Wait_targets strat
  int wait_targets_posted;
  MPI_Request wait_targets;
66
67
68
  
  char *name_exec, *nodelist;
  int num_cpus, num_nodes, nodelist_len;
69
  int internode_group;
70
71
72
} malleability_t;

/* --- VARIABLES --- */
73
74
extern malleability_config_t *mall_conf;
extern malleability_t *mall;
75
extern int state;
76

77
78
79
/* --- FUNCTIONS --- */
void MAM_Def_main_datatype();
void MAM_Free_main_datatype();
80
void MAM_Comm_main_structures(MPI_Comm comm, int rootBcast);
81

82
83
void MAM_print_comms_state();
void MAM_comms_update(MPI_Comm comm);
84

85
#endif