Cell Programming Workshop Cell/Quasar Ecosystem & Solutions Enablement

Slides:



Advertisements
Similar presentations
Copyright 2009 SAP All rights reserved
Advertisements

IBM Systems & Technology Group Cell/Quasar Ecosystem & Solutions Enablement © 2007 IBM Corporation Cell Programming Workshop 5/9/ Hands-on DMA 1.
© 2010 IBM Corporation ® IBM Software Group Assistive Technology As applied to the workplace Niamh Foley.
© 2014 IBM Corporation IBM Tivoli Storage Manager Virtual Appliance Smarter Data Protection for Cloud Environments Cyrus Niltchian, Product Management.
© 2011 IBM Corporation All statements regarding IBM's future direction and intent are subject to change or withdrawal without notice, and represent goals.
® IBM Software Group © 2009 IBM Corporation Updated August 15, 2015 WebSphere Enterprise Service Bus WebSphere Integration Developer Mediation.
© 2009 IBM Corporation Ian Shave IBM Systems and Technology Group A New Era in Midrange Storage.
Sub-capacity License Counting Scenarios Sun Microsystems Virtualization NOTE: Review this presentation in conjunction with the most current Sub-capacity.
OpenCL Introduction A TECHNICAL REVIEW LU OCT
© 2014 IBM Corporation The insights to transform the business with speed and conviction Kevin Redmond Head of Information Management Central & Eastern.
© 2009 IBM Corporation IBM i October Announcements IBM Power Systems Craig Johnson Power Systems Software.
© 2011 IBM Corporation January 2011 Pam Denny, IBM V7 Reporting.
IBM Software Group AIM Core and Enterprise Solutions IBM z/Transaction Processing Facility Enterprise Edition Any references to future plans are.
© 2015 IBM Corporation Big Data Journey. © 2015 IBM Corporation 2.
IBM eServer iSeries © 2003 IBM Corporation ™™ iSeries Solutions for Business Continuity IBM eServerJ iSeriesJ © 2003 IBM Corporation.
® IBM Passport Advantage Software Sub-capacity License Counting Scenarios - System p and System i NOTE: Review this presentation in conjunction with the.
INTEL CONFIDENTIAL Intel® Smart Connect Technology Remote Wake with WakeMyPC November 2013 – Revision 1.2 CDI/IBP #:
I want stress-free IT. i want control. i want an i. IBM System i ™ Session: Secure Perspective Patrick Botz IBM Lab Services Security Architecture Consulting.
IBM Systems Group © 2004 IBM Corporationv 3.04 This presentation is intended for the education of IBM and Business Partner sales personnel. It should not.
IBM Innovate 2012 Title Presenter’s Name Presenter’s Title, Organization Presenter’s Address Session Track Number (if applicable)
IBM/SAP Competency Center November 11, 2008 © 2008 IBM Corporation SAP PSA Table Partitioning Mary Siart IBM STS - SAP on zSeries Technical Specialist.
Work smarter, keep connected with Lotus Software Jon Crouch | Senior Technical Specialist, Lotus Software Matt Newton | Senior Technical Specialist, Lotus.
PowerAI Scott Soutter Offering Manager: PowerAI and High Performance Data Analytics
Using Parallelspace TEAM Models to Design and Create Custom Profiles
NOTE: Review this presentation in conjunction with the most current
Virtualization Engine console Bridge Concepts
Virtualization Engine Console Usability Enhancements
IBM System z9 109 Availability Eye Opener
Cell Broadband Engine Programming Workshop Welcome Session
Parallelspace PowerPoint Template for ArchiMate® 2.1 version 1.1
Parallelspace PowerPoint Template for ArchiMate® 2.1 version 2.0
Developing Code for Cell – DMA & Mailbox
Cell BE Basic Programming Concepts
Cell Broadband Engine Programming Workshop Closing Session
Integrating Data With Cognos
Hands-on – The Hello World! Program
Go Off Grid ➔ Go Graph! Jason October 24, 2016
Developing Code for Cell - SIMD
Cell Programming Workshop Cell/Quasar Ecosystem & Solutions Enablement
Cell Broadband Engine – An Introduction
Hands-on - DMA Transfer Using get and put Buffer
IBM Global Technology Services
Hands-on – The Hello World! Program
Cell Programming Workshop Cell/Quasar Ecosystem & Solutions Enablement
Cell Programming Tips & Techniques
Global Technology Services
SPU Timing Tool – static timing analysis
Cell BE Basic Programming Concepts
Presentation transcript:

