Speeding up the computation
1 view (last 30 days)
Show older comments
Hi, I have run the following code, which takes ages to complete. Even when I use high performance computers, after several days, the computation has still not completed. Is there any way, I can speed up the computation? Maybe by writing it another way? The code is here:
max_wavelet_level = 8;
nn = 5;
for i = 1:length(Data)
i
patient = tensor{1,i};
for k = 1:size(patient,1)
for j = 1:size(patient,3)
WDEC{1,i}(k,:,:,j) = single(modwt(tensor{1,i}(k,:,j),max_wavelet_level,'db4'));
for l =1:max_wavelet_level+1
[imf,res] = emd(squeeze(WDEC{1,i}(k,l,:,j)),'Display',0);
pad_size = max(0,nn-size(imf,2));
pad = zeros(size(imf,1),pad_size);
padded_imf = cat(2,imf,pad);
EMD{1,i}(k,l,:,:,j) = single(padded_imf(:,1:nn));
end
end
end
end
I am running discrete wavelet transform on my signal. Subsequently, I run the EMD algorithm on the subsignals.
1 Comment
Answers (1)
Gaurav Garg
on 29 Jan 2020
Hi,
However, parfor can only be used when there aren’t any dependencies between different wokers/threads which seems to be true in your case. Moreover, parfor loops cannot be nested (parfor cannot be placed inside another parfor).
So, you can consider running parfor on either the first loop (parfor i = 1:length(Data)), or any other loop which should run fine too.
0 Comments
See Also
Categories
Find more on Continuous Wavelet Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!