5#ifndef RUN_LOCALSTIFFNESSMATRICESMEMORYDISTRIBUTION_H
6#define RUN_LOCALSTIFFNESSMATRICESMEMORYDISTRIBUTION_H
11#include "LocalStiffnessMatrices.h"
14class LocalStiffnessMatricesMemoryDistribution:
public LocalStiffnessMatrices{
17 LocalStiffnessMatricesMemoryDistribution(
AdaptiveSparseGrid &sg, StencilTemplate& stencilClass,
int number_processes_)
18 :LocalStiffnessMatrices(sg, stencilClass, number_processes_){
26 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
27 MPI_Comm_size(MPI_COMM_WORLD, &num_tasks);
29 cout <<
"USE LOCALSTIFFNESSMATRICES ONLY WITH MPI" << endl;
32 struct timeval begin_time, end_time;
35 gettimeofday(&begin_time, 0);
37 Container container[number_processes];
38 distribute_LocalStiffnessMatrices(number_processes, sg, container);
40 distributedDepthsHashtable = DistributedDepthsHashtable(container, number_processes);
43 gettimeofday(&end_time, 0);
44 seconds = end_time.tv_sec - begin_time.tv_sec;
45 microseconds = end_time.tv_usec - begin_time.tv_usec;
46 double t2 = seconds + microseconds * 1e-6;
47 if(rank==0)cout <<
"time generate hashtable " << t2 << endl;
96 for (
auto it = depthList.begin_all(); it != depthList.end_all(); ++it){
99 int node = distributedDepthsHashtable.getNodeForDepth(T);
103 struct timeval begin_time, end_time, end_time2;
106 gettimeofday(&begin_time, 0);
108 stencilClass.initialize(T);
116 const SingleDepthHashCellStructure &depthGrid = cellData.getGridForDepth(Tcell);
117 const auto &map = depthGrid._map;
118 const auto end = depthGrid.getNumberOfEntries();
123 std::vector<LocalStiffnessMatrixFixedDepthSymmetric> vector;
124 gettimeofday(&begin_time, 0);
125#pragma omp parallel for schedule(dynamic)
126 for (
size_t i = 0; i < end; i++) {
127 CellDimension cellDimension = map.getIndexOfTable(i);
128 LocalStiffnessMatrixFixedDepthSymmetric localStiffnessMatrixFixedDepthSymmetric(cellDimension, sg, stencilClass);
133 vector.push_back(localStiffnessMatrixFixedDepthSymmetric);
135 gettimeofday(&end_time2, 0);
136 pairedDepthsLocalStiffnessMatrices.push_back(std::make_pair(T, vector));
138 seconds = end_time2.tv_sec - begin_time.tv_sec;
139 microseconds = end_time2.tv_usec - begin_time.tv_usec;
140 double t = seconds + microseconds * 1e-6;
156 if(rank==0)cout <<
" number of depths " << j << endl;
Definition sparseGrid.h:277