SPMD Error detected on worker
Mostrar comentarios más antiguos
I am new to matlab, and I'm trying to learn how to use parallel processing.
I am trying to use SPMD, and have writen some simple code below:
clc;
close all;
clear variables;
arraySize = 10000000;
tArray = [1:arraySize];
tic;
spmd
startIndex = (labindex -1)/numlabs*arraySize+1;
endIndex = startIndex + arraySize/numlabs
for index = startIndex:endIndex
if tArray(index) > 50
tAray(index) = 50;
end
end
end
toc;
When I run this code, this is the output:
Starting parallel pool (parpool) using the 'local' profile ...
Connected to the parallel pool (number of workers: 6).
Lab 1:
endIndex =
1.6667e+06
Lab 4:
endIndex =
6.6667e+06
Lab 6:
endIndex =
10000001
Lab 2:
endIndex =
3.3333e+06
Lab 3:
endIndex =
5000001
Lab 5:
endIndex =
8.3333e+06
Error using spmd_test (line 9)
Error detected on worker 6.
Caused by:
Error using spmd_test (line 9)
Array indices must be positive integers or logical values.
The worker which causes the problem changes everytime I run the code.
If anyone has any idea what might be causeing this error, your help would be much appreciated
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Parallel Computing Fundamentals en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!