multithreading on one shared array
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have an array with 1xN elements, and I want to use 4 or more workers (cores) to work, in parallel, on this array. Each worker takes some elements from that array and manipulate them. For example, worker1 will take 3 elements, worker2 will take the next 2 and so on. These workers will work in parallel.
How can these workers be synchronized to work well? It seems like this would require a shared memory between multiple CPUs.
I need each worker read different size of data from that array at the same time: for example:
arr=1:100; % the common array
serv1 = 3; % random numbers
serv2 = 2; % random numbers
serv3 = 1; % random numbers
serv4 = 1; % random numbers I need at the same time worker1 read array(1:serv1), and worker 2 reads array(serv1+1:serv1+serv2) and worker3 reads array(serv1+serv2+1:serv1+serv2+serv3) and so on, and then manipulate the function on them
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!