Questions tagged [barrier]

A barrier is a synchronization method for a group of threads or processes and means they must stop at this point and cannot proceed until all other threads/processes reach this barrier.

A barrier is a synchronization method for a group of threads or processes and means they must stop at this point and cannot proceed until all other threads/processes reach this barrier.

References

252 questions
0
votes
1 answer

Count down barrier

I am looking to find a count down barrier/sync in a Java concurrent world: I would like to have a class that let threads acquire() for overall n times and than barrier blocks for t seconds (sleep). After the delay/sleep the threads should be further…
Markus
  • 763
  • 7
  • 24
0
votes
2 answers

MPI barrier not blocking file write, flush and os.fsync

I have this test code which does the following: Write a test message to a file > Barrier > Read the test message > Assert equal > Repeat. from __future__ import print_function import os from mpi4py import MPI comm = MPI.COMM_WORLD rank =…
jadelord
  • 1,511
  • 14
  • 19
0
votes
2 answers

Barrier implementation for inter process in shared memory

I am looking for an inter-processes barrier implementation. Processes are in shared memory (ie. on the same ndoe). Processes are MPI ones. I do not want to use the MPI_Barrier function, because the general policy for all the MPI implementation is…
Jérôme
  • 2,640
  • 3
  • 26
  • 39
0
votes
1 answer

Implementation of thread barrier using condition variables causing weird behavior

I'm trying to implement a barrier system for threads using condition variables but there is a caveat where the first thread to arrive must write to a resource to share with the rest of the threads once the barrier fills. The problem is that when I…
0
votes
1 answer

simple barrier synchronisation in java

im trying to understand the barrier problem. im still really new to programming but was presented with this problem in class to solve. "I have to solve the barrier problem using counting semaphores. You can assume that there is a shared variable N…
0
votes
1 answer

Making a gather/barrier function with System V Semaphores

I'm trying to implement a gather function that waits for N processes to continue. struct sembuf operations[2]; operaciones[0].sem_num = 0; operaciones[0].sem_op = -1; // wait() or p() operaciones[1].sem_num = 0; operaciones[1].sem_op = 0; //…
0
votes
0 answers

Barriers in OpenCL

Each time I run this kernel, I get some different value. I want to sum up the res array after second loop computation (something like np.sum(res, axis = 0)). When I do np.sum outside the kernel I get the same value but inside the kernel it is not…
Akhil Jain
  • 89
  • 1
  • 6
0
votes
2 answers

Vulkan: vkCmdPipelineBarrier for data coherence

My question has 2 parts: What is the difference between memory being available / being visible? Im learning Vulkan from this tutorial (https://vulkan-tutorial.com) and currently sneaking around for a different approach to upload uniform data…
camelCase
  • 187
  • 1
  • 12
0
votes
0 answers

Finding the max of an array using threads and a barrier implemented through semaphores

I wrote the skeleton for implementing a C program that calculates the max of an array (w/ a size always a power of 2). It finds the max by creating n/2 threads that each calculate the max of 2 elements in their calcArray[2]. Next, those maxes will…
rsa
  • 69
  • 1
  • 1
  • 6
0
votes
2 answers

What is the name of this synchronisation method?

I have a special programming construct that allows threads to wait until another thread releases all waiting threads at once. Each thread can register itself to wait for an external event that can be triggered by another thread (for example one that…
Adrodoc
  • 673
  • 10
  • 19
0
votes
0 answers

MPI_Barrier with custom MPI Communicator

I am trying to set an MPI_Barrier for a subset of the processes in MPI_COMM_WORLD, as follows: //Get MPI rank MPI_Comm_rank(MPI_COMM_WORLD, ¤t_rank); //Get group of processes in MPI_COMM_WORLD MPI_Comm_group(MPI_COMM_WORLD,…
Gabyazz
  • 1
  • 4
0
votes
1 answer

Java CyclicBarrier

I have multiple threads that send the same packet and want all of them to finish before continuing to send the next packet. I tested out CyclicBarrier with the following code: Test Code (was too long/messy to embed) This worked as expected printing…
user3669539
  • 139
  • 1
  • 9
0
votes
0 answers

Can't understand barrier code

I ran across this barrier code and I cannot understand the barrierPost method. Im supposed to use this code to solve an exercise where two teams of threads race eachother to count to 10000. I don't understand why the same condition has different…
ggfpc
  • 86
  • 8
0
votes
0 answers

Why must use general barrier to guarantees transitivity of cpu?

I recently read transitivity of cpu in memory-barriers and the author emphasize only general barrier can guarantee transitivity. But, I can't understand it very well.For example: CPU 1 CPU 2 CPU…
user1310866
  • 13
  • 1
  • 3
0
votes
1 answer

Adding Dispatch Barriers (GCD) to Custom Queues But Not to The Global Concurrent queues

I read somewhere that dispatch barriers should be added to custom queue and not to the global queue. I am not getting the exact reason for that. Thanks.
Jush
  • 71
  • 3