- for (i = 0; i < NUM_ITER; i++) {
- /* Combining trylock and lock here is helpful for testing because it makes
- * CAS and Fetch-and-op contend for the tail pointer. */
- if (rank % 2) {
- int success = 0;
- while (!success) {
- MCS_Mutex_trylock(mcs_mtx, &success);
- }
- }
- else {
- MCS_Mutex_lock(mcs_mtx);
+ for (i = 0; i < NUM_ITER; i++) {
+ /* Combining trylock and lock here is helpful for testing because it makes
+ * CAS and Fetch-and-op contend for the tail pointer. */
+#ifdef USE_CONTIGUOUS_RANK
+ if (rank < nproc / 2) {
+#else
+ if (rank % 2) {
+#endif
+ int success = 0;
+ while (!success) {
+ MCS_Mutex_trylock(mcs_mtx, &success);
+ }
+ }
+ else {
+ MCS_Mutex_lock(mcs_mtx);
+ }
+ MCS_Mutex_unlock(mcs_mtx);