Cell Programming Workshop Cell/Quasar Ecosystem & Solutions Enablement Hands-on DMA Cell Programming Workshop Cell/Quasar Ecosystem & Solutions Enablement Cell Programming Workshop 11/24/2018

Workshop Objectives Key learning features: Basic SPU-PPU DMA and mailbox communication Trademarks - Cell Broadband Engine and Cell Broadband Engine Architecture are trademarks of Sony Computer Entertainment, Inc. Cell Programming Workshop 11/24/2018

Workshop agenda Example 1a - Develop a simple spu program to print hello world Example 1b - Adding to Example 1a by having the SPU create a buffer for a "hello" message that it will DMA in, modify, and DMA out Example 1c – Adding to Example 1b by having a PPU program to use control structure to pass a pointer of a buffer to an SPU and posting a message in a mailbox. The SPU receives the buffer, pass it to the next SPU, prints the buffer, and the last SPU sends a buffer back to the PPU for it to print. NOTES: Hands-on materials are in /opt/cell_class/Hands-on/DMA Cell Programming Workshop 11/24/2018

Hands-on DMA Example 1a - A simple hello world program Cell Programming Workshop 11/24/2018

Example 1a – code sample ppu program hello.c spu program hello_spu.c #include <stdio.h> #include <libspe.h> extern spe_program_handle_t hello_spu; int main (void) { speid_t speid; int status; speid = spe_create_thread (0, &hello_spu, NULL, NULL, -1, 0); spe_wait(speid, &status, 0); return 0; } #include <stdio.h> int main(unsigned long long speid, unsigned long long argp, unsigned long long envp) { int a=0; printf("Hello world (0x%llx),(0x%llx),(0x%llx)\n", speid, argp, envp); return a; } ppu Makefile spu Makefile DIRS = spu PROGRAM_ppu = hello IMPORTS = -lspe spu/hello_spu.a include $(CELL_TOP)/make.footer PROGRAM_spu := hello_spu LIBRARY_embed := hello_spu.a include $(CELL_TOP)/make.footer Cell Programming Workshop 11/24/2018

Hands-on DMA Example 1b - Develop an SPU program to create a buffer for a "hello" message that it will DMA in, modify, and DMA back to the PPU program Cell Programming Workshop 11/24/2018

Hands-on Exercise – Example 1b Adding to Example 1a … the following Develop a PPU program that Creates a buffer containing a character string “Good morning!” Creates an spu thread that contains the above buffer as one of its arguments Develop an SPU program that Creates a local buffer to contain the data to be dma’ed in Initiates a dma transfer to receive the buffer Modifies the buffer into “Guten Morgen!” Transfers the buffer back to the ppu Cell Programming Workshop 11/24/2018

ppu program spu program hello.c example1bspu.c ppu Makefile #include <stdio.h> #include <string.h> #include <libmisc.h> #include <spu_mfcio.h> #define wait_on_mask(x) mfc_write_tag_mask(x); mfc_read_tag_status_any(); int main(unsigned long long speid, unsigned long long argp, unsigned long long envp) { char * buffer; int tag = 1, tag_mask = 1<<tag; // we should probably check here to make sure envp/size is a valid DMA size but for the sake // of readability I'm going to assume it is.... printf("ARGP = 0x%llx, ENVP = %d\n", argp, envp); buffer = malloc_align(envp, 7); // receive buffer mfc_get(buffer, (unsigned int)argp, envp, tag, 0, 0); wait_on_mask(tag_mask); printf("SPE 0 received buffer \"%s\"\n", buffer); // modify buffer strcpy (buffer, "Guten Morgen!"); // DMA out buffer to SPE 1 mfc_put(buffer, (unsigned int)argp, envp, tag, 0, 0); return 0; } spu program example1bspu.c #include <stdio.h> #include <libspe.h> #include <libmisc.h> #include <string.h> extern spe_program_handle_t example1b_spu; int main (void) { speid_t speid; int status; char * buffer; buffer = malloc_align(128,7); strcpy (buffer, "Good morning!"); // create SPU threads speid = spe_create_thread (0, &example1b_spu, (void *)buffer, 128, -1, 0); spe_wait(speid, &status, 0); printf("New modified buffer is %s\n", buffer); return 0; } ppu Makefile spu Makefile DIRS = spu/example1b PROGRAM_ppu = hello_dma IMPORTS = -lspe -lmisc \ spu/example1b/example1b_spu.a include $(CELL_TOP)/make.footer PROGRAM_spu := example1b_spu LIBRARY_embed := example1b_spu.a IMPORTS = -lmisc include $(CELL_TOP)/make.footer Cell Programming Workshop 11/24/2018

