Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

An introduction to the IDE for the Cell Broadband Engine SDK

Building a sample project with the Eclipse-based Cell BE development environment

Sean Curry (seancurry.ut@gmail.com), Software Engineer, IBM
Sean is an undergraduate student at The University of Texas at Austin, working toward a degree in Computer Sciences. As an intern at the IBM Linux Technology Center, Sean works as part of the Linux on Cell/B.E. team, specifically contributing to the IDE for Cell Broadband Engine SDK project. Sean develops source code and conducts integration testing and product release management.

Summary:  This introductory tutorial, updated for the Cell Broadband Engine™ (Cell BE) SDK V2.1, explores the Interactive Development Environment (IDE) of the Cell BE processor and gives developers a click-for-click walk-through of building a simple project in this environment.

Date:  30 Mar 2007 (Published 02 Nov 2006)
Level:  Introductory PDF:  A4 and Letter (5031 KB | 67 pages)Get Adobe® Reader®

Activity:  16224 views
Comments:  

Creating the PPU source file

Create another source file

Right click on the PPU project, and select File > New > Source File.


Figure 29. Create another source file
Screenshot  showing Create another source file

New source file

For the Source File field, type ppu.c. Click Finish.


Figure 30. New source file
Screenshot  showing New source file

Edit the source code file

The PPU program is much more complicated than the SPU program. It creates a number of SPU threads, each of which is launched using the embedded SPU binary (now seen as spe_program_handle_t SPU).

Copy and paste the following source code into your editor, and then save it:

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <libspe.h>

extern spe_program_handle_t SPU;

#define SPU_THREADS  8

int main(int argc, char **argv) {
    speid_t spe_ids[SPU_THREADS];
    int i,  status = 0;

    /* Create several SPE-threads to execute 'SPU'.  */
    for(i=0; i < SPU_THREADS; i++) {
      spe_ids[i] = spe_create_thread(0, &SPU, NULL, NULL, -1, 0);
      if (spe_ids[i] == 0) {
	fprintf(stderr, "Failed spu_create_thread(rc=%d, errno=%d)\n",
		spe_ids[i], errno); exit(1); } }

    /* Wait for SPU-thread to complete execution.  */
    for (i=0; i < SPU_THREADS; i++) {
      (void)spe_wait(spe_ids[i], &status, 0); }

    printf("nThe program has successfully executed.\n");

    return (0);
}



Figure 31. Edit the source code file
Screenshot  showing Edit the source code file

5 of 11 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Multicore acceleration
ArticleID=172531
TutorialTitle=An introduction to the IDE for the Cell Broadband Engine SDK
publish-date=03302007
author1-email=seancurry.ut@gmail.com
author1-email-cc=dwpower@us.ibm.com