<<  Europe in the Middle Ages The World of Androids  >>
Hands-on  The Hello World
Hands-on The Hello World
Class Objectives
Class Objectives
How to build, compile and execute the Hello World
How to build, compile and execute the Hello World
The build process
The build process
Build Process
Build Process
SDK 3.0 Makefile
SDK 3.0 Makefile
Compiling within the SDK
Compiling within the SDK
Common Makefile variables
Common Makefile variables
Directory Layout and Examples of Makefile
Directory Layout and Examples of Makefile
Building The Code
Building The Code
The Hello World
The Hello World
Four Different Versions of Hello World
Four Different Versions of Hello World
Hello World
Hello World
Hello World
Hello World
Synergistic PPE and SPE (SPE Embedded)
Synergistic PPE and SPE (SPE Embedded)
How does a PPE program start an SPE thread
How does a PPE program start an SPE thread
SPE context creation
SPE context creation
spe_program_load
spe_program_load
spe_context_run
spe_context_run
spe_context_destroy
spe_context_destroy
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
The IBM Full System Simulator  An Overview
The IBM Full System Simulator An Overview
Simulator Overview
Simulator Overview
SystemSim Runtime Environment
SystemSim Runtime Environment
SystemSim User Interface
SystemSim User Interface
Operating-System Modes
Operating-System Modes
Simulator Structure and Windows
Simulator Structure and Windows
Interacting with the Simulator
Interacting with the Simulator
Starting the Simulator in GUI Interface
Starting the Simulator in GUI Interface
SystemSim Cell GUI main panel
SystemSim Cell GUI main panel
Basic Simulator operations
Basic Simulator operations
The PPE
The PPE
The PPE
The PPE
The SPU
The SPU
Simulator Modes  fast, simple, and cycle
Simulator Modes fast, simple, and cycle
How to Exchange Files between Host and Simulator
How to Exchange Files between Host and Simulator
Execute Binary
Execute Binary
Building three types of the hello world
Building three types of the hello world
Directory Structure
Directory Structure
Hands-on Exercise
Hands-on Exercise
Hands-on  multi-threaded hello world
Hands-on multi-threaded hello world
Hands-on  multi-threaded hello world (contd)
Hands-on multi-threaded hello world (contd)
Hands-on  multi-threaded hello world (contd)
Hands-on multi-threaded hello world (contd)
Hands-on  multi-threaded hello world (contd)
Hands-on multi-threaded hello world (contd)
Hands-on  multi-threaded hello world (contd)
Hands-on multi-threaded hello world (contd)
Hands-on  multi-threaded hello world (contd)
Hands-on multi-threaded hello world (contd)
Hands-on  multi-threaded hello world (contd)
Hands-on multi-threaded hello world (contd)
Summary
Summary
Special Notices -- Trademarks
Special Notices -- Trademarks
Special Notices (Cont
Special Notices (Cont
Special Notices - Copyrights
Special Notices - Copyrights

: Hands-on The Hello World. : Cell/Quasar Ecosystem & Solutions Enablement. : Hands-on The Hello World.ppt. zip-: 633 .

Hands-on The Hello World

Hands-on The Hello World.ppt
1 Hands-on  The Hello World

Hands-on The Hello World

Program

Cell Programming Workshop Cell/Quasar Ecosystem Solutions Enablement

1

Cell Programming Workshop

10/30/2015

2 Class Objectives

Class Objectives

You will learn how to write, build and run Hello World! on the Cell System Simulator Navigate through the basic build process and make files Familiarize with gcc and xlc compilers Familiarize with the system simulator There are three different versions of Hello World! used in this session PPE only, SPE only, and Cell BE, i.e. using both PPE and SPE Synchronous Asynchronous

Trademarks - Cell Broadband Engine is a trademark of Sony Computer Entertainment, Inc.

Cell Programming Workshop

10/30/2015

3 How to build, compile and execute the Hello World

How to build, compile and execute the Hello World

program

Pre-requisites Toolchain Compiler Build Process Source Code Makefiles Source PPE Source SPE Simulator Getting the binary into the simulator Running the binary

Cell Programming Workshop

10/30/2015

4 The build process

The build process

Cell Programming Workshop

10/30/2015

5 Build Process

Build Process

SPE Code

SPE Toolchain

SPE Objects

Embed Utility

Cell BE Executable

SPE Code

PPE Obj

SPE Code

PPE Code

PPE Toolchain

PPE Objects

PPE Toolchain (Linker)

PPE Code

Cell Programming Workshop

10/30/2015

6 SDK 3.0 Makefile

SDK 3.0 Makefile

Cell Programming Workshop

10/30/2015

7 Compiling within the SDK

Compiling within the SDK

Top of build environment is /opt/cell/sdk/ Includes the build environment files README_build_env.txt Provides details on the build environment features, including files, structure and variables. make.footer Specifies all of the build rules needed to properly build CBEA binaries Must be included in all SDK Makefiles (referenced relatively if $CELL_TOP is not defined) Includes make.header make.header Specifies definitions needed to process the Makefiles Includes make.env make.env Specifies the default compilers and tools to be used by make make.footer and make.header should not be modified

Cell Programming Workshop

10/30/2015

8 Common Makefile variables

Common Makefile variables

DIRS list of subdirectories to build first PROGRAM_ppu PROGRAMS_ppu 32-bit PPU program (or list of programs) to build. PROGRAM_ppu64 PROGRAMS_ppu64 64-bit PPU program (or list of programs) to build. PROGRAM_spu PROGRAMS_spu SPU program (or list of programs) to build. If written as a standalone binary, can run without being embedded in a PPU program. LIBRARY_embed LIBRARY_embed64 Creates a linked library from an SPU program to be embedded into a 32-bit or 64-bit PPU program. OBJS OBJS_<program> List of objects for the programs (or one specific program). By default, all objects in the current directory are linked into the binary. IMPORTS IMPORTS_<program> List of libraries to link in the programs (or one specific program). Also used by the PPU programs to embed the SPU linked library.

Cell Programming Workshop

10/30/2015

9 Directory Layout and Examples of Makefile

Directory Layout and Examples of Makefile

sample sample.h Makefile sample/spu Makefile sample_spu.c sample/ppu Makefile sample.c

DIRS = spu ppu include $(CELL_TOP)/buildutils/make.footer

PROGRAM_spu = sample_spu LIBRARY_embed = lib_sample_spu.a include $(CELL_TOP)/buildutils/make.footer

PROGRAM_ppu = sample IMPORTS = ../spu/lib_sample_spu.a include $(CELL_TOP)/buildutils/make.footer

Cell Programming Workshop

10/30/2015

10 Building The Code

Building The Code

Environment setup Set the CELL_TOP environment variable so that the makefile system can be found: export CELL_TOP=/opt/cell/sdk/ make.footer contains the build rules for the makefile system Ensure compilers or cross-compilers are in the executable search path Separate SPE code and PPE code into different directories Each set of code has its own makefile and toolchain to use Suggestion: create a subdirectory called spu in the directory where the PPU code is found Makefile template for PPE code: DIRS = spu PROGRAM_ppu = <PPU_executable_name> IMPORTS = <spu_executable-embed.a> -lspe2 include $(CELL_TOP)/buildutils/make.footer Makefile template for SPE code: PROGRAM_spu = <SPU_executable_name> LIBRARY_embed = <spu_executable-embed.a> include $(CELL_TOP)/buildutils/make.footer

Cell Programming Workshop

10/30/2015

11 The Hello World

The Hello World

program

Cell Programming Workshop

10/30/2015

12 Four Different Versions of Hello World

Four Different Versions of Hello World

PPE only SPE only Synergistic PPE and SPE: synchronous One SPE is used. Main thread blocks and waits for the SPE code to run to completion Synergistic PPE and SPE: asynchronous Eight SPEs are used Main thread uses pthreads to get concurrent/asynchronous execution

Cell Programming Workshop

10/30/2015

13 Hello World

Hello World

PPE Only

PPU program just like any Hello World! program one would write Makefile make.footer included to set up compiler and compiler flags PROGRAM_ppu tells make to use PPC cross-compiler

PROGRAM_ppu tells make to use PPC compiler

#include <stdio.h> int main(void) { printf("Hello world!\n"); return 0; }

PROGRAM_ppu = hello_ppu include $(CELL_TOP)/buildutils/make.footer

Cell Programming Workshop

10/30/2015

14 Hello World

Hello World

SPE Only

SPU Program SPU Makefile

PROGRAM_spu tells make to use SPE compiler

PROGRAM_spu := hello_spu include $(CELL_TOP)/buildutils/make.footer

#include <stdio.h> int main() { printf("Hello world!\n"); return 0; }

Cell Programming Workshop

10/30/2015

15 Synergistic PPE and SPE (SPE Embedded)

Synergistic PPE and SPE (SPE Embedded)

Applications use software constructs called SPE contexts to manage and control SPEs. Linux schedules SPE contexts from all running applications onto the physical SPE resources in the system for execution according to the scheduling priorities and policies associated with the runable SPE contexts. libspe provides the means for communication and data transfer between PPE threads and SPEs.

Cell Programming Workshop

10/30/2015

16 How does a PPE program start an SPE thread

How does a PPE program start an SPE thread

4 basic steps must be done by the PPE program Create an SPE context. Load an SPE executable object into the SPE context local store. Run the SPE context. This transfers control to the operating system, which requests the actual scheduling of the context onto a physical SPE in the system. Destroy the SPE context.

Cell Programming Workshop

10/30/2015

17 SPE context creation

SPE context creation

spe_context_create - Create and initialize a new SPE context data structure. #include <libspe2.h> spe_context_ptr_t spe_context_create(unsigned int flags, spe_gang_context_ptr_t gang) flags - A bit-wise OR of modifiers that are applied when the SPE context is created. gang - Associate the new SPE context with this gang context. If NULL is specified, the new SPE context is not associated with any gang. On success, a pointer to the newly created SPE context is returned.

Cell Programming Workshop

10/30/2015

18 spe_program_load

spe_program_load

spe_program_load - Load an SPE main program. #include <libspe2.h> int spe_program_load (spe_context_ptr_t spe, spe_program_handle_t *program) spe - A valid pointer to the SPE context for which an SPE program should be loaded. program - A valid address of a mapped SPE program.

Cell Programming Workshop

10/30/2015

19 spe_context_run

spe_context_run

spe_context_run - Request execution of an SPE context. #include <libspe2.h> int spe_context_run(spe_context_ptr_t spe, unsigned int *entry, unsigned int runflags, void *argp, void *envp, spe_stop_info_t *stopinfo) spe - A pointer to the SPE context that should be run. entry - Input: The entry point, that is, the initial value of the SPU instruction pointer, at which the SPE program should start executing. If the value of entry is SPE_DEFAULT_ENTRY, the entry point for the SPU main program is obtained from the loaded SPE image. This is usually the local store address of the initialization function crt0. runflags - A bit mask that can be used to request certain specific behavior for the execution of the SPE context. 0 indicates default behavior. argp - An (optional) pointer to application specific data, and is passed as the second parameter to the SPE program, envp - An (optional) pointer to environment specific data, and is passed as the third parameter to the SPE program, stopinfo An (optional) pointer to a structure of type spe_stop_info_t

Cell Programming Workshop

10/30/2015

20 spe_context_destroy

spe_context_destroy

spe_context_destroy - Destroy the specified SPE context. #include <libspe2.h> int spe_context_destroy (spe_context_ptr_t spe) spe - Specifies the SPE context to be destroyed On success, 0 (zero) is returned, else -1 is returned

Cell Programming Workshop

10/30/2015

21 Hello World

Hello World

PPE and SPE Combined Structure

PPU Executable

SPU code Compiled with SPU specific toolchain Object is repackaged as PPC ELF object From this point forward normal PPU tools are used. PPU code Compiled with normal PPU toolchain Objects are linked to form a combined executable. At runtime, kernel extensions and SDK libraries are used to move the SPU code to an SPU and start the SPU thread.

PPU code (hello.o)

SPU code (hello_spu.o)

Cell Programming Workshop

10/30/2015

22 Hello World

Hello World

Synergistic PPE and SPE (SPE Embedded)

SPU program Same as for SPE only SPU Makefile

PROGRAM_spu := hello_spu LIBRARY_embed := hello_spu.a include $(CELL_TOP)/buildutils/make.footer

Cell Programming Workshop

10/30/2015

23 Hello World

Hello World

PPU program

DIRS = spu PROGRAM_ppu = hello_be1 IMPORTS = spu/hello_spu.a lspe2 -lpthread include $(CELL_TOP)/buildutils/make.footer

// Load an SPE executable object into the SPE context local store if (spe_program_load(speid, &hello_spu)) { perror("spe_program_load"); return -3; } // Run the SPE context rc = spe_context_run(speid, &entry, 0, argp, envp, &stop_info); if (rc < 0) perror("spe_context_run"); // Destroy the SPE context spe_context_destroy(speid); return 0; }

#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <libspe2.h> extern spe_program_handle_t hello_spu; int main(void) { spe_context_ptr_t speid; unsigned int flags = 0; unsigned int entry = SPE_DEFAULT_ENTRY; void * argp = NULL; void * envp = NULL; spe_stop_info_t stop_info; int rc; // Create an SPE context speid = spe_context_create(flags, NULL); if (speid == NULL) { perror("spe_context_create"); return -2; }

PPU Makefile

Cell Programming Workshop

10/30/2015

24 The IBM Full System Simulator  An Overview

The IBM Full System Simulator An Overview

Cell Programming Workshop

10/30/2015

25 Simulator Overview

Simulator Overview

PowerPC

PowerPC

PowerPC

BE

Traces

SystemSim

Console Window

GUI Windows

Linux (Fedora Core 5)

PowerPC

Intel x86

x86-64

Application Source Code

Programming Tools

Development Environment:

Programming Model

OpenMP

MPI

Compilers

Executables

Software Stack: Running on SystemSim

Runtime and libraries

System Software: Hypervisor, Linux/PPC or K42

SystemSim: Simulation of hardware

Real Systems:

ROM

Disks

DMA

UART

Caches (L1/L2)

Int Ctrlr

Memory

Bus

L3

Cell Programming Workshop

10/30/2015

26 SystemSim Runtime Environment

SystemSim Runtime Environment

TCL/Tk/BLT GUI Scripts

1

5

4

2

SystemSim

3

Kernel Boot Image (vmlinux)

Disk Image (sysroot_disk)

Network Service Daemon

ROM Image (rom.bin)

tcl/tk/blt/mambo cmds

cpu model

net model

memory

console

ROM

disk model

mysim (cell model)

Cell Programming Workshop

10/30/2015

unix $ PATH=/opt/IBM/systemsim-cell/bin:$PATH systemsim -g GUI Enabled Licensed Materials Property of IBM. Copyright IBM Corporation 2001, 2006 All Rights Reserved %

27 SystemSim User Interface

SystemSim User Interface

Graphical interface Provides a visual display of the state of the simulated system, including the PPE and the eight (or 16) SPEs Includes dialogs to view the contents of the registers, memory, and channels, and other architectural structures Based on Tcl/Tk Layered on top of the command line interface Command line Uses Tcl (Tool Control Language) as the base command interpreter All the standard Tcl commands are available SystemSim commands to configure and create simulated machines Commands (e.g. mysim) to control a specific simulated machine

Cell Programming Workshop

10/30/2015

28 Operating-System Modes

Operating-System Modes

Linux Mode Simulator boots a full Linux operating system on the simulated system Applications are launched from the Linux console window and run The simulated operating system handles all the system calls Standalone Mode The application is loaded directly into the simulated machine without an operating system The simulator traps all system calls made by the application and performs these functions in place of the operating system Some restrictions apply, such as The application must be statically linked with any libraries it needs No virtual memory support is provided Only a subset of system calls are supported

Cell Programming Workshop

10/30/2015

29 Simulator Structure and Windows

Simulator Structure and Windows

Command Window

GUI Window

Console Window

Linux on Simulated Machine

Simulated System

Cell Simulated Machine

IBM Full System Simulator

Simulator

Linux Operating System

Base Simulator Hosting Environment

Base processor

systemsim%

[user@bringup /]#

Cell Programming Workshop

10/30/2015

30 Interacting with the Simulator

Interacting with the Simulator

Issuing commands to the simulator in the simulator command window, or using the equivalent actions in the graphical user interface (GUI). To control the simulator itself, configuring it to do such tasks as collect and display performance statistics on particular SPEs, or set breakpoints in code. Issuing commands to the simulated system in the console window which is a Linux shell of the simulated Linux operating system. The simulated system is the Linux environment on top of the simulated cell, where you run and debug programs.

Cell Programming Workshop

10/30/2015

31 Starting the Simulator in GUI Interface

Starting the Simulator in GUI Interface

The simulator is invoked with the systemsim command systemsim g Note: add /opt/ibm/systemsim-cell/bin to your path Specify the initial run script using f if configuration is needed file should be in the current directory or path qualified This configures the simulated machine and prepares it for execution The default is .systemsim.tcl Samples are provided in the simulator run directory Linux mode: /opt/ibm/systemsim-cell/run/cell/linux/systemsim.tcl Other systemsim options -n : do not open a console window -q : suppress periodic run statistics messages -g : enable the graphical interface Starting the simulator in GUI mode with two Cell BE (SMP configuration) systemsim g f config_smp.tcl Another way to start the simulator # cd /opt/ibm/systemsim-cell/run/cell/linux #../run_gui

Cell Programming Workshop

10/30/2015

32 SystemSim Cell GUI main panel

SystemSim Cell GUI main panel

Cell Programming Workshop

10/30/2015

33 Basic Simulator operations

Basic Simulator operations

Cell Programming Workshop

10/30/2015

34 The PPE

The PPE

Cell Programming Workshop

10/30/2015

35 The PPE

The PPE

Cell Programming Workshop

10/30/2015

36 The SPU

The SPU

Cell Programming Workshop

10/30/2015

37 Simulator Modes  fast, simple, and cycle

Simulator Modes fast, simple, and cycle

The default simulation mode when the simulator starts is simple, or functional-only, simulation In this mode, the time / cycles to execute an application is NOT a meaningful indicator of execution time on real hardware To get meaningful performance results: Select Cycle mode on the GUI Enter mysim mode cycle in the command window This will make the simulator run slower Depending on the workload, simulation time could increase by 10x to 100x But you can switch between modes as needed, so you can limit this overhead to just the relevant portions of the simulation

Cell Programming Workshop

10/30/2015

38 How to Exchange Files between Host and Simulator

How to Exchange Files between Host and Simulator

callthru A command issued from a simulated windows (from the simulator) backdoor communication mechanism for the simulated environment to communicate with the host environment Useful for bringing in files to the simulated environment without shutting down and restarting the simulator Example: (binary host ? simulator) callthru source /opt/cell_class/Hands-on-30/hello/hello_ppu/hello_ppu > hello_ppu chmod 755 hello_ppu ./hello_ppu Example (result file simulator ? host) callthru sink /home/systemsim-cell/results/result_file < cat result_file exporting result files out of the simulated environment for later inspection

Cell Programming Workshop

10/30/2015

39 Execute Binary

Execute Binary

From the simulated windows, bring executable into the simulator by using the callthru utility, e.g., callthru source /opt/cell_class/Hands-on-30/hello/hello_ppu/hello_ppu > hello_ppu Execute binary chmod 755 hello_ppu ./hello_ppu

Tip! Copy binary to /tmp/?<exe> on host to shorten the filename

Cell Programming Workshop

10/30/2015

40 Building three types of the hello world

Building three types of the hello world

program

Cell Programming Workshop

10/30/2015

41 Directory Structure

Directory Structure

/opt/cell_class/Hands-on-30/hello hello_ppu hello_spu hello_be1 synchronous spu thread (hello_be1-sync) spu hello_be1 asynchronous spu thread (hello_be1-async) spu

Cell Programming Workshop

10/30/2015

42 Hands-on Exercise

Hands-on Exercise

Need to compile (use make) and run the executables on the simulator

Create a directory hello_ppu, write a hello world ppu program and create a Makefile, then compile and execute it as a standalone ppu program Create a directory hello_spu, write a hello world spu program and create a Makefile, then compile and execute it as a standalone spu program Create a directory hello_be1, and write a ppu program that calls an spu program to write hello world in a synchronous manner. Create all ppu and spu makefiles. Compile and execute those programs to demonstrate the basic structure of a simple PPE-SPE software synergy model (PPE-single SPE model) Same as in 3. but with asynchronous thread Producing a simple multi-threaded hello world program See instructions in the next page

Cell Programming Workshop

10/30/2015

43 Hands-on  multi-threaded hello world

Hands-on multi-threaded hello world

To produce a simple program for the CBE, you should follow the steps listed below (this example is included in the SDK in /opt/cell/sdk/src/tutorial/simple). The project is called simple. For this example, the PPE code will be built in the project directory, instead of a ppu sub-directory. This program creates SPE threads that output Hello Cell (#)\n to the systemsim output window, where # is the spe_id of the SPE thread that issued the print. 1. Create a directory named simple. 2. In directory simple, create a file named Makefile using the following code: ######################################################################## # Subdirectories ######################################################################## DIRS := spu ######################################################################## # Target ######################################################################## PROGRAM_ppu := simple ######################################################################## # Local Defines ########################################################################

Cell Programming Workshop

10/30/2015

44 Hands-on  multi-threaded hello world (contd)

Hands-on multi-threaded hello world (contd)

IMPORTS := spu/lib_simple_spu.a -lspe2 -lpthread # imports the embedded simple_spu library # allows consolidation of spu program into ppe binary ######################################################################## # make.footer ######################################################################## # make.footer is in the top of the SDK ifdef CELL_TOP include $(CELL_TOP)/buildutils/make.footer else include ../../../../buildutils/make.footer Endif 3. In directory simple, create a file simple.c using the following code: #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <libspe2.h> #include <pthread.h>

Cell Programming Workshop

10/30/2015

45 Hands-on  multi-threaded hello world (contd)

Hands-on multi-threaded hello world (contd)

extern spe_program_handle_t simple_spu; #define MAX_SPU_THREADS 16 void *ppu_pthread_function(void *arg) { spe_context_ptr_t ctx; unsigned int entry = SPE_DEFAULT_ENTRY; ctx = *((spe_context_ptr_t *)arg); if (spe_context_run(ctx,&entry, 0, NULL, NULL, NULL) < 0) { perror ("Failed running context"); exit (1); } pthread_exit(NULL); } int main() { int i,spu_threads; spe_context_ptr_t ctxs[MAX_SPU_THREADS]; pthread_t threads[MAX_SPU_THREADS];

Cell Programming Workshop

10/30/2015

46 Hands-on  multi-threaded hello world (contd)

Hands-on multi-threaded hello world (contd)

/* Determine the number of SPE threads to create */ spu_threads = spe_cpu_info_get(SPE_COUNT_USABLE_SPES, -1); if (spu_threads > MAX_SPU_THREADS) spu_threads = MAX_SPU_THREADS; /* Create several SPE-threads to execute simple_spu */ for(i=0; i<spu_threads; i++) { /* Create context */ if ((ctxs[i] = spe_context_create (0, NULL)) == NULL) { perror ("Failed creating context"); exit (1); } /* Load program into context */ if (spe_program_load (ctxs[i],&simple_spu)) { perror ("Failed loading program"); exit (1); } /* Create thread for each SPE context */ if (pthread_create (&threads[i], NULL,&ppu_pthread_function,&ctxs[i])) { perror ("Failed creating thread"); exit (1); }

Cell Programming Workshop

10/30/2015

47 Hands-on  multi-threaded hello world (contd)

Hands-on multi-threaded hello world (contd)

/* Wait for SPU-thread to complete execution. */ for (i=0; i<spu_threads; i++) { if (pthread_join (threads[i], NULL)) { perror("Failed pthread_join"); exit (1); } } printf("\nThe program has successfully executed.\n"); return (0); } 4. Create a directory named spu.

Cell Programming Workshop

10/30/2015

48 Hands-on  multi-threaded hello world (contd)

Hands-on multi-threaded hello world (contd)

5. In the directory spu, create a file named Makefile using the following code: ####################################################################### # Target ######################################################################## PROGRAMS_spu := simple_spu # created embedded library LIBRARY_embed := lib_simple_spu.a ######################################################################## # make.footer ######################################################################## # make.footer is in the top of the SDK ifdef CELL_TOP include $(CELL_TOP)/buildutils/make.footer else include ../../../../../buildutils/make.footer endif

Cell Programming Workshop

10/30/2015

49 Hands-on  multi-threaded hello world (contd)

Hands-on multi-threaded hello world (contd)

6. In the same directory, create a file simple_spu.c using the following code: #include <stdio.h> int main(unsigned long long id) { /* The first parameter of an spu program will always be the spe_id of the spe * thread that issued it. */ printf("Hello Cell (0x%llx)\n", id); return 0; } 7. Compile the program by entering the following command at the command line while in the simple directory: make

Cell Programming Workshop

10/30/2015

50 Summary

Summary

Compile and execute different types of cell programs on the simulator Understand the basic differences between a ppu, spu, and BE program Understand the embedded concept of a cellBE program Understand the build process Understand the contents of different Makefile Understand the basic operations of the simulator

Cell Programming Workshop

10/30/2015

51 Special Notices -- Trademarks

Special Notices -- Trademarks

This document was developed for IBM offerings in the United States as of the date of publication. IBM may not make these offerings available in other countries, and the information is subject to change without notice. Consult your local IBM business contact for information on the IBM offerings available in your area. In no event will IBM be liable for damages arising directly or indirectly from any use of the information contained in this document. Information in this document concerning non-IBM products was obtained from the suppliers of these products or other public sources. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM may have patents or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents. Send license inquires, in writing, to IBM Director of Licensing, IBM Corporation, New Castle Drive, Armonk, NY 10504-1785 USA. All statements regarding IBM future direction and intent are subject to change or withdrawal without notice, and represent goals and objectives only. The information contained in this document has not been submitted to any formal IBM test and is provided "AS IS" with no warranties or guarantees either expressed or implied. All examples cited or described in this document are presented as illustrations of the manner in which some IBM products can be used and the results that may be achieved. Actual environmental costs and performance characteristics will vary depending on individual client configurations and conditions. IBM Global Financing offerings are provided through IBM Credit Corporation in the United States and other IBM subsidiaries and divisions worldwide to qualified commercial and government clients. Rates are based on a client's credit rating, financing terms, offering type, equipment type and options, and may vary by country. Other restrictions may apply. Rates and offerings are subject to change, extension or withdrawal without notice. IBM is not responsible for printing errors in this document that result in pricing or information inaccuracies. All prices shown are IBM's United States suggested list prices and are subject to change without notice; reseller prices may vary. IBM hardware products are manufactured from new parts, or new and serviceable used parts. Regardless, our warranty terms apply. Many of the features described in this document are operating system dependent and may not be available on Linux. For more information, please check: http://www.ibm.com/systems/p/software/whitepapers/linux_overview.html Any performance data contained in this document was determined in a controlled environment. Actual results may vary significantly and are dependent on many factors including system hardware configuration and software design and configuration. Some measurements quoted in this document may have been made on development-level systems. There is no guarantee these measurements will be the same on generally-available systems. Some measurements quoted in this document may have been estimated through extrapolation. Users of this document should verify the applicable data for their specific environment.

Revised January 19, 2006

Cell Programming Workshop

10/30/2015

52 Special Notices (Cont

Special Notices (Cont

) -- Trademarks

The following terms are trademarks of International Business Machines Corporation in the United States and/or other countries: alphaWorks, BladeCenter, Blue Gene, ClusterProven, developerWorks, e business(logo), e(logo)business, e(logo)server, IBM, IBM(logo), ibm.com, IBM Business Partner (logo), IntelliStation, MediaStreamer, Micro Channel, NUMA-Q, PartnerWorld, PowerPC, PowerPC(logo), pSeries, TotalStorage, xSeries; Advanced Micro-Partitioning, eServer, Micro-Partitioning, NUMACenter, On Demand Business logo, OpenPower, POWER, Power Architecture, Power Everywhere, Power Family, Power PC, PowerPC Architecture, POWER5, POWER5+, POWER6, POWER6+, Redbooks, System p, System p5, System Storage, VideoCharger, Virtualization Engine. A full list of U.S. trademarks owned by IBM may be found at: http://www.ibm.com/legal/copytrade.shtml. Cell Broadband Engine and Cell Broadband Engine Architecture are trademarks of Sony Computer Entertainment, Inc. in the United States, other countries, or both. Rambus is a registered trademark of Rambus, Inc. XDR and FlexIO are trademarks of Rambus, Inc. UNIX is a registered trademark in the United States, other countries or both. Linux is a trademark of Linus Torvalds in the United States, other countries or both. Fedora is a trademark of Redhat, Inc. Microsoft, Windows, Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries or both. Intel, Intel Xeon, Itanium and Pentium are trademarks or registered trademarks of Intel Corporation in the United States and/or other countries. AMD Opteron is a trademark of Advanced Micro Devices, Inc. Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States and/or other countries. TPC-C and TPC-H are trademarks of the Transaction Performance Processing Council (TPPC). SPECint, SPECfp, SPECjbb, SPECweb, SPECjAppServer, SPEC OMP, SPECviewperf, SPECapc, SPEChpc, SPECjvm, SPECmail, SPECimap and SPECsfs are trademarks of the Standard Performance Evaluation Corp (SPEC). AltiVec is a trademark of Freescale Semiconductor, Inc. PCI-X and PCI Express are registered trademarks of PCI SIG. InfiniBand is a trademark the InfiniBand Trade Association Other company, product and service names may be trademarks or service marks of others.

Revised July 23, 2006

Cell Programming Workshop

10/30/2015

53 Special Notices - Copyrights

Special Notices - Copyrights

(c) Copyright International Business Machines Corporation 2005. All Rights Reserved. Printed in the United Sates September 2005. The following are trademarks of International Business Machines Corporation in the United States, or other countries, or both. IBM IBM Logo Power Architecture Other company, product and service names may be trademarks or service marks of others. All information contained in this document is subject to change without notice. The products described in this document are NOT intended for use in applications such as implantation, life support, or other hazardous uses where malfunction could result in death, bodily injury, or catastrophic property damage. The information contained in this document does not affect or change IBM product specifications or warranties. Nothing in this document shall operate as an express or implied license or indemnity under the intellectual property rights of IBM or third parties. All information contained in this document was obtained in specific environments, and is presented as an illustration. The results obtained in other operating environments may vary. While the information contained herein is believed to be accurate, such information is preliminary, and should not be relied upon for accuracy or completeness, and no representations or warranties of accuracy or completeness are made. THE INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED ON AN "AS IS" BASIS. In no event will IBM be liable for damages arising directly or indirectly from any use of the information contained in this document. IBM Microelectronics Division The IBM home page is http://www.ibm.com 1580 Route 52, Bldg. 504 The IBM Microelectronics Division home page is Hopewell Junction, NY 12533-6351 http://www.chips.ibm.com

Cell Programming Workshop

10/30/2015

Hands-on The Hello World
http://900igr.net/prezentacija/anglijskij-jazyk/hands-on-the-hello-world-165061.html
c

46

29
900igr.net > > > Hands-on The Hello World