SuperLU Distributed 9.0.0
gpu3d
anc25d.hpp
Go to the documentation of this file.
1
2#pragma once
3#include <vector>
4#include <iostream>
5#include "superlu_ddefs.h"
6#include "lu_common.hpp"
7#ifdef HAVE_CUDA
8#include "lupanels_GPU.cuh"
9#endif
10#include "commWrapper.hpp"
11
13{
14
15 MPI_Comm *comms25d;
16 int maxLvl;
17 int *myranks;
19 MPI_Comm *initComm(gridinfo3d_t *grid3d);
20
22 {
23 maxLvl = log2i(grid3d->zscp.Np) + 1;
24 int myGrid = grid3d->zscp.Iam;
25
26 comms25d = initComm(grid3d);
27 myranks = (int *)SUPERLU_MALLOC(sizeof(int) * (maxLvl - 1));
28 commSizes = (int *)SUPERLU_MALLOC(sizeof(int) * (maxLvl - 1));
29 for (int i = 0; i < maxLvl - 1; i++)
30 {
31 commSizes[i] = 1 << (i + 1);
32 myranks[i] = myGrid % (commSizes[i]);
33
34 }
35 }
36
38 {
39
42 for (int i = 0; i < maxLvl - 1; i++)
43 {
44 MPI_Comm_free(&comms25d[i]);
45 }
47 }
48
49 // void freeComm(MPI_Comm* comm);
50
58 inline bool rankHasGrid(int k0, int alvl)
59 {
60 return k0 % commSizes[alvl - 1] == myranks[alvl - 1];
61 }
62
63 int rootRank(int k0, int alvl)
64 {
65 return k0 % commSizes[alvl - 1];
66 }
67
68 MPI_Comm getComm(int alvl)
69 {
70 return comms25d[alvl - 1];
71 }
72};
Definition: anc25d.hpp:13
int * commSizes
Definition: anc25d.hpp:18
MPI_Comm * initComm(gridinfo3d_t *grid3d)
Definition: anc25d.cpp:5
int rootRank(int k0, int alvl)
Definition: anc25d.hpp:63
MPI_Comm getComm(int alvl)
Definition: anc25d.hpp:68
anc25d_t(gridinfo3d_t *grid3d)
Definition: anc25d.hpp:21
~anc25d_t()
Definition: anc25d.hpp:37
MPI_Comm * comms25d
Definition: anc25d.hpp:15
int maxLvl
Definition: anc25d.hpp:16
bool rankHasGrid(int k0, int alvl)
Definition: anc25d.hpp:58
int * myranks
Definition: anc25d.hpp:17
Definition: superlu_defs.h:414
superlu_scope_t zscp
Definition: superlu_defs.h:418
int Np
Definition: superlu_defs.h:399
int Iam
Definition: superlu_defs.h:400
Distributed SuperLU data types and function prototypes.
int_t log2i(int_t index)
Definition: supernodal_etree.c:17
int i
Definition: sutil_dist.c:287
#define SUPERLU_MALLOC(size)
Definition: util_dist.h:48
#define SUPERLU_FREE(addr)
Definition: util_dist.h:54