Skip to content

Index Producer (Parallelization); Lanes rename, More docs #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7e573a2
Fix warnings in tests for Zip
bluss Apr 6, 2017
153c666
ndproducer: Generalize Ptr and Offset
bluss Apr 6, 2017
2d2cb5c
indices: Implement an indices producer
bluss Apr 6, 2017
b38d673
indices: Test for index producer
bluss Apr 6, 2017
bc2f8e4
indices: Example for index + zip
bluss Apr 6, 2017
fbc9b7c
indices: benchmarks
bluss Apr 6, 2017
fe73cbb
Move iterators to the iter submodule
bluss Apr 6, 2017
a628373
Rename .whole_chunks() → .exact_chunks()
bluss Apr 6, 2017
dcda743
Update tests for whole chunks rename
bluss Apr 6, 2017
950f475
Move inners below genrows()
bluss Apr 6, 2017
d271b40
Update inners doc
bluss Apr 6, 2017
d080a58
fold while: Add .is_done()
bluss Apr 6, 2017
d5dcff3
Use is_done()
bluss Apr 6, 2017
5620afb
DOC: Doc for Indices
bluss Apr 6, 2017
3843940
Remove example file linalg.rs
bluss Apr 6, 2017
49b23f8
dimension: Add method .zero_index()
bluss Apr 6, 2017
0762259
Return Indices (NdProducer + IntoIterator) from indices/indices_of
bluss Apr 6, 2017
76573c3
Add test for indices_of + IxDyn
bluss Apr 6, 2017
a1b6298
Use indices function for zip
bluss Apr 6, 2017
a9ec2be
DOC: Update NdProducer
bluss Apr 6, 2017
ad6fd52
Align impl style across NdProducers
bluss Apr 6, 2017
d7f2032
Update to itertools 0.6.0
bluss Apr 6, 2017
8a70dc5
DOC: Update method links for moved iterators
bluss Apr 6, 2017
24541e1
Remove deprecated Axis::axis()
bluss Apr 6, 2017
e6092d8
Implement NdIndex<IxDyn> for &IxDyn
bluss Apr 6, 2017
6263582
Fixup indexing test to actually test what we were after
bluss Apr 6, 2017
ac4ec28
DOC: Fix code indent in Zip doc
bluss Apr 6, 2017
5bee21f
DOC: Change wording of indexed zip warning
bluss Apr 6, 2017
87514ec
Rename inners → lanes and so on
bluss Apr 6, 2017
92018db
DOC: Add section for iteration and looping
bluss Apr 6, 2017
d1f87cb
DOC: Update .lanes()
bluss Apr 6, 2017
8efffe4
parallel: Update for moved iterator structs
bluss Apr 6, 2017
ec8aaab
zip: Split by axis of len > 1, always
bluss Apr 6, 2017
5f70817
zip: Add test for index split
bluss Apr 6, 2017
b44020d
zip: Debug assertions in split
bluss Apr 6, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ version = "0.1.32"
default-features = false

[dependencies.itertools]
version = "0.5.0"
version = "0.6.0"

[dependencies.rustc-serialize]
version = "0.3.20"
Expand Down
91 changes: 87 additions & 4 deletions benches/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

extern crate test;
use test::Bencher;
use test::black_box;

#[macro_use(s, azip)]
extern crate ndarray;
Expand Down Expand Up @@ -205,6 +206,70 @@ fn vector_sum_3_zip_unchecked(bench: &mut Bencher)

// index iterator size
const ISZ: usize = 16;
const I2DSZ: usize = 64;

#[bench]
fn indexed_iter_1d_ix1(bench: &mut Bencher) {
let mut a = Array::<f64, _>::zeros(I2DSZ * I2DSZ);
for (i, elt) in a.indexed_iter_mut() {
*elt = i as _;
}

bench.iter(|| {
for (i, &_elt) in a.indexed_iter() {
//assert!(a[i] == elt);
black_box(i);
}
})
}

#[bench]
fn indexed_zip_1d_ix1(bench: &mut Bencher) {
let mut a = Array::<f64, _>::zeros(I2DSZ * I2DSZ);
for (i, elt) in a.indexed_iter_mut() {
*elt = i as _;
}

bench.iter(|| {
Zip::indexed(&a)
.apply(|i, &_elt| {
black_box(i);
//assert!(a[i] == elt);
});
})
}

#[bench]
fn indexed_iter_2d_ix2(bench: &mut Bencher) {
let mut a = Array::<f64, _>::zeros((I2DSZ, I2DSZ));
for ((i, j), elt) in a.indexed_iter_mut() {
*elt = (i + 100 * j) as _;
}

bench.iter(|| {
for (i, &_elt) in a.indexed_iter() {
//assert!(a[i] == elt);
black_box(i);
}
})
}
#[bench]
fn indexed_zip_2d_ix2(bench: &mut Bencher) {
let mut a = Array::<f64, _>::zeros((I2DSZ, I2DSZ));
for ((i, j), elt) in a.indexed_iter_mut() {
*elt = (i + 100 * j) as _;
}

bench.iter(|| {
Zip::indexed(&a)
.apply(|i, &_elt| {
black_box(i);
//assert!(a[i] == elt);
});
})
}



#[bench]
fn indexed_iter_3d_ix3(bench: &mut Bencher) {
Expand All @@ -214,12 +279,29 @@ fn indexed_iter_3d_ix3(bench: &mut Bencher) {
}

bench.iter(|| {
for (i, &elt) in a.indexed_iter() {
assert!(a[i] == elt);
for (i, &_elt) in a.indexed_iter() {
//assert!(a[i] == elt);
black_box(i);
}
})
}

#[bench]
fn indexed_zip_3d_ix3(bench: &mut Bencher) {
let mut a = Array::<f64, _>::zeros((ISZ, ISZ, ISZ));
for ((i, j, k), elt) in a.indexed_iter_mut() {
*elt = (i + 100 * j + 10000 * k) as _;
}

bench.iter(|| {
Zip::indexed(&a)
.apply(|i, &_elt| {
black_box(i);
//assert!(a[i] == elt);
});
})
}

#[bench]
fn indexed_iter_3d_dyn(bench: &mut Bencher) {
let mut a = Array::<f64, _>::zeros((ISZ, ISZ, ISZ));
Expand All @@ -229,8 +311,9 @@ fn indexed_iter_3d_dyn(bench: &mut Bencher) {
let a = a.into_shape(&[ISZ; 3][..]).unwrap();

bench.iter(|| {
for (i, &elt) in a.indexed_iter() {
assert!(a[i] == elt);
for (i, &_elt) in a.indexed_iter() {
//assert!(a[i] == elt);
black_box(i);
}
})
}
Loading