13#include "arcane/aleph/AlephTopology.h"
15#include "arcane/aleph/AlephKernel.h"
16#include "arcane/aleph/AlephArcane.h"
31AlephTopology(AlephKernel* kernel)
32: TraceAccessor(kernel->parallel()->traceMng())
36, m_gathered_nb_row_elements(0)
38, m_has_set_row_nb_elements(false)
39, m_has_been_initialized(false)
41 debug() <<
"\33[1;32m\t[AlephTopology::AlephTopology] Loading MINIMALE AlephTopology"
48AlephTopology(ITraceMng* tm,
54, m_nb_row_size(nb_row_size)
55, m_nb_row_rank(nb_row_rank)
56, m_gathered_nb_row_elements()
58, m_has_set_row_nb_elements(false)
59, m_has_been_initialized(true)
61 ItacFunction(AlephTopology);
62 debug() <<
"\33[1;32m\t[AlephTopology::AlephTopology] Loading AlephTopology"
65 m_gathered_nb_setValued.resize(m_kernel->size());
66 m_gathered_nb_row.resize(m_kernel->size() + 1);
67 m_gathered_nb_row[0] = 0;
69 if (!m_kernel->isParallel()) {
70 m_gathered_nb_row[1] = m_nb_row_size;
71 debug() <<
"\33[1;32m\t[AlephTopology::AlephTopology] SEQ done"
76 if (m_kernel->isAnOther()) {
77 debug() <<
"\33[1;32m\t[AlephTopology::AlephTopology] receiving m_gathered_nb_row"
79 m_kernel->world()->broadcast(m_gathered_nb_row.view(), 0);
83 debug() <<
"\33[1;32m\t[AlephTopology::AlephTopology] Nous nous échangeons les indices locaux des lignes de la matrice"
85 UniqueArray<Integer> all_rows;
86 UniqueArray<Integer> gathered_nb_row(m_kernel->size());
87 all_rows.add(m_nb_row_rank);
88 m_kernel->parallel()->allGather(all_rows, gathered_nb_row);
89 for (
int iCpu = 0; iCpu < m_kernel->size(); ++iCpu) {
90 m_gathered_nb_row[iCpu + 1] = m_gathered_nb_row[iCpu] + gathered_nb_row[iCpu];
91 debug() <<
"\33[1;32m\t\t[AlephTopology::AlephTopology] " << iCpu <<
":" << m_gathered_nb_row[iCpu] <<
"\33[0m";
93 debug() <<
"\33[1;32m\t[AlephTopology::AlephTopology] m_parallel_info_partitioning done"
96 if (m_kernel->thereIsOthers() && !m_kernel->isAnOther()) {
97 debug() <<
"\33[1;32m\t[AlephTopology::AlephTopology] sending m_gathered_nb_row"
99 m_kernel->world()->broadcast(m_gathered_nb_row.view(), 0);
108 debug() <<
"\33[1;5;32m\t[~AlephTopology]"
116create(Integer setValue_idx)
118 ItacFunction(AlephTopology);
126 if (!m_kernel->isParallel()) {
127 debug() <<
"\33[1;32m\t\t\t[AlephTopology::create] SEQ m_gathered_nb_setValued[0]=" << setValue_idx <<
"\33[0m";
128 m_gathered_nb_setValued[0] = setValue_idx;
132 debug() <<
"\33[1;32m\t\t\t[AlephTopology::create]"
134 if (m_kernel->isAnOther()) {
135 debug() <<
"\33[1;32m\t[AlephTopology::create] receiving m_gathered_nb_setValued"
137 m_kernel->world()->broadcast(m_gathered_nb_setValued.view(), 0);
142 UniqueArray<AlephInt> all;
143 all.add(setValue_idx);
144 m_kernel->parallel()->allGather(all, m_gathered_nb_setValued);
146 if (m_kernel->thereIsOthers() && !m_kernel->isAnOther()) {
147 debug() <<
"\33[1;32m\t[AlephTopology::create] sending m_gathered_nb_setValued"
149 m_kernel->world()->broadcast(m_gathered_nb_setValued.view(), 0);
151 debug() <<
"\33[1;32m\t\t\t[AlephTopology::create] done"
164setRowNbElements(IntegerConstArrayView row_nb_element)
168 debug() <<
"\33[1;32m\t\t\t[AlephTopology::setRowNbElements]"
170 if (m_has_set_row_nb_elements)
172 m_has_set_row_nb_elements =
true;
173 debug() <<
"\33[1;32m\t\t\t[AlephTopology::setRowNbElements]"
177 debug() <<
"\33[1;32m\t\t\t[AlephTopology::setRowNbElements] resize m_gathered_nb_row_elements to " << m_nb_row_size <<
"\33[0m";
178 m_gathered_nb_row_elements.resize(m_nb_row_size);
180 if (m_kernel->isAnOther()) {
181 debug() <<
"\33[1;32m\t\t\t[AlephTopology::setRowNbElements] isAnOther from 0"
184 m_kernel->world()->broadcast(m_gathered_nb_row_elements.view(), 0);
185 debug() <<
"\33[1;32m\t\t\t[AlephTopology::setRowNbElements] done"
191 UniqueArray<AlephInt> local_row_nb_element(m_nb_row_rank);
192 for (
int i = 0; i < m_nb_row_rank; ++i)
193 local_row_nb_element[i] = row_nb_element[i];
194 m_kernel->parallel()->allGatherVariable(local_row_nb_element, m_gathered_nb_row_elements);
196 if (m_kernel->thereIsOthers() && !m_kernel->isAnOther()) {
197 debug() <<
"\33[1;32m\t\t\t[AlephTopology::setRowNbElements] Sending m_gathered_nb_row_elements of size=" << m_gathered_nb_row_elements.size() <<
"\33[0m";
198 m_kernel->world()->broadcast(m_gathered_nb_row_elements.view(), 0);
200 debug() <<
"\33[1;32m\t\t\t[AlephTopology::setRowNbElements] done"
209 debug() <<
"\33[1;32m\t[AlephTopology::ptr_low_up_array]"
216ConstArrayView<AlephInt> AlephTopology::
221 return m_gathered_nb_row;
226IParallelMng* AlephTopology::
229 debug() <<
"\33[1;32m\t[AlephTopology::parallelMng]"
231 return m_kernel->parallel();
237rowRange(Integer& min_row, Integer& max_row)
239 const Integer rank = m_kernel->rank();
241 debug() <<
"\33[1;32m\t[AlephTopology::rowRange] rank=" << rank <<
"\33[0m";
242 min_row = m_gathered_nb_row[rank];
243 max_row = m_gathered_nb_row[rank + 1];
244 debug() <<
"\33[1;32m\t[AlephTopology::rowRange] min_row=" << min_row <<
", max_row=" << max_row <<
"\33[0m";
250rowLocalRange(
const Integer index)
256 for (
int iCpu = 0; iCpu < m_kernel->size(); ++iCpu) {
257 if (m_kernel->rank() != m_kernel->solverRanks(index)[iCpu])
260 ilower = m_kernel->topology()->gathered_nb_row(iCpu);
261 iupper = m_kernel->topology()->gathered_nb_row(iCpu + 1) - 1;
263 range = iupper - ilower + 1;
264 debug() <<
"\33[1;32m\t[AlephTopology::rowLocalRange] ilower=" << ilower
265 <<
", iupper=" << iupper <<
", range=" << range <<
"\33[0m";
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ConstArrayView< Integer > IntegerConstArrayView
Equivalent C d'un tableau à une dimension d'entiers.
Int32 Integer
Type représentant un entier.