Skip to content
Snippets Groups Projects
Commit bbdd0841 authored by Ruonan Wang's avatar Ruonan Wang
Browse files

changed printData signature to using size_t in heatRead example

parent b9e7cd4d
No related branches found
No related tags found
1 merge request!223fixed a size_t / uint64_t problem for macOS 10.12 and Clang 8.1.0
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
#include "PrintData.h" #include "PrintData.h"
void printData(double *xy, uint64_t *size, uint64_t *offset, int rank, void printData(double *xy, size_t *size, size_t *offset, int rank, int steps)
int steps)
{ {
std::ofstream myfile; std::ofstream myfile;
std::string filename = "data." + std::to_string(rank); std::string filename = "data." + std::to_string(rank);
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <cstdint> #include <cstdint>
void printData(double *xy, uint64_t *size, uint64_t *offset, int rank, void printData(double *xy, size_t *size, size_t *offset, int rank, int steps);
int steps);
#endif /* PRINTDATA_H_ */ #endif /* PRINTDATA_H_ */
...@@ -69,6 +69,8 @@ int main(int argc, char *argv[]) ...@@ -69,6 +69,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!
uint64_t readsize[2] = {gndx, gndy / nproc}; uint64_t readsize[2] = {gndx, gndy / nproc};
uint64_t offset[2] = {0LL, rank * readsize[1]}; uint64_t offset[2] = {0LL, rank * readsize[1]};
size_t readsize_size_t[2] = {gndx, gndy / nproc};
size_t offset_size_t[2] = {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
...@@ -90,7 +92,7 @@ int main(int argc, char *argv[]) ...@@ -90,7 +92,7 @@ int main(int argc, char *argv[])
adios_schedule_read(f, sel, "T", 0, vT->nsteps, T); adios_schedule_read(f, sel, "T", 0, vT->nsteps, T);
adios_perform_reads(f, 1); adios_perform_reads(f, 1);
printData(T, readsize, offset, rank, vT->nsteps); printData(T, readsize_size_t, offset_size_t, rank, vT->nsteps);
adios_read_close(f); adios_read_close(f);
adios_free_varinfo(vT); adios_free_varinfo(vT);
delete[] T; delete[] T;
......
...@@ -93,10 +93,8 @@ int main(int argc, char *argv[]) ...@@ -93,10 +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]});
adios2::Dims readsize_size_t({gndx, gndy / nproc});
adios2::Dims offset_size_t({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
...@@ -111,7 +109,7 @@ int main(int argc, char *argv[]) ...@@ -111,7 +109,7 @@ int main(int argc, char *argv[])
double *T = new double[vT->m_AvailableSteps * readsize[0] * readsize[1]]; double *T = new double[vT->m_AvailableSteps * readsize[0] * readsize[1]];
// Create a 2D selection for the subset // Create a 2D selection for the subset
vT->SetSelection(offset_size_t, readsize_size_t); vT->SetSelection(offset, readsize);
vT->SetStepSelection(0, vT->m_AvailableSteps); vT->SetStepSelection(0, vT->m_AvailableSteps);
// Arrays are read by scheduling one or more of them // Arrays are read by scheduling one or more of them
......
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