IBM Systems & Technology Group Cell/Quasar Ecosystem & Solutions Enablement Cell BE Software Development Kit 2.0 Cell Programming Workshop Cell/Quasar Ecosystem & Solutions Enablement 1 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Workshop Objectives At the end of this workshop you should know – The Cell Broadband Engine™ (Cell BE) Software Development Kit 2.0 Trademarks - Cell Broadband Engine and Cell Broadband Engine Architecture are trademarks of Sony Computer Entertainment, Inc. 2 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Workshop Agenda Cell BE SDK overview New in Cell SDK 2.0 Supported platforms and languages GNU tool chain Cell SDK 2.0 Documentation How to get Cell SDK 2.0 Getting Support Makefile How to install and build Cell SDK 2.0 How to install Cell IDE 3 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Cell BE Software Development Kit Overview 4 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Cell BE Software Development Kit Allows the development of Cell BE applications on the following hosting platforms – x86, x86-64, 64-bit PowerPC (PPC64) and Cell BE-based BladeCenter Contains – development tool chains including both PPU and SPU compilers for all supported platforms – software libraries and sample source – a system simulator – a Linux kernel Distributed as RPM packages – IBM alphaWorks website: Full-System Simulator, XL C/C++ compiler, libraries and samples, SPU timing tool, FDPR-Pro performance-tuning utility, the Eclipse Integrated Development Environment (IDE) for Cell BE, and the cellsdk installation script. • Note: Download the CellSDK20.iso image to retrieve the SDK package including documentation from related web sites via the cellsdk script. – Barcelona supercomputing center: open source packages – the GCC-based tool chain, the Linux kernel and support libraries, and system support for the Cell BE Full System Simulator. 5 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement New in SDK 2.0 Upgraded Linux kernel to 2.6.18, added performance enhancements Upgraded GNU GCC tools to version 4.1 and XLC Compiler to version 8.1. Improved SPU debugger and added support for a combined Power Processing Unit (PPU) and Synergistic Processing Unit (SPU) debugger. Added programming model frameworks including SPU code overlays, an accelerator framework for offloading work to SPUs, and software managed cache. Added SIMD math library for PPU and SPU, revamped LibC library for SPU, and added MASS/V libraries for PPU. Added support for performance modeling of memory subsystem components and interactions. Added Cell BE-specific post-link code optimization tool (FDPR-Pro). Added Eclipse Integrated Development Environment (IDE) support for building, compiling and debugging Cell BE applications. The Cell BE IDE uses the underlying SDK tools including compilers, debugger and system simulator. 6 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Supported platforms Target Hosting Platform x86 x86-64 64-bit PowerPC (PPC64) BladeCenter QS20 How to use the SDK on non-native platform The SDK includes both PPU and SPU compilers for all the supported platforms. A Cell BE application can run either natively on a BladeCenter QS20 or in the IBM Full-System Simulator, which is supported on all of the host platforms. The Full-System Simulator is useful for debugging or verifying a problem with applications that you plan to run on the BladeCenter QS20. Suggested Approach Build an application on an x86 system, test it under the Full-System Simulator on that system, and then later run the same binary natively on a BladeCenter QS20. 7 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Supported languages C/C++ Assembler Note: Although C++ is supported, take care when you write code for the SPUs because many of the C++ libraries are too large for the memory available. 8 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement GNU tool chain Contains the GCC compiler for the PPU and the SPU. – ppu-gcc, ppu-g++, ppu32-gcc, ppu32-g++, spu-gcc, spu-g++ – For the PPU, GCC replaces the native GCC on PPC platforms and it is a cross-compiler on x86. The GCC for the PPU is preferred and the makefiles are configured to use it when building the libraries and samples. – For the SPU, GCC contains a separate SPE cross-compiler that supports the standards defined in the following documents: • C/C++ Language Extensions for Cell BE Architecture V2.2.1 • SPU Application Binary Interface (ABI) Specification V1.5.1 • SPU Instruction Set Architecture V1.11 The assembler and linker are common to both the GCC and XL C/C++ compilers. – ppu-ld, ppu-as, spu-ld, spu-as – The GCC associated assembler and linker additionally support the SPU Assembly Language Specification V1.4. 9 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement GNU tool chain (Cont’d) GDB support is provided for both PPU and SPU debugging, and the debugger client can be in the same process or a remote process. GDB also supports combined (PPU and SPU) debugging. – ppu-gdb, ppu-gdbserver, ppu32-gdbserver On a x86 or x86_64 system, the install directory for the GNU tool chain is /opt/ibm/toolchain-3.3/. On a PPC64 or QS20, tool chain is installed into /usr. 10 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement IBM XL C/C++ compiler A cross-compiler hosted on a x86 and PPC platform. Requires the GCC Tool chain for cross-assembling and cross-linking applications for both the PPE and SPE. Supports the latest ISO C 1999 (International Standard ISO/IEC 9899:1999) standard, also known as C99, and the C89 Standard and K&R style. The XL C/C++ compiler provides the following invocation commands: – ppuxlc, ppuxlc++ – spuxlc, spuxlc++ The XL C/C++ compiler includes the following base optimization levels: – -O0: almost no optimization – -O2: strong, low-level optimization that benefits most programs – -O3: intense, low-level optimization analysis with basic loop optimization – -O4: all of -O3 and detailed loop analysis and good whole-program analysis at link time – -O5: all of -O4 and detailed whole-program analysis at link time. Installed into the /opt/ibmcmp directory 11 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement IBM Full-System Simulator Emulates the behavior of a full system that contains a Cell BE processor. Can start Linux on the simulator and run applications on the simulated operating system. Supports the loading and running of statically-linked executable programs and standalone tests without an underlying operating system. Simulation models – Functional-only simulation: Models the program-visible effects of instructions without modeling the time it takes to run these instructions. • For code development and debugging. – Performance simulation: Models internal policies and mechanisms for system components, such as arbiters, queues, and pipelines. Operation latencies are modeled dynamically to account for both processing time and resource constraints. • For system and application performance analysis. Installed into the /opt/ibm/systemsim-cell directory 12 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Linux kernel Patches made to Linux 2.6.18 kernel to provide services required to support the Cell BE hardware facilities Patches distributed by Barcelona Supercomputer Center – http://www.bsc.es/projects/deepcomputing/linuxoncell For the QS20, – the kernel is installed into the /boot directory – yaboot.conf is modified – needs reboot to activate this kernel 13 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Cell BE libraries 14 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SPE Runtime Management Library Version 1.2 (libspe) Provides an SPE thread programming model for Cell BE applications. The elfspe is a PPE program that allows an SPE program to run directly from a Linux command prompt without needing a PPE application to create an SPE thread and wait for it to complete. For the QS20 – the SDK installs the libspe headers, libraries, and binaries into the /usr directory – the standalone SPE executive, elfspe, is registered with the kernel during boot by commands added to /etc/rc.d/init.d using the binfmt_misc facility For the simulator – the libspe and elfspe binaries and libraries are preinstalled in the same directories in the system root image and no further action is required at install time. The source for the SPE runtime management library is distributed under the GPL license and available on the BSC Web site – http://www.bsc.es/projects/deepcomputing/linuxoncell 15 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SIMD math library Provides vector versions of a subset of the traditional math functions and conform as closely as possible to the specifications set out by the scalar standards. Deviations exist since there are fundamental differences between scalar architectures and the Cell BE Architecture – handling of rounding – error conditions – floating-point exceptions – and special operands, such as NaN and infinities Available as both a linkable library archive and as a set of inlinable headers. Names of SIMD math functions are differentiated from scalar counterparts by a vector type suffix that is appended to the standard scalar function name. – For example, the SIMD version of fabsf(), which acts on a vector float, is called fabsf4(). Similarly, a SIMD version of a standard scalar function that acts on a vector double has d2 appended to the name. – Inlinable versions of functions are prefixed with the character “_” (underscore), so the inlinable version of fabsf4() is called _fabsf4(). 16 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Mathematical Acceleration Subsystem (MASS) library Libraries of mathematical intrinsic functions tuned specifically for optimum performance on the Cell BE processor. Currently only 32-bit and 64-bit PPU libraries are supported. These libraries – Include both scalar and vector functions – Are thread-safe – Support both 32- and 64-bit compilations – Offer improved performance over the corresponding standard system library routines – Are intended for use in applications where slight differences in accuracy or handling of exceptional values can be tolerated For more information, – http://www.ibm.com/software/awdtools/mass 17 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Libraries and Samples 18 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Prototype libraries and samples package Fast Fourier Transform (FFT) Image processing Audio resample Software managed cache Game math Intrinsics Matrix operation Multi-precision math Noise generation Oscillator Surface Synchronization Vector Accelerated Library Framework (ALF) /opt/ibm/cell-sdk/prototype 19 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement src/samples Examples of Cell BE programming techniques. Typical examples – double-buffered DMA transfers to and from a program, – performing local operations on an SPU, – providing access to main memory objects to SPU programs, etc. Some subdirectories contain multiple programs. – The sync subdirectory has examples of various synchronization techniques, including mutex operations and atomic operations. – The spulet model shows testing and refinement of programs that need to be ported to the SPUs; and how to build filters that take advantage of the huge computational capacity of the SPUs, while reading and writing standard input and output. Other samples: – Overlay samples – SW managed cache samples – Tutorial code samples 20 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Other directories src/tests – Regression tests for the system src/tools – Development tools • Interface Definition Language (IDL) compiler • callthru program. src/workloads – Four sample programs showing how real-world code should run. • e.g., matrix_mul performs matrix multiplications on one or more SPUs. sysroot • Contains some of the headers and libraries used during cross-compiling and contains the compiled results of the libraries and samples. • Can be synched up with the system root image by using the command: – /opt/ibm/cell-sdk/prototype/cellsdk synch 21 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Performance support libraries and utilities 22 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Performance utilities NUMA Policy Control (numactl) – To control NUMA policy for processes or shared memory where an application can bind a region of virtual storage to a specific bank of memory as well as binding a process to a specific NUMA node. – Note: The FC 5 version of numactl does not work correctly with the Cell BE processor so the SDK installs numactl-0.9.8 for FC 6 on the QS20. SPU timing tool spu_timing – To annotate an SPU assembly file with scheduling, timing, and instruction issue estimates assuming straight, linear execution of the program. – located in the /opt/ibm/cell-sdk/prototype/bin directory. Feedback Directed Program Restructuring (FDPR-Pro) – To optimize program execution by collecting information about the program's behavior under a typical workload, and creating a new version of the program that is optimized for that workload. OProfile – To profile user and kernel level code – The current OProfile on SDK 2.0 supports profiling only the PPU events. 23 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement IBM Cell IDE 24 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Cell IDE Built upon the Eclipse SDK and C Development Tools (CDT) platform. Integrates the Cell BE GNU tool chain, compilers, the Full-System Simulator, and other development components – A C/C++ editor that supports syntax highlighting, a customizable template, and an outline window view for procedures, variables, declarations, and functions that appear in source code – A visual interface for the PPE and SPE GDB (GNU debugger) – Seamless integration of the simulator into Eclipse – Automatic builder, performance tools, and several other enhancements – Remote launching, running and debugging on a BladeCenter QS20 To create a Cell BE-specific project environment, you need to install Cell BE SDK 2.0, Eclipse 3.2, CDT 3.1.2, and Eclipse IDE plugins for Cell BE – http://alphaworks.ibm.com/tech/cellide 25 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 Support Useful websites: – dW: http://www-128.ibm.com/developerworks/power/cell/ – SDK: http://www.alphaworks.ibm.com/tech/cellsw – Simulator: http://www.alphaworks.ibm.com/tech/cellsystemsim – XLC/C++: http://www.alphaworks.ibm.com/tech/cellcompiler – BSC: http://www.bsc.es/projects/deepcomputing/linuxoncell/ – Techlib: http://www-306.ibm.com/chips/techlib/techlib.nsf/products/Cell_Broadband_Engine SDK 2.0 is provided on ASIS basis – Completely replaces prior SDKs – Support forum: • 26 http://www-128.ibm.com/developerworks/forums/dw_forum.jsp?forum=739&cat=28 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Cell SDK 2.0 Installation 27 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 platform requirements Hardware “official” requirements – For x86 machines: Minimum configuration: a 2-GHz Pentium 4 machine. – For PowerPC (PPC): 1.42GHz, 64-bit PowerPC – For Cell BE-based blade servers: • must be at revision 31 or above. • a minimum firmware level of FW6.14.7 (FW6.14.A is preferred). – At least 1GB RAM – At least 5GB disk space to install the source package and development tools Software “official” requirements – Fedora Core 5 • Must be installed before installation of the SDK – SDK 2.0 Installation Files – Network connectivity to download 2.6.18 kernel 28 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 FC5 dependencies byacc – The SDK uses Bison YACC. To verify if it is installed, run rpm –q byacc. The result should be similar to: • byacc-1.9-29.2.1 – To get the byacc package and its dependencies, you must do a yum install byacc. flex – The SDK uses flex. To verify if it is installed, run rpm –q flex. The result should be similar to: • flex-2.5.4a-41.fc5 – To get the flex package and its dependencies, you must do a yum install flex. gcc – The regular Fedora Core 5 gcc GNU compiler is used to build two samples that are run on the host machine rather than on a Cell BE Processor. To verify if it is installed, run rpm –q gcc. The result should be similar to: • gcc-4.1.1-1.fc5 – To get the gcc package and its dependencies, you must do a yum install gcc. 29 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 FC5 dependencies (Cont’d) make – Make is used to build the libraries and sample programs. To verify if it is installed, run rpm -q make. The result should be similar to: • make-3.80-10.2 – To get the make package, you must do a yum install make. The SDK makefiles have also been updated to work with the latest make-3.81. perl – Perl is required by several parts of the SDK. To verify if it is installed, run rpm –q perl. The result should be similar to: • perl-5.8.8-5 – To get the perl package, you must run yum install perl. freeglut – Two of the sample programs depend on OpenGL and require freeglut and freeglut-devel packages to compile and run successfully. To verify if it is installed, run rpm –qa | grep freeglut. The result should be similar to: • freeglt-2.4.0-4 • freeglut-devel-2.4.0-4 – To get the freeglut-devel package, you must run yum install freeglut-devel. 30 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 FC5 dependencies (Cont’d) rsync – rsync is used by the SDK install process. To verify if it is installed, run rpm –q rsync. The result should be similar to: • rsync-2.6.8-1.FC5.1 – To get the rsync package and its dependencies, you must do a yum install rsync. TK – The simulator requires libtk8.4.so. To verify if it is installed, run rpm –q tk. The result should be similar to: • tk-8.4.13-1.1 – If the tk-8.4 and tcl-8.4 packages are not installed you see the following message when you run the full system simulator: • systemsim-cell/run/cell/../../bin/systemsim-cell: error while loading • shared libraries: libtk8.4.so: cannot open shared object file: No such file or directory. – To get the tk (and tcl) package, run yum install tk. 31 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 FC5 dependencies (Cont’d) netpbm – The Julia set sample needs the netpbm and netpbm-devel packages on a native PowerPC 64-bit machine and BladeCenter QS20. To verify if installed do a rpm –qa | grep netpbm. The result should be similar to: • netpbm-devel-10.34-1.fc5 • netpbm-10.34-1.fc5 – If these packages are not installed, you must do a yum install netpbm. NUMA Policy Control (numactl) – Some of the samples need the numactl package but only for a native PowerPC 64-bit machine. This excludes a BladeCenter QS20 because the SDK installs a newer version of numactl. To verify if numactl is installed on a native PowerPC 64-bit machine, do a rpm –q numactl. The result should be similar to: • numactl-0.4.6-1.27 32 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 Installed Components 33 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 installation instructions Download the development kit's CellSDK20.iso from the IBM alphaWorks page. Create a mount directory, e.g., /mnt/cellsdk – mkdir –p /mnt/cellsdk Mount the disk image on the mount directory: – mount –o loop CellSDK20.iso /mnt/cellsdk Change directory (cd) to /mnt/cellsdk/software: – cd /mnt/cellsdk/software Install the SDK package by using the following command and answer any prompts: – ./cellsdk install Build the libraries and samples by using the following commands – ./cellsdk build [-g | -x ] or [--gcc | --xlc] Change directory to any directory which is not the mount directory or below it: – cd / Unmount the disk image – umount /mnt/cellsdk 34 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement RPMs in SDK 2.0 ./cellsdk verify – IBM Cell System Simulator: • systemsim-cell-2.0-12.i386 ... found – Cell System Simulator System Image: • sysroot_image-2.0-7.noarch ... found – GNU Compiler Toolchain: • • • • • • • • • • • 35 spu-newlib-3.3-72.i686 ... found spu-gcc-c++-3.3-72.i686 ... found spu-gcc-3.3-72.i686 ... found spu-binutils-3.3-72.i686 ... found spu-gdb-3.3-72.i686 ... found ppu-gcc-c++-3.3-72.i686 ... found ppu-gcc-3.3-72.i686 ... found ppu-gdb-3.3-72.i686 ... found ppu-binutils-3.3-72.i686 ... found ppu-sysroot-3.3-6.noarch ... found ppu-sysroot64-3.3-6.noarch ... found Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement RPMs in SDK 2.0 (Cont’d) ./cellsdk verify – IBM XL C/C++ Compilers: • xlc.lib-8.1.0-12.i386 ... found • • • • xlc.cmp-8.1.0-12.i386 ... found xlcpp.lib-8.1.0-12.i386 ... found xlcpp.cmp-8.1.0-12.i386 ... found xlcpp.help-8.1.0-12.i386 ... Found – IBM Cell Prototype Libraries and Samples: • • cell-sdk-lib-samples-2.0-5.noarch ... found cell-alf-2.0-3.noarch ... found – Cell Libraries: • • • • • • • • 36 libspe-1.2.0-0.ppc ... found libspe-devel-1.2.0-0.ppc ... found simdmath-2.0-6.ppc ... found ppu-mass.lib-4.4.0-12.ppc ... found spu-simdmath-2.0-6.ppc ... found libspe-1.2.0-0.ppc64 ... found libspe-devel-1.2.0-0.ppc64 ... found ppu-mass.lib-4.4.0-12.ppc64 ... found Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement RPMs in SDK 2.0 (Cont’d) ./cellsdk verify – Cell Prototype Libraries: • libspe2-2.0.1-1.ppc ... found • • • libspe2-devel-2.0.1-1.ppc ... found libspe2-2.0.1-1.ppc64 ... found libspe2-devel-2.0.1-1.ppc64 ... found – IBM Cell SPU Timing Utility: • cell-spu-timing-2.0-3.i686 ... found INSTALLATION SUMMARY =========================================================== – – – – – – – – 37 IBM Cell System Simulator : Installed (1 of 1 found) Cell System Simulator System Image : Installed (1 of 1 found) GNU Compiler Toolchain : Installed (11 of 11 found) IBM XL C/C++ Compilers : Installed (5 of 5 found) IBM Cell Prototype Libraries and Samples: Installed (2 of 2 found) Cell Libraries : Installed (8 of 8 found) Cell Prototype Libraries : Installed (4 of 4 found) IBM Cell SPU Timing Utility : Installed (1 of 1 found) Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Upgrading SDK 1.1 or SDK 1.1.1 to SDK 2.0 SDK 2.0 automatically installs on top of SDK 1.1 or SDK 1.1.1 and replaces the RPMs installed by the previous SDK. However, /opt/IBM/cell-sdk-1.1 directory is kept intact. SDK 2.0 changes some of the standard install directories for the SDK 1.1 components so it may be necessary to manual remove these old directories. 38 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Uninstalling the SDK 2.0 To uninstall the SDK, run the following command as user root: – ./cellsdk uninstall Notes: – To ensure that the system is left in a usable state, the script does not uninstall the kernel on BladeCenter QS20s. You must change the yaboot configuration file (/etc/yaboot.conf) to load a different kernel at the next reboot and use the following command to uninstall the kernel: • rpm –e kernel-2.6.18-bsc4.2. – Do not delete SDK files or directories as this causes the RPM database to be out of sync. 39 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement cellsdk options cellsdk implements a number of tasks and options for those tasks. cellsdk without any parameters will display Usage: cellsdk <install|uninstall|depend|build|synch|verify|version> [OPTION...] – Task ’install’ and ’depend’ options: • -f, --force assume ’yes’ to all questions. • --nosim do not install the IBM Cell BE Full System Simulator • --nokernel do not install the Cell BE kernel (CBE hardware only) – Task ’uninstall’ options: • -f, --force assume ’yes’ to all questions. – Task ’build’ options: • -x, --xlc use XLC to compile the libraries and samples (x86 only) • -g, --gcc use GCC to compile the libraries and samples (default) 40 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Installing the Eclipse IDE for Cell BE Assume SDK 2.0 already installed Login as root Install Java 1.4 (IBM’s or Sun’s) - The default Java VM (GCJ) that comes installed with Fedora Core 5 is not sufficient. Make sure that your JAVA_HOME and your PATH are updated accordingly. – For example: JAVA_HOME=/usr/java/j2sdk1.4.2_13/jre and PATH=$PATH:$JAVA_HOME/bin – Install Eclipse 3.2. – Install CDT 3.1 plug-ins. – Install the Eclipse IDE for Cell BE plug-ins using the update manager: • In Eclipse, click Help => Software Updates => Find and Install... • Select Search for new features to install, click Next. • Click New Local Site... • Go to /opt/cellsdk/IDE/com.ibm.celldt.update, and click OK. • Click Finish and follow the on-screen instructions. 41 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement SDK 2.0 Makefile 42 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Compiling within the SDK Top of build environment is /opt/ibm/cell-sdk/prototype 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 43 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Compiler Defaults to gcc Set in make.env with three variables set to gcc or xlc – PPU32_COMPILER – PPU64_COMPILER – PPU_COMPILER [overrides PPU32_COMPILER and PPU64_COMPILER] – SPU_COMPILER Can change default compiler with ‘cellsdk build’ command – cellsdk build --xlc – cellsdk build --gcc Can change from the command line – PPU_COMPILER=xlc SPU_COMPILER=xlc make – make -e PPU64_COMPILER:=gcc -e PPU32_COMPILER:=gcc -e SPU_COMPILER:=gcc – export PPU_COMPILER=xlc SPU_COMPILER=xlc ; make 44 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Create a personal build tree To build as non-root or create a sandbox for testing Easiest is to copy entire tree cp –R /opt/ibm ~/sandbox export CELL_TOP=~/sandbox/ibm/cell-sdk/prototype Building in an incomplete tree as non-root is more difficult – By default, will try to put binaries in /opt/ibm – Run “make listenv” to see variables that need to be overridden – For example: SDKBIN = /opt/ibm/cell-sdk/prototype/host/bin Use CELL_TOP or maintain relative directory structure ifdef CELL_TOP include $(CELL_TOP)/make.footer else include ../../../make.footer endif 45 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement 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. 46 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Makefiles for sample project sample.h sample/ Makefile DIRS := spu ppu include $(CELL_TOP)/make.footer sample/spu/ sample_spu.c Makefile PROGRAM_spu := sample_spu LIBRARY_embed := lib_sample_spu.a INCLUDE = -I .. include $(CELL_TOP)/make.footer sample/ppu/ sample.c Makefile PROGRAM_ppu := sample IMPORTS := ../spu/lib_sample_spu.a INCLUDE = -I .. include $(CELL_TOP)/make.footer 47 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Hands-on Installation 48 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Hands-on – Install SDK 2.0 Will install to an FC5 environment provided in the VMware virtual machine Assume FC5 already installed Assume the DVD workshop disk has a SDK20 directory which contains all rpms Login as root Load the DVD workshop disk – mount /dev/cdrom /mnt/cdrom – cd /mnt/cdrom – ./cellsdk install (will take about 2-3 mins) – ./cellsdk build [-g | -x ] (will take about 10-15 mins) – umount /mnt/cdrom 49 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Hands-on – Install Cell IDE Assume FC5 already installed Login as root Assume java already installed. “java –version” shows the following – java version "1.4.2" – gij (GNU libgcj) version 4.1.0 20060304 (Red Hat 4.1.0-3) – Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. cd /opt/IDE – Copy all 3 files to /opt/IDE from the DVD workshop disk • eclipse-SDK-3.2-linux-gtk.tar.gz • org.eclipse.cdt-3.1.0-linux.x86.tar.gz • com.ibm.celldt.update.tar.gz – Install Eclipse 3.2 • tar xvfz eclipse-SDK-3.2-linux-gtk.tar.gz – Install CDT 3.1 plug-ins • tar xvfz org.eclipse.cdt-3.1.0-linux.x86.tar.gz 50 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement Hands-on – Install Cell IDE (Cont’d) Start Eclipse – cd /opt/IDE/eclipse – ./eclipse Install Cell IDE plug-ins – In Eclipse, click Help => Software Updates => Find and Install... – Select Search for new features to install, click Next. – Click New Local Site... – Go to /opt/IDE/com.ibm.celldt.update, and click OK. – Click Finish and follow the on-screen instructions. IDE verification for successful installation – Eclipse => Help => Software Updates => Manage Configuration => Eclipse SDK => /opt/IDE/eclipse • Eclipse C/C++ Development Tools 3.1.0.200606261600 • Eclipse Project SDK 3.2.0.v20060609m-GNq6oQq-7es-Y81 • IDE for Cell Broadband Engine SDK 2.0.0.I2006112901 51 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement 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 generallyavailable 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 52 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement 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 MicroPartitioning, 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 53 Cell Programming Workshop 6/21/2016 © 2007 IBM Corporation IBM Systems & Technology Group – Cell/Quasar Ecosystem & Solutions Enablement 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 1580 Route 52, Bldg. 504 Hopewell Junction, NY 12533-6351 54 Cell Programming Workshop The IBM home page is http://www.ibm.com The IBM Microelectronics Division home page is http://www.chips.ibm.com 6/21/2016 © 2007 IBM Corporation