필터 지우기
필터 지우기

Why comm.gpu.AWGNChannel is not faster than comm.AWGNChannel?

조회 수: 1 (최근 30일)
Bhavanithya Thiraviaraja
Bhavanithya Thiraviaraja 2018년 4월 12일
댓글: Bhavanithya Thiraviaraja 2018년 4월 20일
I am trying to understand GPU enabled communication System functions. In order to analyse it's processing speed, i wrote the below sample program,
M = 8;
modData = pskmod(randi([0 M-1],8192,1),M,pi/M);
tic;
% modData1 = gpuArray(modData);
gpuChannel = comm.gpu.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',15);
channelOutput = gpuChannel(modData);
toc
tic;
Channel = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',15);
channelOutput1 = Channel(modData);
toc;
tic;
channelOutput2 = add_awgn_noise(modData,15);
toc;
tic;
channelOutput3 = awgn(modData,15);
toc;
scatterplot(channelOutput);
scatterplot(channelOutput1);
scatterplot(channelOutput2);
scatterplot(channelOutput3);
The output of this matlab programm is,
>> gpu_awgnchannel
Elapsed time is 0.067871 seconds.
Elapsed time is 0.002515 seconds.
Elapsed time is 0.000550 seconds.
Elapsed time is 0.000703 seconds.
As can be seen, the processing time taken by the gpu System function is more than ten times the normal function. Why is this Happening even though the GPU device is selected? Is it even running on the GPU? Is there any particular Settings to run on the gpu?
MATLAB : 2017a
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 4월 17일
You should use timeit() and gputimeit() for accurate timing.
Bhavanithya Thiraviaraja
Bhavanithya Thiraviaraja 2018년 4월 20일

I changed the code to the following,

M = 8;
modData = zeros(8192,1,8);
SNR = randn(8,1);
for i=1:8
modData(:,:,i) = pskmod(randi([0 M-1],8192,1),M,pi/M);
end
channelop = awgntest(modData,SNR);
t = @() awgntest(modData,SNR);
gputimeit(t) % For GPU
timeit() % for functions other than GPU

Now the modData has 8 sets of PSK Modulated data. (3-D)

function awgntest() is,

function channelOutput = awgntest(modData,SNR)
for i=1:8
% channelOutput = awgn(modData(:,:,i),SNR(i));
% gpuChannel = comm.gpu.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',SNR(i));
% channelOutput = gpuChannel(modData(:,:,i));
Channel = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',SNR(i));
channelOutput = step(Channel,modData(:,:,i));
end
  • comm.AWGNChannel = 0.0086s
  • comm.gpuAWGNChannel = 0.4172s (First run); 0.4181 (Second run)
  • awgn function = 0.0027s

Still, the time taken for gpu AWGN channel is more than the others.

The main Problem is, I want to call this function from Simulink so I thought I will test for it performance from the MATLAB and then use this function in Simulink. But it seems it's not fast.

What do you think is the reason?

And also is it practical to use gpu functions if I want to Speed up the Simulation execution time of my Simulink model? If not other than this and parallel computing Toolbox, what other Options are there for using the GPU Cores for parallel processing.?

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by