123 printf(
"[%03d] Lower: %g\t%g\t%g\n", rank, verts[0], verts[1], verts[2]);
124 printf(
"[%03d] Upper: %g\t%g\t%g\n", rank, verts[3], verts[4], verts[5]);
136 int nranks = size[0] * size[1] * size[2];
138 MPI_Offset offset = (step * size[0] * size[1] * size[2] * 11 + rank * 11) *
sizeof(
double);
142 buf[0] = (double)rank;
144 buf[2] = vertices.at(0)[0];
145 buf[3] = vertices.at(0)[1];
146 buf[4] = vertices.at(0)[2];
147 buf[5] = vertices.at(1)[0];
148 buf[6] = vertices.at(1)[1];
149 buf[7] = vertices.at(1)[2];
150 buf[8] = (double)(loc[0]);
151 buf[9] = (double)(loc[1]);
152 buf[10] = (double)(loc[2]);
155 MPI_File_write_at(fh, offset, buf, 11, MPI_DOUBLE, &state);
170 MPI_Init(&argc, &argv);
172 const int NumberOfSteps = 50;
175 std::string outputDir;
178 outputDir.assign(argv[1]);
181 outputDir.assign(
".");
183 const int Dimensions = 3;
184 const int LoadbalancerGamma = 0;
187 int MyLocation[3] = {0};
189 MPI_Comm_rank(MPI_COMM_WORLD, &MyLocation[2]);
190 int MyRank = MyLocation[2];
192 int NumberOfProcesses[3] = {1, 1, 1};
193 MPI_Comm_size(MPI_COMM_WORLD, &NumberOfProcesses[2]);
194 int MaximumRank = NumberOfProcesses[2];
196 std::stringstream ss;
197 ss << outputDir <<
"/" <<
"ALL_Tensor_" << NumberOfProcesses[2] <<
".bin";
198 std::string file = ss.str();
200 MPI_File_delete(file.c_str(), MPI_INFO_NULL);
201 MPI_File_open(MPI_COMM_WORLD, file.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh);
202 MPI_File_set_size(fh, NumberOfSteps * NumberOfProcesses[2] * 11 *
sizeof(MPI_DOUBLE));
203 MPI_File_preallocate(fh, NumberOfSteps * NumberOfProcesses[2] * 11 *
sizeof(MPI_DOUBLE));
207 printf(
"Ranks: %d\nNumber of Steps: %d\n", MaximumRank, NumberOfSteps);
210 MPI_Barrier(MPI_COMM_WORLD);
215 std::vector<int> MyLocationVector(MyLocation, MyLocation + 3);
216 std::vector<int> NumberOfProcessesVector(NumberOfProcesses, NumberOfProcesses + 3);
220 std::vector<double> MinimumDomainSize{0.1, 0.1, 0.1};
240 const double DomainSize = 1.0;
242 for (
int VertexIndex = 0; VertexIndex < 2; VertexIndex++)
244 for (
int DimensionIndex = 0; DimensionIndex < Dimensions; DimensionIndex++)
246 DomainVertices.at(VertexIndex)[DimensionIndex] = (MyLocation[DimensionIndex] + VertexIndex) * DomainSize;
249 double VertexArray[6];
255 double MyWork = (double)MyRank + 1.;
258 for (CurrentStep = 0; CurrentStep < NumberOfSteps; CurrentStep++)
264 printf(
"Starting step: %d/%d\n", CurrentStep + 1, NumberOfSteps);
267#ifdef ALL_VTK_OUTPUT_EXAMPLE
274 std::cout << e.
what() << std::endl;
282 std::vector<ALL::Point<double>> NewVertices = jall->
getVertices();
285 print_binary(CurrentStep, MyRank, MyWork, NewVertices, MyLocation, NumberOfProcesses, fh);
294#ifdef ALL_VTK_OUTPUT_EXAMPLE
301 std::cout << e.
what() << std::endl;
void print_binary(int step, int rank, double work, std::vector< ALL::Point< double > > &vertices, int *loc, int *size, MPI_File fh)