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

Ive J
Ive J 2021년 12월 23일
편집: Ive J 2021년 12월 23일
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
Ali Ghavam 2021년 12월 23일
Hey‌ Ive,
Actually I have put a tic/toc out of my loop and that was how I realized the difference in the first place. But I have not tried timeit and parfor yet! Thank you for the suggestion!
Also about the link, I exactly used the instructions in this link to generate my GPU MEX code.
Raymond Norris
Raymond Norris 2021년 12월 23일
parfor would hep if you had multiple GPUs.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2021년 12월 23일

댓글:

2021년 12월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by