easy-iso

Iso-surface extraction from volume data
git clone https://git.0xfab.ch/easy-iso.git
Log | Files | Refs | Submodules | README | LICENSE

commit bd3523e7ea4204278a69d2bea376074868e6f2da
parent 97a49114f5c8e123c6d9363e34379c21c1d83124
Author: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Date:   Thu,  1 Dec 2016 15:10:33 +0100

switched to memcpy for buffer fill in MPI I/O

Diffstat:
Msrc/IsoExtractorMPI.h | 29++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/IsoExtractorMPI.h b/src/IsoExtractorMPI.h @@ -7,6 +7,7 @@ #define ISOEXTRACTORMPI_H_XABTB0WN #include <mpi.h> +#include <cstring> #include "IsoExtractor.h" #include "InterpolatorMPI.h" @@ -191,12 +192,6 @@ private: unsigned long long mytri = tList.size(); MPI_Allgather(&mytri, 1, MPI_UNSIGNED_LONG_LONG, allsize.data(), 1, MPI_UNSIGNED_LONG_LONG, comm); - // if (0 == rank) - // { - // for (const auto v: allsize) - // std::cout << v << std::endl; - // } - long long offset = 0; MPI_File_get_position(file_id, &offset); @@ -208,17 +203,22 @@ private: if (allsize[rank] > 0) { tarr = new Triangle[allsize[rank]]; - // for (size_t i=0; i<allsize[rank]; ++i) - // memcpy(&tarr[0].vertices[0][0] + i*sizeof(Triangle), (char*)&tList[i].vertices[0][0], sizeof(Triangle)); + void* const base = &tarr[0].vertices[0][0]; for (size_t i=0; i<allsize[rank]; ++i) { - for (int j = 0; j < 3; ++j) - { - tarr[i].vertices[j][0] = tList[i].vertices[j][0]; - tarr[i].vertices[j][1] = tList[i].vertices[j][1]; - tarr[i].vertices[j][2] = tList[i].vertices[j][2]; - } + void* const dst = base + i*sizeof(Triangle); + const void* const src = &tList[i].vertices[0][0]; + memcpy(dst, src, sizeof(Triangle)); } + // for (size_t i=0; i<allsize[rank]; ++i) + // { + // for (int j = 0; j < 3; ++j) + // { + // tarr[i].vertices[j][0] = tList[i].vertices[j][0]; + // tarr[i].vertices[j][1] = tList[i].vertices[j][1]; + // tarr[i].vertices[j][2] = tList[i].vertices[j][2]; + // } + // } MPI_File_write_at(file_id, offset, (char *)&tarr[0].vertices[0][0], allsize[rank]*sizeof(Triangle), MPI_CHAR, &status); } @@ -250,7 +250,6 @@ private: MPI_File_write_at(file_id, offset, (char *)&tcarr[0].n, allsize[rank]*sizeof(TriangleConnect), MPI_CHAR, &status); } - MPI_Barrier(comm); if (tcarr != nullptr) delete [] tcarr;