128 printf(
"[%03d] Lower: %g\t%g\t%g\n", rank, verts[0], verts[1], verts[2]);
129 printf(
"[%03d] Upper: %g\t%g\t%g\n", rank, verts[3], verts[4], verts[5]);
141 int nranks = size[0] * size[1] * size[2];
143 MPI_Offset offset = (step * size[0] * size[1] * size[2] * 11 + rank * 11) *
sizeof(
double);
147 buf[0] = (double)rank;
149 buf[2] = vertices.at(0)[0];
150 buf[3] = vertices.at(0)[1];
151 buf[4] = vertices.at(0)[2];
152 buf[5] = vertices.at(1)[0];
153 buf[6] = vertices.at(1)[1];
154 buf[7] = vertices.at(1)[2];
155 buf[8] = (double)(loc[0]);
156 buf[9] = (double)(loc[1]);
157 buf[10] = (double)(loc[2]);
160 MPI_File_write_at(fh, offset, buf, 11, MPI_DOUBLE, &state);
175 MPI_Init(&argc, &argv);
177 const int NumberOfSteps = 50;
180 std::string outputDir;
183 outputDir.assign(argv[1]);
186 outputDir.assign(
".");
188 const int Dimensions = 3;
189 const int LoadbalancerGamma = 0;
195 int MyLocation[3] = {0};
197 MPI_Comm_rank(MPI_COMM_WORLD, &MyLocation[2]);
198 int MyRank = MyLocation[2];
200 int NumberOfProcesses[3] = {1, 1, 1};
201 MPI_Comm_size(MPI_COMM_WORLD, &NumberOfProcesses[2]);
202 int MaximumRank = NumberOfProcesses[2];
204 std::stringstream ss;
205 ss << outputDir <<
"/" <<
"ALL_Staggered_" << NumberOfProcesses[2] <<
".bin";
206 std::string file = ss.str();
208 MPI_File_delete(file.c_str(), MPI_INFO_NULL);
209 MPI_File_open(MPI_COMM_WORLD, file.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh);
210 MPI_File_set_size(fh, NumberOfSteps * NumberOfProcesses[2] * 11 *
sizeof(MPI_DOUBLE));
211 MPI_File_preallocate(fh, NumberOfSteps * NumberOfProcesses[2] * 11 *
sizeof(MPI_DOUBLE));
215 printf(
"Ranks: %d\nNumber of Steps: %d\n", MaximumRank, NumberOfSteps);
218 MPI_Barrier(MPI_COMM_WORLD);
223 std::vector<int> MyLocationVector(MyLocation, MyLocation + 3);
224 std::vector<int> NumberOfProcessesVector(NumberOfProcesses, NumberOfProcesses + 3);
228 std::vector<double> MinimumDomainSize{0.1, 0.1, 0.1};
248 const double DomainSize = 1.0;
250 for (
int VertexIndex = 0; VertexIndex < 2; VertexIndex++)
252 for (
int DimensionIndex = 0; DimensionIndex < Dimensions; DimensionIndex++)
254 DomainVertices.at(VertexIndex)[DimensionIndex] = (MyLocation[DimensionIndex] + VertexIndex) * DomainSize;
257 double VertexArray[6];
263 double MyWork = (double)MyRank + 1.;
266 for (CurrentStep = 0; CurrentStep < NumberOfSteps; CurrentStep++)
272 printf(
"Starting step: %d/%d\n", CurrentStep + 1, NumberOfSteps);
275#ifdef ALL_VTK_OUTPUT_EXAMPLE
282 std::cout << e.
what() << std::endl;
290 std::vector<ALL::Point<double>> NewVertices = jall->
getVertices();
293 print_binary(CurrentStep, MyRank, MyWork, NewVertices, MyLocation, NumberOfProcesses, fh);
302#ifdef ALL_VTK_OUTPUT_EXAMPLE
309 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)