I\'m working on a small Collatz conjecture calculator using C++ and GMP, and I\'m trying to implement parallelism on it using OpenMP, but I\'m coming across issues regarding thr
You might want to touch x only with atomic instructions.
x
#pragma omp atomic x++;
This ensures that all threads see the same value of x without requires mutexes or other synchronization techniques.