Barrier synchronization replacements for OpenMP and MPI