Comments (8)
I've been working with @abhi-rao on this. I think it's nearly ready, but we need to choose a name that works for everybody. It is currently named iter roundRobinBasedChunkOfBlocks(r: range, blockSize, idx, numChunks)
in PR #5928.
from chapel.
Maybe: blockCyclicChunks(r: range, blockSize, idx, numInds)
Some possible names for the last two arguments:
(tid, numTasks) // The names from the first comment in this issue
(rank, numRanks)
(idx, numInds)
from chapel.
Even though it takes a second for me to get what is meant by idx
, (idx, numInds)
fits best with the rest of the library so I support that choice.
from chapel.
Here's something I whipped up quickly (would be written properly later) if this is still not implemented (it looks like it hasn't been in RangeChunk.chpl). Ignore the mix of snake and camel case
--EDIT--
There was an off by one bug
iter rr(r, blockSize, idx, numInds){
var range_stride = r.stride;
var block_stride = blockSize * range_stride;
var low = r.low;
var high = r.high;
var first_block_start = (if range_stride > 0 then r.low else r.high) + block_stride * idx;
if first_block_start > r.high || first_block_start < r.low then return;
var stride_to_next_block = block_stride * numInds;
if range_stride > 0 {
for block_start in first_block_start..high by stride_to_next_block {
var block_end = min(high, block_start + block_stride - 1);
yield block_start..block_end by range_stride;
}
}else{
for block_end in low..first_block_start by stride_to_next_block {
var block_start = max(low, block_end + block_stride + 1);
yield block_start..block_end by abs(range_stride);
}
}
}
writeln("1: ", rr(1..100, 3, 3, 5));
writeln("2: ", rr(-7..25, 3, 3, 5));
writeln("3: ", rr(25..50, 3, 3, 5));
writeln("4: ", rr(0..99 by 2, 3, 3, 5));
writeln("5: ", rr(1..100 by 3, 3, 3, 5));
writeln("6: ", rr(3..30 by -2, 3, 3, 5));
writeln("7: ", rr(0..1 by -1, 1, 0, 2));
Outputs
1: 10..12 25..27 40..42 55..57 70..72 85..87 100..100
2: 2..4 17..19
3: 34..36 49..50
4: 18..23 by 2 48..53 by 2 78..83 by 2
5: 28..36 by 3 73..81 by 3
6: 7..12 by 2
7: 1..1
from chapel.
@daviditen should I open a new PR since the old one has been stagnant for a while?
from chapel.
@rahulghangas Yes, sounds good. Thanks!
from chapel.
Did #15109 fully implement the request here?
from chapel.
Yes, I think so. Thanks!
from chapel.
Related Issues (20)
- [Feature Request]: required named-base argument passing HOT 2
- [Feature Request]: FormattedIO: support for formatted arrays of numbers HOT 2
- [Feature Request]: CLS: provide auto-complete suggestions for methods on types
- [Feature Request]: improve UnusedLoopIndex chplcheck warning HOT 2
- [Bug]: CLS segfaults on `modules/packages/BLAS.chpl` HOT 3
- Prevent chplcheck fixits from being misapplied
- dyno: should `nil` and `none` have their own AST nodes?
- dyno: calls to initializers from other initializers aren't reflected.
- [Bug]: Editing a standard module causes Dyno to crash
- Review the Sort module API
- [Feature Request]: chplcheck: comments to silence a warning per-file HOT 3
- Should we always unroll (inner) `foreach` loops by 2–4? HOT 7
- [Feature Request]: expand MisleadingIndentation lint rule
- [Feature Request]: lint rule for ThenKeywordAndBlock
- Known (likely) issue with LAPACK module formal constness
- chapel-py: Add a `CHPL_` variable to auto-build `chapel-py`
- [Bug]: Restore ability to export functions with arrays of C-style strings to Python HOT 1
- [Feature Request]: Export functions with arrays of strings as arguments for Python interoperability HOT 1
- [Bug]: having a ref hash function causes an extra, unsilenceable warning
- [Bug]: throwing hash functions generate an unavoidable error in error handling relaxed mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chapel.