Simulates the heat equation, with constant heat capacity and thermal conductivity, using GPU (parallel computing toolbox) or CPU (matrix calculations). Includes results from Nvidia titan and i5-2500k @ 4.2 GHz. Any suggestions welcome on speeding up either.
Mark Ward (2020). GPU vs CPU speed test of finite difference equation (https://www.mathworks.com/matlabcentral/fileexchange/42779-gpu-vs-cpu-speed-test-of-finite-difference-equation), MATLAB Central File Exchange. Retrieved .
Probably it would be useful to say somewhere in the comments that the variable myPerf is reporting "speed", i.e. something proportional to the number of operations divided by the time.
But definitely useful. Thanks for posting the code!
GPU with the stencil method is definitely faster, by around 25x on an NVidia Titan compared with i7-3770 @ 3.4 GHz for single precision
Updated version uses less memeory and is faster, and has comments explaining how to run on the cpu or the gpu in two different ways. Some options have to be changed by editing the code, e.g. whether the calculations are single or double precision etc.
you applied different loops on GPU but
where is CPU processing part on these are codes.(I can't see!)
and from your results appear cpu faster than gpu! is it right or I misunderstood ??!
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!