Skip to content

Commit

Permalink
hack
Browse files Browse the repository at this point in the history
  • Loading branch information
bootandy committed Dec 12, 2023
1 parent 521d05f commit 3bee2a8
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fn init_color(no_color: bool) -> bool {
{
no_color
}
// #[cfg(target_pointer_width)]
}

fn get_height_of_terminal() -> usize {
Expand Down Expand Up @@ -180,26 +181,27 @@ fn main() {
println!("RAYON PRE:");
let stack_size = config.get_custom_stack_size(&options);

Check failure on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Style (ubuntu-latest)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check failure on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Style (macos-latest)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / MinSRV

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check failure on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Style (windows-latest)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-gnueabihf, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-gnueabihf, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / MinSRV

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-musleabi, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-musleabi, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check failure on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Style (ubuntu-latest)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-gnueabihf, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-gnueabihf, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-musleabi, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, arm-unknown-linux-musleabi, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check failure on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Style (macos-latest)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-gnu)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-gnu)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, i686-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-msvc)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-msvc)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-gnu)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-gnu)

unused variable: `stack_size`

Check failure on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Style (windows-latest)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-gnu, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-musl, use-cross)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-gnu)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-gnu)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-msvc)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, i686-pc-windows-msvc)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-gnu)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-gnu)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unused variable: `stack_size`

Check warning on line 182 in src/main.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unused variable: `stack_size`
let result = panic::catch_unwind(|| {
let x = match stack_size {
Some(n) => rayon::ThreadPoolBuilder::new().stack_size(n).build_global(),
None => {
let large_stack = usize::pow(1024, 3);
let mut s = System::new();
s.refresh_memory();
let available = s.available_memory();

if available > large_stack.try_into().unwrap() {
// Larger stack size to handle cases with lots of nested directories
rayon::ThreadPoolBuilder::new()
.stack_size(large_stack)
.build_global()
} else {
rayon::ThreadPoolBuilder::new().build_global()
}
}
};
// let x = match stack_size {
// Some(n) => rayon::ThreadPoolBuilder::new().stack_size(n).build_global(),
// None => {
// let large_stack = usize::pow(1024, 3);
// let mut s = System::new();
// s.refresh_memory();
// let available = s.available_memory();

// if available > large_stack.try_into().unwrap() {
// // Larger stack size to handle cases with lots of nested directories
// rayon::ThreadPoolBuilder::new()
// .stack_size(large_stack)
// .build_global()
// } else {
// rayon::ThreadPoolBuilder::new().build_global()
// }
// }
// };
let x = 3;
println!("RAYON INIT: {:?}", x);
x.is_err()
// x.is_err()
});
if result.is_err() {
eprintln!("Problem initializing rayon, try: export RAYON_NUM_THREADS=1")
Expand Down

0 comments on commit 3bee2a8

Please sign in to comment.