Hands-on DMA Example 1c – Develop a PPU program to create 8 SPE threads, and to control the DMAs to the 8 SPEs using mailbox. Develop an SPU program to create a data buffer and a control structure cs, and send out the data buffer pointer to the PPU receive the PPU control structure pointer and DMA in cs receive buffer modify buffer DMA out buffer to next SPE The last SPE sends a buffer back to the PPU Cell Programming Workshop 11/24/2018

Hands-on Example 1c – ppu program hello_ppc.c common.h typedef struct { char * memory; int first; int last; void * lstore[8]; char padding[84]; } control_block; #include <stdio.h> #include <libspe.h> #include <libmisc.h> #include <string.h> #include "control.h" extern spe_program_handle_t hello_spu; char buffer[128] __attribute__ ((aligned(128))); #define ACTIVE_SPUS 8 int main() { speid_t speid[ACTIVE_SPUS]; int status[ACTIVE_SPUS]; int i; control_block * cb = malloc_align(128,7); cb->first = 0; cb->last = ACTIVE_SPUS - 1; cb->memory = buffer; strcpy (buffer, "Zao shang hao!"); for (i=0;i<ACTIVE_SPUS;i++){ speid[i] = spe_create_thread(0, &hello_spu, NULL, NULL, -1, 0); } cb->lstore[i] = spe_get_ls(speid[i]); while (!spe_stat_out_mbox(speid[i])) {} cb->lstore[i] += spe_read_out_mbox(speid[i]); for (i=0;i<ACTIVE_SPUS;i++) spe_write_in_mbox(speid[i],(unsigned int)cb); spe_write_in_mbox(speid[i],i); spe_wait(speid[i], &status[i], 0); printf("PPE says %s\n", buffer); return 0; Cell Programming Workshop 11/24/2018

Hands-on Example 1c – spu program /* Step 3 */ myId = spu_read_in_mbox(); /* Step 4 */ if (myId == ls_cb->first) { mfc_get(buffer, (unsigned int)ls_cb->memory, 128, 1, 0, 0); mfc_write_tag_mask(1<<1); mfc_read_tag_status_all(); } /* Step 5 */ printf ("SPE %d says %s\n", myId, buffer); if (myId == 0) strcpy(buffer,"Dobry dien!"); if (myId == 1) strcpy(buffer,"Bon giorno!"); if (myId == 2) strcpy(buffer,"Buenas dias!"); if (myId == 3) strcpy(buffer,"Ohayo gozaimasu!"); if (myId == 4) strcpy(buffer,"Boker tov!"); if (myId == 5) strcpy(buffer,"Dobre jitro!"); if (myId == 6) strcpy(buffer,"Bon jour!"); if (myId == 7) strcpy(buffer,"Chao buoi sang!"); /* Step 7 */ if (myId == ls_cb->last) { mfc_put(buffer, (unsigned int)ls_cb->memory, 128, 1, 0, 0); else{ mfc_put(buffer, (unsigned int)ls_cb->lstore[myId+1], 128, 1, 0, 0); #include <stdio.h> #include <spu_mfcio.h> #include <libmisc.h> #include <string.h> #include "../control.h" int main() { int myId; char * buffer = malloc_align(128,7); control_block * ls_cb = malloc_align(sizeof(control_block),7); control_block * cbPtr; /* Step 1*/ spu_write_out_mbox((unsigned int)buffer); /* Step 2 */ cbPtr = (control_block *) spu_read_in_mbox(); mfc_get (ls_cb, (unsigned int)cbPtr, sizeof(control_block), 1, 0, 0); mfc_write_tag_mask(1<<1); mfc_read_tag_status_all(); return 0; } Cell Programming Workshop 11/24/2018

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 11/24/2018

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 11/24/2018

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 11/24/2018