CkIO: wrap write stripes around the set of PEs involved
authorPhil Miller <mille121@illinois.edu>
Sat, 20 Oct 2012 04:31:42 +0000 (23:31 -0500)
committerPhil Miller <mille121@illinois.edu>
Sat, 20 Oct 2012 04:33:41 +0000 (23:33 -0500)
src/libs/ck-libs/io/ckio.C

index 441c9e431c1b9d2ded1c6e6b26a9e81f69426518..f717d62a6e175bc5e31c06703e590c9634cb1b17 100644 (file)
@@ -17,9 +17,10 @@ namespace Ck { namespace IO {
     void Manager::write(Token token, const char *data, size_t bytes, size_t offset) {
       Options &opts = files[token].opts;
       do {
-       size_t stripe = offset / opts.peStripe;
-       int pe = opts.basePE + stripe * opts.skipPEs;
-       size_t bytesToSend = std::min(bytes, opts.peStripe - offset % opts.peStripe);
+        size_t stripeIndex = offset / opts.peStripe;
+        int peIndex = stripeIndex % opts.activePEs;
+        int pe = opts.basePE + peIndex * opts.skipPEs;
+        size_t bytesToSend = std::min(bytes, opts.peStripe - offset % opts.peStripe);
        thisProxy[pe].write_forwardData(token, data, bytesToSend, offset);
        data += bytesToSend;
        offset += bytesToSend;