malleabilityDataStructures.h 2.22 KB
Newer Older
1
2
3
4
5
6
#ifndef MALLEABILITY_DATA_STRUCTURES_H
#define MALLEABILITY_DATA_STRUCTURES_H

/*
 * 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 "malleabilityStates.h"
12

13
14
15

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

16
/* --- PHYSICAL DIST STRUCTURE --- */
17
18
19
20
struct physical_dist {
  int num_cpus, num_nodes;
  char *nodelist;
  int target_qty, already_created;
21
  int dist_type, info_type;
22
23
};

24
/* --- SPAWN STRUCTURE --- */
25
26
27
28
29
30
31
32
33
34
35
36
37
typedef struct {
  int myId, root, root_parents;
  int spawn_qty, initial_qty, target_qty;
  int already_created;
  int spawn_method, spawn_is_single, spawn_is_async;
  char *cmd; //Executable name
  MPI_Info mapping;
  MPI_Datatype dtype;
  struct physical_dist dist; // Used to create mapping var

  MPI_Comm comm, returned_comm;
} Spawn_data;

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* --- 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;
  double malleability_start, malleability_end;

  MPI_Datatype times_type;
} malleability_times_t;

/* --- GLOBAL STRUCTURES --- */
typedef struct {
  int spawn_method;
  int spawn_dist;
  int spawn_strategies;
  int red_method;
  int red_strategies;

  malleability_times_t *times;
} malleability_config_t;

typedef struct { //FIXME numC_spawned no se esta usando
61
  int myId, numP, numC, numC_spawned, root, root_parents, zombie;
62
  int is_intercomm;
63
64
  pthread_t async_thread;
  MPI_Comm comm, thread_comm;
65
66
  MPI_Comm intercomm, tmp_comm;
  MPI_Comm *user_comm;
67
  MPI_Datatype struct_type;
68
69
70
71
72
73
74
75
76
  
  char *name_exec, *nodelist;
  int num_cpus, num_nodes, nodelist_len;
} malleability_t;

/* --- VARIABLES --- */
malleability_config_t *mall_conf;
malleability_t *mall;

77
78
79
extern const char *mam_key_names[];
enum mam_key_values{MAM_SPAWN_METHOD_VALUE=0, MAM_SPAWN_STRATEGIES_VALUE, MAM_PHYSICAL_DISTRIBUTION_VALUE, MAM_PYHSICAL_DISTRIBUTION_VALUE, MAM_RED_METHOD_VALUE, MAM_RED_STRATEGIES_VALUE, MAM_KEY_COUNT};

80
81
82
83
84
85
/* --- FUNCTIONS --- */
void MAM_Def_main_datatype();
void MAM_Free_main_datatype();
void MAM_Comm_main_structures(int rootBcast);


86
#endif