Main Content

DVB-S.2 System Simulation Using a GPU-Based LDPC Decoder System Object

这穰mple shows how to use a GPU-based LDPC Decoder System object™ to increase the speed of a communications system simulation. The performance improvement is illustrated by modeling part of the ETSI (European Telecommunications Standards Institute) EN 302 307 standard for Broadcasting, Interactive Services, News Gathering and other broadband satellite applications (DVB-S.2) [1]. For further information on using System objects to simulate the DVB-S.2 system seeDVB-S.2 Link, Including LDPC Coding in Simulink. You must have a Parallel Computing Toolbox™ user license to use the GPU-based LDPC Decoder.

介绍

The LDPC Decoding algorithm is computationally expensive and constitutes the vast majority of the time spent in a DVB-S.2 simulation. Using the comm.gpu.LDPCDecoder System object to execute the decoding algorithm on a GPU dramatically improves simulation run time. The example simulates the DVB-S.2 system, obtaining a benchmark for speed (run time), once with a CPU-based LDPC decoder function (ldpcDecode) and once with a GPU-based LDPC Decoder (comm.gpu.LDPCDecoder)。该示例捕获了这两个版本的位错误率,以表明使用GPU解码性能没有损失。

fprintf(...'dvb-s.2数字视频广播标准位错误率模拟\ n \ n');
DVB-S.2 Digital Video Broadcast Standard Bit Error Rate Simulation
fprintf(...'Performance comparison of CPU- and GPU- accelerated decoders.\n');
Performance comparison of CPU- and GPU- accelerated decoders.

GPU Presence Detection

The example attempts to query the GPU to detect a Parallel Computing Toolbox user license and the presence of a supported GPU. If the GPU or the Parallel Computing Toolbox is unavailable, a CPU-only simulation can be performed.

尝试% Query the GPUdev = parallel.gpu.GPUDevice.current;% Print out information about the GPU that was foundfprintf(...'GPU detected (%s, %d multiprocessors, Compute Capability %s)\n',...dev.name,dev.multiprocessorcount,dev.computeCapability);%包括基于GPU的模拟。doGPU = true;catch%#ok % The GPU is not supported or not present, or the Parallel Computing%Toolbox was not present and licensed. Consider a CPU-only simulation.inp =输入(['***注意:未检测到GPU。',...'Continue with CPU-only simulation? [Y]/N '],'s');ifstrcmpi(inp,'y') || isempty(inp) doGPU = false;elsereturn;endend
GPU detected (Tesla V100-PCIE-32GB, 80 multiprocessors, Compute Capability 7.0)

Initialization

ThegetParamsDVBS2Demo.mfunction generates a structure, dvb, which holds the configuration information for the DVB-S.2 system given the parameters below. Subsequently, the example includes creating and configuring System objects, based on the dvb structure.

ThecreateSimObjDVBS2Demo.mscript constructs most of the System objects used in DVB-S.2 and configures them based on the dvb structure.

Then an LDPC decoder configuration object and a GPU-based LDPC Decoder System object are created. The LDPC decoder configuration object is passed to the CPU-basedldpcDecodefunction which uses options equivalent to those used by the GPU-based LDPC Decoder System object.

