-/* Copyright (c) 2010-2021. The SimGrid Team.
+/* Copyright (c) 2010-2022. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
int get_position_shared(MPI_Offset* offset) const;
int flags() const;
MPI_Comm comm() const;
+ std::string name() const override {return file_ ? std::string("MPI_File: ")+ std::string(file_->get_path()): std::string("MPI_File");}
+
int sync();
int seek(MPI_Offset offset, int whence);
int seek_shared(MPI_Offset offset, int whence);
chunks.push_back(ranges[0]);
unsigned int nchunks = 0;
- unsigned int i = 1;
- while (i < ranges.size()) {
+ for (unsigned i = 1; i < ranges.size(); i++) {
if (ranges[i].second > chunks[nchunks].second) {
// else range included - ignore
if (ranges[i].first > chunks[nchunks].second) {
chunks[nchunks].second = ranges[i].second;
}
}
- i++;
}
// what do I need to read ?
MPI_Offset totreads = 0;
- for (i = 0; i < chunks.size(); i++) {
- if (chunks[i].second < my_chunk_start)
+ for (auto const& chunk : chunks) {
+ if (chunk.second < my_chunk_start)
continue;
- else if (chunks[i].first > my_chunk_end)
+ else if (chunk.first > my_chunk_end)
continue;
else
- totreads += (std::min(chunks[i].second, my_chunk_end - 1) - std::max(chunks[i].first, my_chunk_start));
+ totreads += (std::min(chunk.second, my_chunk_end - 1) - std::max(chunk.first, my_chunk_start));
}
XBT_CDEBUG(smpi_pmpi, "will have to access %lld from my chunk", totreads);