make cwt function faster
显示 更早的评论
Hi everyone!
I have a code where I loop the cwt function for about 1000 times (Because I have 1000 trials of recordings). Every time I run the code, it takes approximately 150s for the code to execute. Also, each cwt takes about 0.02s to run. I tried to make it run faster by generating a CUDA GPU code from cwt but it actually made it slower. Each CUDA cwt takes about 0.04s to run. Is it reasonable? or I am doing something wrong? Also, do you have any ideas how I can make it faster? like some parallel processing using GPU..
Here is how the code looks like:
for i = 1:1000
tic
[wavelet_signal_temp,f] = cwt(signal(i,:),'amor',fs);
toc
end
3 个评论
Your benchmark doesn't make much sense, since 0.02 s and 0.04 s are too small that can be compared to each other. To better benchmark GPU/CPU, run your scripts using timeit instead, or at least place tic/toc out of the loop.
You can also use parfor loop even with GPU, but whether it throws an out of memory error or not depends on your GPU memory (and of course other nuances).
Also, this may prove useful as well: https://mathworks.com/help/wavelet/ug/cuda-code-from-cwt.html
Ali Ghavam
2021-12-23
Raymond Norris
2021-12-23
parfor would hep if you had multiple GPUs.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!