block_distribution.h 1018 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef mall_block_distribution
#define mall_block_distribution

#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>

struct Dist_data {
  int ini; //Primer elemento a enviar
  int fin; //Ultimo elemento a enviar

  int tamBl; // Total de elementos
  int qty; // Total number of rows of the full disperse matrix

  int myId;
  int numP;
  MPI_Comm intercomm;
};

struct Counts {
21
22
  int len, idI, idE;
  int first_target_displs; // RMA. Indicates displacement for first target when performing a Get.
23
24
25
26
  int *counts;
  int *displs;
};

27
void prepare_comm_alltoall(int myId, int numP, int numP_other, int n, int offset_ids, struct Counts *counts);
28
29
30
void prepare_comm_allgatherv(int numP, int n, struct Counts *counts);
void get_block_dist(int qty, int id, int numP, struct Dist_data *dist_data);

31
void mallocCounts(struct Counts *counts, size_t numP);
32
33
34
35
void freeCounts(struct Counts *counts);
void print_counts(struct Dist_data data_dist, int *xcounts, int *xdispls, int size, int include_zero, const char* name);

#endif