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

1 view (last 30 days)
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 Comments
Walter Roberson
Walter Roberson on 17 Apr 2018
You should use timeit() and gputimeit() for accurate timing.
Bhavanithya Thiraviaraja
Bhavanithya Thiraviaraja on 20 Apr 2018

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.?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!