advancedcomms-march2014

63
1 © 2014 The MathWorks, Inc. Communications Systems Design with MATLAB Houman Zarrinkoub, Development Manager Peter Sheridan, Senior Account Manager

Upload: francisco-antonio-guerrero-monsalves

Post on 17-Oct-2015

22 views

Category:

Documents


0 download

TRANSCRIPT

  • 5/27/2018 AdvancedComms-March2014

    1/63

    1 2014 The MathWorks, Inc.

    Communications Systems Design with MATLAB

    Houman Zarrinkoub, Development Manager

    Peter Sheridan, Senior Account Manager

  • 5/27/2018 AdvancedComms-March2014

    2/632

    Visit The MathWorks Web Site

    Visit www.mathworks.com/academia

  • 5/27/2018 AdvancedComms-March2014

    3/633

    MATLAB Releases

    Visit http://www.mathworks.com/products/matlab/whatsnew.html

  • 5/27/2018 AdvancedComms-March2014

    4/634

    Learning Resources

    Interactive Video

    Tutorials Studentslearn the basics outside

    of the classroom withself-guided tutorialsprovided by TheMathWorks MATLAB

    Simulink Signal Processing

    Control Systems

    Computational Math

    Visit www.mathworks.com/academia/student_center/tutorials

  • 5/27/2018 AdvancedComms-March2014

    5/635

    Self-Paced Training

    Immediate access (90 days)

    Learn at your own pace

    Use features and workflowsthat are considered bestpractices

    Hands-on MATLABexperience

    Online discussion boards andlive trainer chats

    Available on demand:

    MATLAB Fundamentals - $200.pp MATLAB Programming Techniques -

    $150.pp

  • 5/27/2018 AdvancedComms-March2014

    6/636

    MATLAB Central

    Open exchange for the MATLABand Simulink user community 662,000 visits per month

    File Exchange Upload/download free files including

    MATLAB code, Simulink models, anddocuments

    Rate files, comment, and ask

    questions

    Newsgroup Web forum and newsgroup for

    technical discussions about MATLAB

    and Simulink

    Blogs Read posts from key MathWorks

    developers

    who design and build the products

    Visit www.mathworks.com/matlabcentral

  • 5/27/2018 AdvancedComms-March2014

    7/637

    MATLAB Central

    Visit www.mathworks.com/matlabcentral

  • 5/27/2018 AdvancedComms-March2014

    8/638

    Accelerateyour career at MathWorksIf you have a strong technical background in

    software design, web development, control theory,

    signal processing, or embedded systems,

    this is the place for you!

    To launch your career now, apply at:

    matlab.my/EDGcareer

    http://matlab.my/EDGcareerhttp://matlab.my/EDGcareerhttp://matlab.my/EDGcareer
  • 5/27/2018 AdvancedComms-March2014

    9/639

    MATLAB

    Simulink

    10 popular add-on

    products Control System Toolbox

    Data Acquisition Toolbox

    DSP System Toolbox

    Image Processing Toolbox

    Instrument Control Toolbox

    Optimization Toolbox Signal Processing Toolbox

    Simulink Control Design

    Statistics Toolbox

    Symbolic Math Toolbox

    Student Version

  • 5/27/2018 AdvancedComms-March2014

    10/6310

    Further Information

    Visit www.mathworks.com/

    Contact Information:Peter [email protected]

    Academic Community:www.mathworks.com/academia

    Public Training & E-Learning:(50% EDU Discount)www.mathworks.com/training

    http://www.mathworks.com/traininghttp://www.mathworks.com/training
  • 5/27/2018 AdvancedComms-March2014

    11/6311 2014 The MathWorks, Inc.

    Communications Seminar

    Houman Zarrinkoub PhD.Product Manager

    LTE & Communications Systems

    [email protected]

  • 5/27/2018 AdvancedComms-March2014

    12/6312

    Agenda

    Baseband signal processing Case study: 802.11n/ac/ad as MIMO-OFDM Systems

    Accelerating Communications Simulations

    Case study: LTE PDCCH processing

  • 5/27/2018 AdvancedComms-March2014

    13/6313

    Another resource

  • 5/27/2018 AdvancedComms-March2014

    14/6314 2014 The MathWorks, Inc.

    Baseband signal processing

  • 5/27/2018 AdvancedComms-March2014

    15/6315

    Understand MIMO-OFDM systems Examine family of WIFI standards (802.11x) as a MIMO-OFDM

    system

    Effects of OFDM on bandwidth flexibility

    Effects of beamforming on higher performance How to evaluate system performance with presence of

    interference , large- and small-scale fading, noise

    Link adaptation with modulation and coding changing based on

    channel conditions

    What we learn today

  • 5/27/2018 AdvancedComms-March2014

    16/6316

    Why look at MIMO-OFDM systems?

  • 5/27/2018 AdvancedComms-March2014

    17/6317

    What does MIMO-OFDM offer?

    Broadband Wireless Communications

    High data ratesFlexibility in frequency resource

    f

    H(f)

    WiFi

    standard

    Fc(GHz)

    BW

    (MHz)

    Data rate

    (Mbps)

    802.11n {5, 2.4} {20, 40} {6.5, 13.5, ,

    540}802.11ac 5 {20, 40, 80,

    160}{6.5, 13.5, ,

    6240}

    802.11ad 60 2160 {385, ,6756.75}

  • 5/27/2018 AdvancedComms-March2014

    18/6318

    How does a MIMO-OFDM System work?

    Inputbits

    ModulationChannelcoding

    MIMO ....

    Transmitter

    Channel

    Large-scalefading

    (path-loss )

    Small-scalefading

    (Multipath,Dopplereffects)

    Interference

    NoiseReceiver

    Channeldecoding

    De-modulation

    MIMOReceiver

    (Equalizer)

    Channelestimation

    OFDMreceiver

    OFDMreceiver

    Output

    bits

  • 5/27/2018 AdvancedComms-March2014

    19/63

    19

    OFDM

    Multicarrier transmissionscheme Subdivide wideband channel

    into multiple narrowbandorthogonal sub-channels

    (subcarriers) Enables Flexible transmission

    bandwidths (BW) Robust to multipath fading

    High spectral efficiency Low-complexity implementation Works with MIMO transmission

  • 5/27/2018 AdvancedComms-March2014

    20/63

    20

    OFDM implementation

    Modulated symbols organized in atime-frequency grid

    Grid is composed of data, pilots andcontrol signals

    Pilots are pre-determined samplesused for channel estimation

    In frequency, symbols align withsubcarriers

    Subcarriers are multiples offrequency spacing

    OFDM modulation is essentially an

    Inverse Fourier Transform (IFFT)plus

    Cyclic Prefix (CP) insertion: Appendlast N samples to the beginning

    CP insertion ensures orthogonality

    among frames at the receiver

    /=/ < ( ) 1

    =subcarriers =

    2

    OFDM symbol = n

    +3pilots

    OFDM modulated symbols

  • 5/27/2018 AdvancedComms-March2014

    21/63

    21

    MIMO

    Class of Multi-antenna techniques

    Advantages of MIMO techniques Boosting overall data rates Increasing reliability of

    communication link

    Various types of MIMO/SIMO Receive diversity Transmit diversity Beamforming

    Spatial multiplexing

    WiFi

    standard

    MIMO Max. Data

    rate

    (Mbps)

    802.11n Up to 4 sub-streams

    540

    802.11ac Up to 8 sub-streams

    6240

    802.11ad (Optional)Beamforming

    6756.75

  • 5/27/2018 AdvancedComms-March2014

    22/63

    22

    MIMO implementation

    Essentially composed of 2 steps

    Layer mapping

    Precoding

    Layer mapping

    Splits modulated symbol streaminto multiple substreams

    Precoding Transforms (scales) substreams

    In beamforming provides beam-

    steering In transmit diversity it creates

    orthogonal codes

    In spatial multiplexing, each sub-stream is steered to a differentdirection

    MIMO layer mapping in

    Beamforming Transmit diversity

    MIMO precoding in

    Beamforming Spatial multiplexing

  • 5/27/2018 AdvancedComms-March2014

    23/63

    23

    Channel modeling & propagation scenarios (1)

    Mobile context(WiMAX or LTE)

    pathloss

    pathloss

    InterferingBase

    station

    SignalBasestation

    Multipath

    fading

  • 5/27/2018 AdvancedComms-March2014

    24/63

    24

    Channel modeling & propagation scenarios (2)

    Stationary context(WiFi)

    Signalsource

    Interference

    source

    pathloss

    pathloss

    Multipath

    fading

  • 5/27/2018 AdvancedComms-March2014

    25/63

    25

    Performance evaluation with realistic channel models

    Large scale simulations

    Transceiver system responding to dynamic channel conditions

    Evaluating the combined effects of Fading channels

    Interfering signals

    Non-linearities front-end receivers

    Phase noise, Frequency offset, Timing mismatch, IQ imbalance

    Channel estimation & Equalization

    Antenna arrays & directional propagation

    Beamforming & beamsteering

    Challenges in design and evaluation of MIMO-

    OFDM systems

  • 5/27/2018 AdvancedComms-March2014

    26/63

    26

    Step-by-step MATLAB demo OFDM as the air interface technology of 802.11x

    Beamforming as a MIMO technique

    Easy-to-follow end-to-end simulation Graphical test bench

    Adjustment of channel characteristics onthe fly

    Demonstration:

    802.11n/ac/ad as a MIMO-OFDMsystem

  • 5/27/2018 AdvancedComms-March2014

    27/63

    27

    Baseband demo workflow

  • 5/27/2018 AdvancedComms-March2014

    28/63

    28

    Version 1: Baseline - Modulation and Coding

    Transceiver with modulation, coding, scrambling(No OFDM or MIMO yet)

    Channel (Interferer + path loss) (No multipath fading yet)

    Isotropic (non-directional) antennas

    Antenna configuration (1x1)

    Signal

    Source (S)

    InterferenceSource (I)

  • 5/27/2018 AdvancedComms-March2014

    29/63

    29

    Version 2: Baseline + OFDM

    Introduce OFDM transmission of 802.11x Transceiver with modulation, coding, scrambling & OFDM

    transmitter & receiver

    Channel (Interferer + path loss) (No multipath fading yet)

    Signal

    Source (S)

    InterferenceSource (I)

  • 5/27/2018 AdvancedComms-March2014

    30/63

    30

    Version 3: Baseline + OFDM +

    Receiver-side beamforming

    Introduce Receive-side beamforming

    Transceiver with modulation, coding, scrambling, OFDM transmitter& receiver & Receive diversity SIMO (receiver beamforming)

    Channel with Interferer + path loss (No multipath fading yet)

    Receiver has multiple Antennas (1 to 8)

    Signal

    Source (S)

    InterferenceSource (I)

  • 5/27/2018 AdvancedComms-March2014

    31/63

    31

    Version 4: Baseline + OFDM +

    Receiver-side beamforming + Multipath fading

    Introduce Receive-side beamforming with Multipath fading

    Transceiver with modulation, coding, scrambling, OFDM transmitter& receiver & Receive diversity SIMO (receiver beamforming)

    Channel with Interferer + path loss + fading

    Receiver has multiple Antennas (1 to 8)

    Signal

    Source (S)

    InterferenceSource (I)

  • 5/27/2018 AdvancedComms-March2014

    32/63

    32

    Version 5: Baseline + OFDM +

    Transmit-side beamforming + Multipath fading

    Introduce Transmit-side beamforming with Multipath fading

    Transceiver with modulation, coding, scrambling, MIMO-OFDMtransmitter & receiver

    Channel with Interferer + path loss + fading

    Transmitter has multiple Antennas (1 to 8)

    SignalSource (S)

    InterferenceSource (I)

  • 5/27/2018 AdvancedComms-March2014

    33/63

    33

    Version 6: Baseline + OFDM + Multiuser

    Transmit-side beamforming + Multipath fading

    Introduce Steered transmission(s) in base station (OFDMA)

    Transceiver with modulation, coding, scrambling, MIMO-OFDMtransmitter & receiver

    Channel with Interferer + path loss + fading

    Transmitter has multiple Antennas (1 to 8)

    Signal

    Source (S)

    InterferenceSource (I)

  • 5/27/2018 AdvancedComms-March2014

    34/63

    34

    Version 7: Baseline + OFDM +

    MIMO beamforming + Multipath fading

    Introduce MIMO beamforming (both Tx-side and Rx-side)

    Transceiver with modulation, coding, scrambling, MIMO-OFDMtransmitter & receiver

    Channel with Interferer + path loss + fading

    Transmitter has multiple Antennas (1 to 8)

    Signal

    Source (S)

    InterferenceSource (I)

  • 5/27/2018 AdvancedComms-March2014

    35/63

    35

    Communications System Toolbox Modulation, Coding, OFDM, MIMO Fading Channels, Visualizations and

    Measurements

    Phased Array System Toolbox

    Beamforming, Beam steering

    DSP System Toolbox Mapping User interface parameters into MATLAB parameters

    instantaneously, Spectral Analysis

    MATLAB

    Live interactive MATLAB testbenches

    (Optionally) Computer Vision System Toolbox

    Providing live data feeds of telemetry data as transmitted bit stream

    What MathWorks product features did we

    highlight

  • 5/27/2018 AdvancedComms-March2014

    36/63

    36

    Large scale BER, Block Error Rate, Throughput computations Parallel Processing Toolbox

    MATLAB Coder (Genrating C code for design bottlenecks)

    Analysis of link impairments Synchronization, Phase noise, Frequency offset, Timing mismatch, IQ imbalance

    What else can MATLAB do to help with

    communications system modeling

  • 5/27/2018 AdvancedComms-March2014

    37/63

    37 2014 The MathWorks, Inc.

    Accelerat ing Commun icat ions System

    Simulations in MATLAB

  • 5/27/2018 AdvancedComms-March2014

    38/63

    38

    Why simulation acceleration?

    From algorithm exploration to system design Size and complexity of models increases

    Time needed for a single simulation increases

    Number of test cases increases

    Test cases become larger

    Need to reduce simulation time during design

    simulation time for large scale testing during prototyping

  • 5/27/2018 AdvancedComms-March2014

    39/63

    39

    MATLAB is quite fast

    Optimized and widely-used libraries BLAS Basic Linear Algebra Subroutines (multithreaded)

    LAPACK Linear Algebra Package

    JIT (Just In Time) Acceleration On-the-fly multithreaded code generation for increased speed

    Built-in support for vector and matrix operations

  • 5/27/2018 AdvancedComms-March2014

    40/63

    40

    Application

    LTE Physical Downlink Control Channel (PDCCH)

  • 5/27/2018 AdvancedComms-March2014

    41/63

    41

    Workflow

    Start with a baseline algorithm

    Profile it to introduce a performance yardstick

    Introduce the following optimizations: Better MATLAB serial programming techniques

    Using System objects

    MATLAB to C code generation (MEX)

    Parallel Computing

    GPU-optimized System objects Rapid Accelerator mode of simulation in Simulink

  • 5/27/2018 AdvancedComms-March2014

    42/63

    42

    Simulation acceleration options in MATLAB

    MATLAB to C

    Users Code

    GPU

    processing

    ParallelComputing

    Better MATLAB

    code

    System objects

  • 5/27/2018 AdvancedComms-March2014

    43/63

    43

    Profiling MATLAB algorithms

    Profiler summarizesMATLAB code execution total time spent within each

    function which lines of code use the

    most processing time

    Helps identify algorithmbottlenecks

  • 5/27/2018 AdvancedComms-March2014

    44/63

    44

    Effective MATLAB programming techniques

    Pre-allocation Initialize an array using its final size

    Helps avoid dynamically resizing arrays in a loop

    Vectorization Convert code from using scalar loops to using matrix/vectoroperations

    Helps MATLAB leverage processor-optimized libraries forvector processing

    Example of pre-allocation

    y=[];

    forn=1:LEN/Tx

    G=[u(idx1(n)) u(idx2(n));...

    -conj(u(idx2(n))) conj(u(idx1(n)))];

    y=[y;G];

    end

    y=complex(zeros(LEN,Tx));

    y(idx1,1)=u(idx1);

    y(idx1,2)=u(idx2);

    y(idx2,1)=-conj(u(idx2));

    y(idx2,2)=conj(u(idx1));

  • 5/27/2018 AdvancedComms-March2014

    45/63

    45

    Using System objects of

    DSP & Communications System Toolboxes

    System objects facilitate stream processing

    Can accelerate simulation because Decouple declaration from the execution of the algorithms

    Reduce overhead of parameter handling in the loop

    Most of them implemented as MATLAB executables (MEX)

    Example of System objects

    functions = Alamouti_DecoderS(u,H)

    %#codegen

    % STBC Combiner

    persistenthTDDec

    ifisempty(hTDDec)

    hTDDec= comm.OSTBCCombiner(...

    'NumTransmitAntennas',2,'NumReceiveAntennas',2);

    end

    s = step(hTDDec, u, H);

  • 5/27/2018 AdvancedComms-March2014

    46/63

    46

    MATLAB to C code generation

    MATLAB Coder

    Automatically generatea MEX function

    Call the generated MEX

    file within testbench Verify same numerical

    results

    Assess the baseline

    function and thegenerated MEX functionfor speed

  • 5/27/2018 AdvancedComms-March2014

    47/63

    47

    Task 1 Task 2 Task 3 Task 4Task 1 Task 2 Task 3 Task 4

    Parallel Simulation Runs

    Time Time

    TOOLBOXES

    BLOCKSETS

    Worker

    Worker

    Worker

    Worker

    >> Demo

  • 5/27/2018 AdvancedComms-March2014

    48/63

    48

    Summary

    matlabpool available workers No modification of algorithm

    Useparforloop instead of forloop

    Parallel computation or simulation

    leads to further acceleration More cores = more speed

  • 5/27/2018 AdvancedComms-March2014

    49/63

    49

    Simulation acceleration options in MATLAB

    MATLAB to C

    Users Code

    GPU

    processing

    Parallel

    Computing

    Better MATLAB

    code

    System objects

  • 5/27/2018 AdvancedComms-March2014

    50/63

    50

    What is a Graphics Processing Unit (GPU)

    Originally for graphics acceleration, now also used forscientific calculations

    Massively parallel array of integer and

    floating point processors Typically hundreds of processors per card

    GPU cores complement CPU cores

    Dedicated high-speed memory

  • 5/27/2018 AdvancedComms-March2014

    51/63

    51

    Why would you want to use a GPU?

    Speed up execution of computationally intensivesimulations

    For example: Performance: A\b with Double Precision

  • 5/27/2018 AdvancedComms-March2014

    52/63

    52

    Options for Targeting GPUs

    1) Use GPU with MATLAB built-in functions

    2) Execute MATLAB functions elementwiseon the GPU

    3) Create kernels from existing CUDA codeand PTX files

    Ease

    ofUse

    G

    reaterContro

    l

  • 5/27/2018 AdvancedComms-March2014

    53/63

    53

    Data Transfer between MATLAB and GPU

    % Push data from CPU to GPU memory

    Agpu = gpuArray(A)

    % Bring results from GPU memory back to CPU

    B = gather(Bgpu)

  • 5/27/2018 AdvancedComms-March2014

    54/63

    54

    GPU Processing with

    Communications System Toolbox

    Alternative implementationfor many System objectstake advantage of GPUprocessing

    Use Parallel ComputingToolbox to execute manycommunications algorithmsdirectly on the GPU

    Easy-to-use syntax

    Dramatically accelerate

    simulations

    GPU System objects

    comm.gpu.TurboDecoder

    comm.gpu.ViterbiDecoder

    comm.gpu.LDPCDecoder

    comm.gpu.PSKDemodulator

    comm.gpu.AWGNChannel

  • 5/27/2018 AdvancedComms-March2014

    55/63

    55

    Impressive coding gain

    High computational complexity

    Bit-error rate performance as a function of number ofiterations

    Example: Turbo Coding

    = comm.TurboDecoder(NumIterations, numIter,

  • 5/27/2018 AdvancedComms-March2014

    56/63

    56

    Acceleration with GPU System objects

    Version Elapsed time Acceleration

    CPU 8 hours 1.0

    1 GPU 40 minutes 12.0

    Cluster of 4GPUs

    11 minutes 43.0

    Same numerical results

    = comm.TurboDecoder(NumIterations, N,

    = comm.gpu.TurboDecoder(NumIterations, N,

    = comm.AWGNChannel(= comm.gpu.AWGNChannel(

  • 5/27/2018 AdvancedComms-March2014

    57/63

    57

    Key Operations in Turbo Coding Function

    CPU GPU Version 1

    % Turbo EncoderhTEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4, [13 15], 13),..

    'InterleaverIndices', intrlvrIndices)

    % AWG Noise

    hAWGN = comm.AWGNChannel('NoiseMethod', 'Variance');

    % BER measurement

    hBER = comm.ErrorRate;

    % Turbo Decoder

    hTDec = comm.TurboDecoder(

    'TrellisStructure',poly2trellis(4, [13 15], 13),...

    'InterleaverIndices', intrlvrIndices,'NumIterations', numIter);

    ber = zeros(3,1); %initialize BER output

    %% Processing loop

    while( ber(1) < MaxNumErrs && ber(2) < MaxNumBits)

    data = randn(blkLength, 1)>0.5;

    % Encode random data bits

    yEnc = step(hTEnc, data);

    %Modulate, Add noise to real bipolar data

    modout = 1-2*yEnc;

    rData = step(hAWGN, modout);

    % Convert to log-likelihood ratios for decoding

    llrData = (-2/noiseVar).*rData;

    % Turbo Decode

    decData = step(hTDec, llrData);

    % Calculate errors

    ber = step(hBER, data, decData);

    end

    % Turbo EncoderhTEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4, [13 15], 13),..

    'InterleaverIndices', intrlvrIndices)

    % AWG Noise

    hAWGN = comm.AWGNChannel('NoiseMethod', 'Variance');

    % BER measurement

    hBER = comm.ErrorRate;

    % Turbo Decoder

    hTDec = comm.gpu.TurboDecoder(

    'TrellisStructure',poly2trellis(4, [13 15], 13),...

    'InterleaverIndices', intrlvrIndices,'NumIterations', numIter);

    ber = zeros(3,1); %initialize BER output

    %% Processing loop

    while( ber(1) < MaxNumErrs && ber(2) < MaxNumBits)

    data = randn(blkLength, 1)>0.5;

    % Encode random data bits

    yEnc = step(hTEnc, data);

    %Modulate, Add noise to real bipolar data

    modout = 1-2*yEnc;

    rData = step(hAWGN, modout);

    % Convert to log-likelihood ratios for decoding

    llrData = (-2/noiseVar).*rData;

    % Turbo Decode

    decData = step(hTDec, llrData);

    % Calculate errors

    ber = step(hBER, data, decData);

    end

  • 5/27/2018 AdvancedComms-March2014

    58/63

    58

    Profile results in Turbo Coding Function

    CPU GPU Version 1

    % Turbo Encoder

  • 5/27/2018 AdvancedComms-March2014

    59/63

    59

    Key Operations in Turbo Coding Function

    CPU GPU Version 2

    % Turbo EncoderhTEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4, [13 15], 13),..

    'InterleaverIndices', intrlvrIndices)

    % AWG Noise

    hAWGN = comm.AWGNChannel('NoiseMethod', 'Variance');

    % BER measurement

    hBER = comm.ErrorRate;

    % Turbo Decoder

    hTDec = comm.TurboDecoder('TrellisStructure',poly2trellis(4, [13 15], 13),...

    'InterleaverIndices', intrlvrIndices,'NumIterations', numIter);

    %% Processing loop

    while( ber(1) < MaxNumErrs && ber(2) < MaxNumBits)

    data = randn(blkLength, 1)>0.5;

    % Encode random data bits

    yEnc = step(hTEnc, data);

    %Modulate, Add noise to real bipolar data

    modout = 1-2*yEnc;

    rData = step(hAWGN, modout);

    % Convert to log-likelihood ratios for decoding

    llrData = (-2/noiseVar).*rData;

    % Turbo Decode

    decData = step(hTDec, llrData);

    % Calculate errors

    ber = step(hBER, data, decData);

    end

    % Turbo EncoderhTEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4, [13 15], 13),..

    'InterleaverIndices', intrlvrIndices)

    % AWG Noise

    hAWGN = comm.gpu.AWGNChannel ('NoiseMethod', 'Variance');

    % BER measurement

    hBER = comm.ErrorRate;

    % Turbo Decoder - setup for Multi-frame or Multi-user processing

    numFrames = 30;

    hTDec = comm.gpu.TurboDecoder('TrellisStructure',poly2trellis(4, [13 15], 13),...

    'InterleaverIndices', intrlvrIndices,'NumIterations',numIter,

    NumFrames,numFrames);

    %% Processing loop

    while( ber(1) < MaxNumErrs && ber(2) < MaxNumBits)

    data = randn(numFrames*blkLength, 1)>0.5;

    % Encode random data bits

    yEnc = gpuArray(multiframeStep(hTEnc, data, numFrames));

    %Modulate, Add noise to real bipolar data

    modout = 1-2*yEnc;

    rData = step(hAWGN, modout);

    % Convert to log-likelihood ratios for decoding

    llrData = (-2/noiseVar).*rData;

    % Turbo Decode

    decData = step(hTDec, llrData);

    % Calculate errors

    ber=step(hBER, data, gather(decData));

    end

  • 5/27/2018 AdvancedComms-March2014

    60/63

    60

    Profile results in Turbo Coding Function

    CPU GPU Version 2

    % Turbo Encoder

  • 5/27/2018 AdvancedComms-March2014

    61/63

    61

    Things to note when targeting GPU

    Minimize data transfer between CPU and GPU.

    Using GPU only makes sense if data size is large.

    Some functions in MATLAB are optimized and can befaster than the GPU equivalent (eg. FFT).

    Use arrayfun to explicitly specify elementwiseoperations.

  • 5/27/2018 AdvancedComms-March2014

    62/63

    62

    Summary

    Acceleration methodologies in MATLAB & Simulink Technology /

    Product1. Best Practices in Programming

    Vectorization & pre-allocation

    Environment tools. (i.e. Profiler, Code Analyzer)

    MATLAB, Toolboxes,

    System Toolboxes

    2. Better Algorithms

    Ideal environment for algorithm exploration

    Rich set of functionality (e.g. System objects)

    MATLAB, Toolboxes,

    System Toolboxes

    3. More Processors or Cores

    High level parallel constructs (e.g. parfor, matlabpool)

    Utilize cluster, clouds, and grids

    Parallel Computing

    Toolbox,

    MATLAB Distributed

    Computing Server

    4. Refactoring the Implementation

    Compiled code (MEX)

    GPUs, FPGA-in-the-Loop

    MATLAB, MATLAB Coder,

    Parallel Computing

    Toolbox

  • 5/27/2018 AdvancedComms-March2014

    63/63

    Q & A

    Thank You