rayon Questions

2

Solved

I have multiple threads doing a computation and want to collect the results into a pre-allocated vector. To turn off the borrow checker, I wrote the function: fn set_unsync(vec: &Vec<usize&g...
Negro asked 10/10, 2022 at 20:33

6

Solved

Context I have a case where multiple threads must update objects stored in a shared vector. However, the vector is very large, and the number of elements to update is relatively small. Problem I...
Danidania asked 1/5, 2019 at 16:40

1

Solved

So, I've been running out of memory with wasm/rust with +atomic flag and wanted to check how much memory is practically available. Here is my crude minimal working example that logs the memory of a...
Heartsick asked 22/5, 2022 at 5:23

2

Solved

I would like to create a large Polars DataFrame using Rust, building it up row by row using data scraped from web pages. What is an efficient way to do this? It looks like the DataFrame should be c...
Quartziferous asked 23/3, 2022 at 13:57

2

I'm using the Rayon library: extern crate rayon; const N: usize = 1_000_000_000; const W: f64 = 1f64/(N as f64); fn f(x: f64) -> f64 { 4.0/(1.0+x*x) } fn main() { use rayon::prelude::*; l...
Callicrates asked 6/12, 2019 at 0:27

1

Solved

It's a common trick to annotate your functions with returning Result<X, Box<dyn Error>> to allow them to return any error at all. However, you can't return this from a thread without th...
Ratel asked 22/8, 2021 at 15:10

2

Solved

I'm trying to get a simple timer set up in rust that returns true at a certain frequency. #[derive(Clone, Debug)] pub struct IntervalTimer { pub period: Duration, pub delta: Instant, } impl Inte...
Noetic asked 1/10, 2020 at 16:40

1

Solved

I can iterate and process both index and the variable within such as: let x = vec![5, 6, 7, 8]; for (index, val) in x.iter().enumerate() { println!("{} {}", val, index); } Now with ray...
Invitatory asked 10/1, 2021 at 17:32

2

Solved

I am trying to optimize my function using Rayon's par_iter(). The single threaded version is something like: fn verify_and_store(store: &mut Store, txs: Vec<Tx>) { let result = txs.it...
Cabalist asked 7/3, 2017 at 12:7

2

I turn a regex into a HashSet after doing some filtering. I am trying to use it with Rayon, but I can't figure out how to make Rayon work with an existing iterator without converting it to a vector...
Hydrargyrum asked 22/2, 2018 at 8:10

1

Solved

Rayon looks great for algorithm parallelization of collections, and Faster is great for vectorization (SIMD) on the x86 platform for collections like Vec<f32>. I've tried to combine them and ...
Snips asked 9/7, 2018 at 20:1

1

I am using Rayon to produce reasonably large return values. This uses a lot of memory when collecting all returned values into a Vec. Is there a way to avoid creating a Vec and directly consuming a...
Bonaire asked 22/7, 2018 at 13:11

2

Solved

I was hoping to replace an iter() with Rayon's par_iter() in a rather simple case like this, but I am failing to do so. The previous code: indexes_to_increment .iter() .for_each(|x| self.some_d...
Psychoanalysis asked 25/10, 2017 at 23:43

1

Solved

I'm attempting to parallelise the Ramer–Douglas-Peucker line simplification algorithm by using Rayon's par_iter instead of iter: extern crate num_traits; use num_traits::{Float, ToPrimitive}; exte...
Inadequate asked 10/3, 2017 at 15:1

1

Solved

This is a contrived example but I believe if I can get this working I can apply it to my specific case. extern crate num; extern crate rayon; use rayon::prelude::*; use num::Float; fn sqrts<T:...
Heatherheatherly asked 10/1, 2017 at 19:3

2

Solved

I have a struct which implements Iterator and it works fine as an iterator. It produces values, and using .map(), I download each item from a local HTTP server and save the results. I now want to p...
Corpse asked 8/3, 2016 at 9:48
1

© 2022 - 2025 — McMap. All rights reserved.