% DVB-S.2 System ParameterssubsystemType ='qpsk 1/2';% Constellation and LDPC code rateEsNodB = 0.75;每个符号与噪声PSD比率的能量百分比DBnumFrames = 10;% Number of frames to simulatemaxNumLDPCIterations = 50;% LDPC Decoder iterationsdvb = getParamsDVBS2Demo(subsystemType,EsNodB,maxNumLDPCIterations);%创建和配置BCH编码器和解码器,调制器,解调器,% AWGN Channel.createSimObjDVBS2Demo;% Construct an LDPC Encoder configuration objectencoderCfg = ldpcEncoderConfig(dvb.LDPCParityCheckMatrix);% LDPC Decoder ConfigurationldpcPropertyValuePairs = {...'MaximumIterationCount',dvb.LDPCNumIterations,...'ParityCheckMatrix',dvb.LDPCParityCheckMatrix,...'DecisionMethod','Hard Decision',...'IterationTerminationCondition','Maximum iteration count',...“阿utputValue','Information part'};%构建LDPC解码器配置对象decoderCfg = ldpcDecoderConfig(dvb.LDPCParityCheckMatrix);ifdoGPU% Construct a GPU-based LDPC Decoder System objectgpuldpcdecoder = comm.gpu.ldpcdecoder(ldpcpropertyvaluepairs {:});end% Create an ErrorRate object to analyze the differences in bit error rate% between the CPU and GPU.BER = comm.ErrorRate;

CPU and GPU Performance Comparison

此示例首先使用基于CPU的LDPC解码器函数,然后将基于GPU的LDPC解码器系统对象模拟DVB-S.2系统。该示例通过通过系统传递几个数据帧并测量总系统仿真时间来获得每个LDPC解码器的系统基准。第一帧数据产生了大型仿真初始化时间,因此,从基准计算中排除了它。每个框架和平均系统仿真时间被打印到命令窗口。系统的位错误率(BER)也被打印到命令窗口,以说明基于CPU和基于GPU的LDPC解码器都达到了相同的BER。

ifdoGPU architectures = 2;elsearchitectures = 1;end% Initialize run time results vectorsruntime = zeros(architectures,numFrames); avgtime = zeros(1,architectures);%种子用于通道和消息的随机数发生器%创建。这将允许在CPU和GPU之间进行公平的比较。% Cache the original random stream to restore later.Original_rs = RandStream.getGlobalStream;rs = randstream.create('mrg32k3a','seed',25); RandStream.setGlobalStream(rs);% Loop for each processing unit - CPU and GPUforii = 1:architectures%为执行循环做一些初始设置if(ii == 1) arch =“CPU”;% Use CPU LDPC Decoderelsearch ='GPU'; decoder = gpuLDPCDecoder;%使用GPU LDPC译码器end% Reset the Error Rate objectreset(BER);% Reset the random streamreset(rs);% Notice to the user that DVB-S.2 simulation is beginning.fprintf(['\nUsing 'arch'-based LDPC Decoder:\n']); dels = repmat('\ b',1,fprintf('Initializing ...'));%主仿真循环。运行numframes+1次,忽略第一个% frame (which has initialization overhead) for the run time% calculation. Use the first run for the BER calculation.forrr = 1:(numFrames+1)% Start timerts = tic;% ***Create an input Message*** %msg = zeros(encbch.MessageLength, 1); msg(1:dvb.NumInfoBitsPerCodeword) =...logical(randi([0 1],dvb.NumInfoBitsPerCodeword,1));% ***Transmit*** %bchencout = encbch(msg);ldpcencout = ldpcencode(bchencout,encoderCfg);xlvRout = intrlv(ldpcencout,dvb.interleaveorder);modout = pskmodulator(xlvrout);% ***Corrupt with noise*** %chanOut = chan(modOut);% ***Receive*** %ydemodOut = pskDemodulator(chanOut); dexlvrOut = deintrlv(demodOut,dvb.InterleaveOrder);% Use the appropriate LDPC Decoder.ifstrcmp(arch,“CPU”)ldpcdecout =逻辑(ldpcdecode(dexlvRout,dixodercfg,dvb.ldpcnumiterations,'DecisionType','hard','终止','最大限度',“阿utputFormat','信息'));elseldpcdecout =解码器(dexlvRout);endbchdecOut = decbch(ldpcdecOut);% ***Compute BER *** % Calculate BER at output of LDPC, not BCH.ber = ber(逻辑(bchencout),ldpcdecout);%停止计时器runtime(ii, rr) = toc(ts);% Don't report the first frame with the initialization overhead.if(rr > 1) fprintf(dels); newCharsToDelete = fprintf('Frame %d decode : %.2f sec',...rr-1, runtime(ii,rr)); dels = repmat('\ b',1,newcharstodelete);endend通过DVB-S.2系统运行帧的末端。% Report the run time results to the Command Window.fprintf(dels);%删除打印的最后一行。% Calculate the average run time. Don't include frame 1 because it% includes some System object initialization time.avgtime(ii) = mean(runtime(ii,2:end)); fprintf('%d frames decoded, %.2f sec/frame\n',numFrames,avgtime(ii)); fprintf('Bit error rate: %g \n',ber(1) );end%架构循环
使用基于CPU的LDPC解码器:
Initializing ...
Frame 1 decode : 0.29 sec Frame 2 decode : 0.30 sec Frame 3 decode : 0.32 sec Frame 4 decode : 0.29 sec Frame 5 decode : 0.25 sec Frame 6 decode : 0.29 sec Frame 7 decode : 0.26 sec Frame 8 decode : 0.29 sec Frame 9 decode : 0.28 sec Frame 10 decode : 0.26 sec
10 frames decoded, 0.28 sec/frame
Bit error rate: 0.00785634
使用基于GPU的LDPC解码器:
Initializing ...
Frame 1 decode : 0.12 sec Frame 2 decode : 0.12 sec Frame 3 decode : 0.12 sec Frame 4 decode : 0.11 sec Frame 5 decode : 0.09 sec Frame 6 decode : 0.12 sec Frame 7 decode : 0.09 sec Frame 8 decode : 0.12 sec Frame 9 decode : 0.12 sec Frame 10 decode : 0.09 sec
10 frames decoded, 0.11 sec/frame
Bit error rate: 0.00785634
% Reset the random stream to the cached objectRandStream.setGlobalStream(original_rs);

Using code similar to what is shown above, a bit error rate measurement was made offline. The bit error rate performance of the GPU- and CPU-based LDPC Decoders are identical as seen in this plot.

概括

If a GPU was used, show the speedup based on the average run time of a DVB-S.2 system using a GPU LDPC Decoder vs a CPU LDPC Decoder.

if~doGPU fprintf('\n*** GPU not present ***\n\n');else%Calculate system-wide speedupfprintf(['\nFull system simulation runs %.2f times faster using '...'the GPU-based LDPC Decoder.\n\n'],avgtime(1) / avgtime(2));end
Full system simulation runs 2.60 times faster using the GPU-based LDPC Decoder.

Appendix

这穰mple uses thecreateSimObjDVBS2Demo.mscript andgetParamsDVBS2Demo.mhelper function.

Selected Bibliography

  1. ETSI Standard EN 302 307 V1.1.1: Digital Video Broadcasting (DVB); Second generation framing structure, channel coding and modulation systems for Broadcasting, Interactive Services, New Gathering and other broadband satellite applications (DVB-S.2), European Telecommunications Standards Institute, Valbonne, France, 2005-03.