Skip to content
Snippets Groups Projects
Commit c9254edf authored by williamfgc's avatar williamfgc Committed by GitHub
Browse files

Merge pull request #223 from JasonRuonanWang/size_t

fixed a size_t / uint64_t problem for macOS 10.12 and Clang 8.1.0
parents 31b7b3cb e51ced3e
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,44 @@ ...@@ -15,6 +15,44 @@
#include "PrintData.h" #include "PrintData.h"
void printData(double *xy, size_t *size, size_t *offset, int rank, int steps)
{
std::ofstream myfile;
std::string filename = "data." + std::to_string(rank);
myfile.open(filename);
double *data = xy;
uint64_t nelems = size[0] * size[1];
for (int step = 0; step < steps; step++)
{
myfile << "rank=" << rank << " size=" << size[0] << "x" << size[1]
<< " offsets=" << offset[0] << ":" << offset[1]
<< " step=" << step << std::endl;
myfile << " time row columns " << offset[1] << "..."
<< offset[1] + size[1] - 1 << std::endl;
myfile << " ";
for (int j = 0; j < size[1]; j++)
{
myfile << std::setw(9) << offset[1] + j;
}
myfile << std::endl;
myfile << "------------------------------------------------------------"
"--\n";
for (int i = 0; i < size[0]; i++)
{
myfile << std::setw(5) << step << std::setw(5) << offset[0] + i;
for (int j = 0; j < size[1]; j++)
{
myfile << std::setw(9) << std::setprecision(2)
<< data[i * size[1] + j];
}
myfile << std::endl;
}
data += nelems;
}
myfile.close();
}
void printData(double *xy, uint64_t *size, uint64_t *offset, int rank, void printData(double *xy, uint64_t *size, uint64_t *offset, int rank,
int steps) int steps)
{ {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <cstdint> #include <cstdint>
void printData(double *xy, size_t *size, size_t *offset, int rank, int steps);
void printData(double *xy, uint64_t *size, uint64_t *offset, int rank, void printData(double *xy, uint64_t *size, uint64_t *offset, int rank,
int steps); int steps);
......
...@@ -93,8 +93,8 @@ int main(int argc, char *argv[]) ...@@ -93,8 +93,8 @@ int main(int argc, char *argv[])
} }
// 1D decomposition of the columns, which is inefficient for reading! // 1D decomposition of the columns, which is inefficient for reading!
std::vector<uint64_t> readsize({gndx, gndy / nproc}); adios2::Dims readsize({gndx, gndy / nproc});
std::vector<uint64_t> offset({0LL, rank * readsize[1]}); adios2::Dims offset({0LL, rank * readsize[1]});
if (rank == nproc - 1) if (rank == nproc - 1)
{ {
// last process should read all the rest of columns // last process should read all the rest of columns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment