Docsity

Cell Software Development of Environment | ECE 4893, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
Lecture 18: Cell/B.E. Introduction: Software Development
Kamesh Madduri
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30

Partial preview of the text

Download Cell Software Development of Environment | ECE 4893 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Lecture 18: Cell/B.E. Introduction: Software Development

Kamesh Madduri

2

Lecture Outline

• Cell software development environment

– Standards

• Language extensions, SPU ABI, and Linux

reference ABI

– Development Environment

• Code development tools, debug tools,

performance tools, and other miscellaneoustools

– Execution Environment

• Linux and CBE extensions, SPE management

library, SPE optimized function libraries, systemlevel simulator, samples, workloads, and demos

• Cell Application Affinity

4

Cell BE Resources

developerWorks: Cell BE resource center (SDK,IBM whitepapers, reports, forum)

http://www.ibm.com/developerworks/power/cell/

Power.org: Cell developer corner (links)

http://www.power.org/resources/devcorner/cellcorner/

Georgia Tech (Sony-Toshiba-IBM Cell

Center of

Competence)

http://sti.cc.gatech.edu/

– wiki (technical papers) http://wiki.cc.gatech.edu/cellbuzz – cellbuzz cluster (QS20 Blades)

apply for accounts!

Systems and Technology Group

© 2006 IBM Corporation

5

ProgrammerExperience

Dev

elopment Tools Stack

System Level Simulator

Linux PPC64 with CBE Extensions

SPE Management Lib

Samples Workloads

Demos

Code Dev Tools

Debug Tools

Performance Tools

Standards:

Language extensionsSPU ABI, Linux Reference ABI

DevelopmentEnvironment

End-UserExperience

Execution

Environment

Miscellaneous Tools

Cell Alpha Software Development Environment

Distributed on IBM alphaworks & Barcelona Super Computer sites

Documentation

SPE Optimized Function

LIbraries

Systems and Technology Group

© 2006 IBM Corporation

7

System Level Simulator - systemsim

ƒ

Cell BE – full system simulator

  • Uni-Cell and multi-Cell simulation – User Interfaces – TCL and GUI – Cycle accurate SPU simulation (pipeline mode) – Emitter facility for tracing and viewing simulation events

Execution Environment

Systems and Technology Group

© 2006 IBM Corporation

8

SW Stack in Simulation

Executables

Runtime and libraries

System Software: Hypervisor, Linux/PPC or K

Real Systems:

Modified Software Stack: Running On Mambo CellSim: Simulation of hardware

Standard Terminal System Activity Monitors

Application Source Code

Programming Tools

Compilers

Programming Model

OpenMP

MPI

Modified Development Environment:

Traces

Execution Environment

Systems and Technology Group

© 2006 IBM Corporation

10

Linux on CBE

ƒ

Provided as patched to the 2.6.15 PPC64 Kernel

Added heterogeneous lwp/thread model

SPE thread API created (similar to pthreads library)

User mode direct and indirect SPE access models

Full pre-emptive SPE context management

spe_ptrace() added for gdb support

spe_schedule() for thread to physical SPE assignment –

currently FIFO – run to completion

SPE threads share address space with parent PPE process (through DMA)

Demand paging for SPE accesses

Shared hardware page table with PPE

PPE proxy thread allocated for each SPE thread to:

Provide a single namespace for both PPE and SPE threads

Assist in SPE initiated C99 and POSIX-1 library services

SPE Error, Event and Signal handling directed to parent PPE thread

SPE elf objects wrapped into PPE shared objects with extended gld

All patches for Cell in architecture dependent layer (subtree of PPC64)

Execution Environment

Systems and Technology Group

© 2006 IBM Corporation

11

Application Source

& Libraries

PPE object files

SPE object files

SPE

SPE

SPE

SPE

Physical SPEs

SPE

SPE

SPE

SPE

Cell AwareOS ( Linux)

SPE Virtualization / Scheduling Layer (m->n SPE threads)

New SPE tasks/threads

Existing PPEtasks/threads

Physical PPE

PPE

MT

MT

Operating System Runtime Strategy

Heterogeneous Multi-Threading Model

PPE Threads, SPE Threads ƒ

SPE DMA EA = PPE Process EA Space ƒ

OS supports Create/Destroy SPE tasks ƒ

Atomic Update Primitives used for Mutex ƒ

SPE Context Fully Managed

Context Save/Restore for Debug ƒ

Virtualization Mode (indirect access) ƒ

Direct Access Mode (realtime)

OS assignment of SPE threads to SPEs

Programmer directed using affinity mask

SPE Compilers use SPE Management Lib.

Systems and Technology Group

© 2006 IBM Corporation

13

SPE Management Library

ƒ

SPEs are exposed as threads

SPE thread model interface is similar to POSIX threads.

SPE thread consists of the local store, register file, program counter,and MFC-DMA queue.

Associated with a single Linux task.

Features include:

Threads

  • create, groups, wait, kill, set affinity, set context

Thread Queries

  • get local store pointer, get problem state area pointer, get

affinity, get context

Groups

  • create, set group defaults, destroy, memory map/unmap, madvise.

Group Queries

  • get priority, get policy, get threads, get max threads per group,

get events.

SPE image files

  • opening and closing

ƒ

SPE Executable

Standalone SPE program managed by a PPE executive.

Executive responsible for loading and executing SPE program. It alsoservices assisted requests for I/O (eg, fopen, fwrite, fprintf) andmemory requests (eg, mmap, shmat, …).

Execution Environment

Systems and Technology Group

© 2006 IBM Corporation

14 Optimized SPE and Multimedia Extension Libraries

Execution Environment

Standard SPE C library subset –

optimized SPE C99 functions including stdlib c lib, math and etc.

subset of POSIX.1 Functions – PPE assisted

Audio resample - resampling audio signals

ƒ

FFT - 1D and 2D fft functions

ƒ

gmath - mathematic functions optimized for gaming environment

ƒ

image - convolution functions

ƒ

intrinsics - generic intrinsic conversion functions

ƒ

large-matrix - functions performing large matrix operations

ƒ

matrix - basic matrix operations

ƒ

mpm - multi-precision math functions

ƒ

noise - noise generation functions

ƒ

oscillator - basic sound generation functions

ƒ

sim – simulator only function including print, profile checkpoint, socket I/O, etc …

ƒ

surface - a set of bezier curve and surface functions

ƒ

sync - synchronization library

ƒ

vector - vector operation functions

Systems and Technology Group

© 2006 IBM Corporation

16

Debug Tools

GNU gdb

  • Multi-core Application source level debugger supporting

PPE multithreading, SPE multithreading, interacting PPEand SPE threads

  • Modes of debugging SPU threads •

Standalone SPE debugging

Attach to SPE thread – Thread ID output when SPU_DEBUG_START=

Development Environment

Systems and Technology Group

© 2006 IBM Corporation

17

SPE Performance Tools (executables)

ƒ

Static analysis (spu_timing)

Annotates assembly source with instruction pipeline state

ƒ

Dynamic analysis (CBE System Simulator)

Generates statistical data on SPE execution

Cycles, instructions, and CPI

Single/Dual issue rates

Stall statistics

Register usage

Instruction histogram

ƒ

pmcount

Tool to access to HW performance counters

Not currently public – being ported to oprofile interfacestandard

Development Environment

Systems and Technology Group

© 2006 IBM Corporation

19

ƒ

cesof - the samples for the CBE embedded SPU object format usage

ƒ

spu_clean - cleans the SPU register and local store

ƒ

spu_entry - sample SPU entry function (crt0)

ƒ

spu_interrupt - SPU first level interrupt handler sample

ƒ

spulet - direct invocation of a spu program from Linux shell

ƒ

sync

ƒ

simpleDMA / DMA

ƒ

tutorial - example source code from the tutorial

ƒ

SDK test suite– 57 tests– Exercising all packages in the SDK

Sample Source

Execution Environment

Systems and Technology Group

© 2006 IBM Corporation

20

ƒ

FFT16M – optimized 16 M point complex FFT

ƒ

Oscillator - audio signal generator

ƒ

Matrix Multiply – matrix multiplication workload

ƒ

VSE_subdiv - variable sharpness subdivision algorithm

Workloads

Execution Environment