필터 지우기
필터 지우기

GPU vs. CPU efficiency

조회 수: 5 (최근 30일)
Hossein
Hossein 2015년 2월 26일
답변: Matt J 2015년 2월 26일
I have a GPU on my computer that is "nvidia geforce gtx titan" (which is supposed to be powerful) but I'm not getting any improvements when I run the following code on GPU compared to CPU. It takes ~1.3 sec on both CPU and GPU to run. I was thinking maybe my Matlab does not recognize my GPU so I ran the "gpuDevice" command and it shows that it does recognize it. I was wondering if there is anything that I'm missing?
PS: My CPU is i5 3.2 GHz
clear; clc;
tic
A=gpuArray(rand(1000));
B=eig(A);
t1=toc
clear;
tic
A=rand(1000);
B=eig(A);
t2=toc

답변 (1개)

Matt J
Matt J 2015년 2월 26일
You should time just the eig() calculation. Creation of data and transfering it to the GPU, as in
A=gpuArray(rand(1000));
is always fraught with overhead. You should also use gputimeit instead of tic/toc. Finally, you should try with different/larger matrix sizes so that you know the GPU is doing a meaningful level of work.

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by