malleabilityDataStructures.h 1.88 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
#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
/* --- PHYSICAL DIST STRUCTURE --- */
16
17
struct physical_dist {
  int target_qty, already_created;
18
  int info_type;
19
20
};

21
/* --- SPAWN STRUCTURE --- */
22
23
24
typedef struct {
  int spawn_qty, initial_qty, target_qty;
  int already_created;
iker_martin's avatar
iker_martin committed
25
  int spawn_is_single, spawn_is_async;
26
27
28
29
30
31
32
  MPI_Info mapping;
  MPI_Datatype dtype;
  struct physical_dist dist; // Used to create mapping var

  MPI_Comm comm, returned_comm;
} Spawn_data;

33
34
35
36
37
38
39
40
41
42
43
44
45
/* --- 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 {
46
47
48
49
50
  unsigned int spawn_method;
  unsigned int spawn_dist;
  unsigned int spawn_strategies;
  unsigned int red_method;
  unsigned int red_strategies;
51
52
53
54

  malleability_times_t *times;
} malleability_config_t;

iker_martin's avatar
iker_martin committed
55
56
57
typedef struct { 
  int myId, numP, numC, root, zombie;
  int num_parents, root_parents;
58
  int is_intercomm;
59
60
  pthread_t async_thread;
  MPI_Comm comm, thread_comm;
61
62
  MPI_Comm intercomm, tmp_comm;
  MPI_Comm *user_comm;
63
  MPI_Datatype struct_type;
64
65
66
67
68
69
70
71
  
  char *name_exec, *nodelist;
  int num_cpus, num_nodes, nodelist_len;
} malleability_t;

/* --- VARIABLES --- */
malleability_config_t *mall_conf;
malleability_t *mall;
72
extern int state;
73

74
75
76
77
78
79
/* --- FUNCTIONS --- */
void MAM_Def_main_datatype();
void MAM_Free_main_datatype();
void MAM_Comm_main_structures(int rootBcast);


80
#endif