mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Join all threads before returning from the test case, to ensure that we don't return from `main` until all open `Device`s have been dropped. This avoids a race condition in glibc in which a thread calling `dlclose` can unmap a shared library's code even while the main thread is still running its finalization functions. (See #5084 for details.) Joining all threads before returning from the test ensures that the Vulkan loader has finished `dlclose`-ing the Vulkan validation layer shared library before `main` returns. Remove `skip` for this test on GL/llvmpipe. With this change, that has not been observed to crash. Without it, the test crashes within ten runs or so. Fixes #5084. Fixed #4285.
hello-compute
Runs a compute shader to determine the number of iterations of the rules from Collatz Conjecture
- If n is even, n = n/2
- If n is odd, n = 3n+1
that it will take to finish and reach the number 1.
To Run
# Pass in any 4 numbers as arguments
RUST_LOG=hello_compute cargo run --bin wgpu-examples hello_compute 1 4 3 295
Example Output
[2020-04-25T11:15:33Z INFO hello_compute] Steps: [0, 2, 7, 55]