This doesn’t appear optimal. The correct way to melt a CPU is to make use of as many functional units as possible in parallel, while avoiding pipeline stalls and cache misses. I’m not a Rust guy, but skimming through the code it seems like the only work it’s doing is some integer math, so it’s not even touching the FPUs. Also I see
while running.load(Ordering::SeqCst). Idk if Rust’s memory model is similar to C++, but does that mean it’s using atomic operations? That’s going to create a lot of unnecessary cache coherency traffic that works against the goal of melting. Each thread should have its own counter not shared with other threads, and it should only spawn enough threads for the number of physical cores (not logical cores) on the system, and ideally pin each thread to a single core to prevent the OS from acting like a firefighter.The gpu parts I’m not sure about. There’s might be some special consideration required when dealing with integrated graphics though.
Yeah, Rust borrows memory model from C++ because it’s already in use and is at least somewhat understandable
Any embarrassingly parallel program can max out your CPU. You should probably run some useful problem instead.
Protein folding for example
At least use a SIMD load, and maybe someone would find it cool-adjacent.
deleted by creator
deleted by creator


