DOC PREVIEW
Berkeley COMPSCI C267 - Lecture Notes

This preview shows page 1-2-3-4-26-27-28-53-54-55-56 out of 56 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 267 The Titanium LanguageMotivation: Target ProblemsTitanium BackgroundSummary of Features Added to JavaOutlineSPMD Execution ModelGlobal and Local ViewsBarriers and SingleExplicit Communication: BroadcastSingle Variable ExampleSlide 11Global Address SpaceUse of Global / LocalSlide 14Aside on Titanium ArraysExplicit Communication: ExchangeDistributed Data StructuresRegion-Based Memory ManagementSlide 19Slide 20Java ObjectsJava Object ExampleImmutable Classes in TitaniumExample of Immutable ClassesOperator OverloadingArrays in JavaMultidimensional Arrays in TitaniumUnordered IterationPoint, RectDomain, Arrays in GeneralSimple Array ExampleExample: DomainExample using Domains and foreachMore Array OperationsMatMul with Titanium ArraysExample: Setting Boundary ConditionsTemplatesExample of TemplatesUsing Templates: Distributed ArraysCross-Language CallsAre these features expressive?Slide 41Java Compiled by Titanium CompilerSlide 43Local Pointer AnalysisApplications in TitaniumError on High-Wavenumber ProblemScalable Parallel Poisson SolverAMR Gas DynamicsCompiler Optimizations of Sparse Matrix Code in TitaniumCoding Challenges: Block-Structured AMRLanguages Support Helps ProductivityTitanium AMR PerformanceSlide 53Titanium Compiler StatusCurrent Work & Future PlansTitanium Group (Past and Present)CS 267The Titanium LanguageCS 267The Titanium LanguageKathy Yelickhttp://titanium.cs.berkeley.eduKathy Yelickhttp://titanium.cs.berkeley.eduJanuary 14, 2019CS267 Lecture 122Motivation: Target ProblemsMany modeling problems in astrophysics, biology, material science, and other areas require Enormous range of spatial and temporal scalesTo solve interesting problems, one needs:Adaptive methodsLarge scale parallel machinesTitanium is designed forStructured gridsLocally-structured grids (AMR)Particle/Mesh methodsSource: J. Bell, LBNLJanuary 14, 2019CS267 Lecture 123Titanium BackgroundBased on Java, a cleaner C++Classes, automatic memory management, etc.Compiled to C and then machine code, no JVMSame parallelism model at UPC and CAFSPMD parallelismDynamic Java threads are not supportedOptimizing compilerAnalyzes global synchronizationOptimizes pointers, communication, memoryJanuary 14, 2019CS267 Lecture 124Summary of Features Added to JavaMultidimensional arrays: iterators, subarrays, copyingImmutable (“value”) classesTemplatesOperator overloadingScalable SPMD parallelism replaces threadsGlobal address space with local/global reference distinctionChecked global synchronization Zone-based memory management (regions)Libraries for collective communication, distributed arrays, bulk I/O, performance profilingJanuary 14, 2019CS267 Lecture 125OutlineTitanium Execution ModelSPMDGlobal SynchronizationSingleTitanium Memory ModelSupport for Serial ProgrammingPerformance and ApplicationsCompiler/Language StatusJanuary 14, 2019CS267 Lecture 126SPMD Execution ModelTitanium has the same execution model as UPC and CAFBasic Java programs may be run as Titanium programs, but all processors do all the work.E.g., parallel hello world class HelloWorld { public static void main (String [] argv) { System.out.println(“Hello from proc “ + Ti.thisProc() + “ out of “ + Ti.numProcs()); } }Global synchronization done using Ti.barrier()January 14, 2019CS267 Lecture 127Global and Local ViewsWhen writing parallel programs, especially SPMD programs, there are 2 types of functionsLocal: may be called independently by any thread; more than 1 may call concurrentlyGlobal/collective: all threads call these togetherConvention in UPC is to put “all_” in the nameCommon source of bugs is barriers or other collective operations inside branches or loopsbarrier, broadcast, reduction, exchangeTitanium compiler proves that no such deadlocks exist, or a compiler-time error producedJanuary 14, 2019CS267 Lecture 128Barriers and SingleTo put a barrier (or equivalent) inside a method, you need to make the message “single” (aka “sglobal”).A “single” method is one called by all procs public single static void allStep(...)These single annotations on methods are optional, but useful in understanding compiler messagesTo put a barrier (or single method) inside a branch or loop, you need to use a “single” variable for branchA “single” variable has same value on all procs int single timestep = 0;Compiler proves that all processors call barriers together "Barrier Inference" [Gay & Aiken]January 14, 2019CS267 Lecture 129Explicit Communication: BroadcastBroadcast is a one-to-all communication broadcast <value> from <processor>For example: int count = 0; int allCount = 0; if (Ti.thisProc() == 0) count = computeCount(); allCount = broadcast count from 0;The processor number in the broadcast must be single; all constants are single.All processors must agree on the broadcast source.The allCount variable could be declared single.All processes have the same value after broadcast.January 14, 2019CS267 Lecture 1210Single Variable ExampleBarriers and single in N-body Simulation class ParticleSim { public static void main (String [] argv) { int single allTimestep = 0; int single allEndTime = 100; for (; allTimestep < allEndTime; allTimestep++){ read remote particles, compute forces on mine Ti.barrier(); write to my particles using new forces Ti.barrier(); } } } Single methods inferred by the compilerJanuary 14, 2019CS267 Lecture 1211OutlineTitanium Execution ModelTitanium Memory ModelGlobal and Local ReferencesExchange: Building Distributed Data StructuresRegion-Based Memory ManagementSupport for Serial ProgrammingPerformance and ApplicationsCompiler/Language StatusJanuary 14, 2019CS267 Lecture 1212Global Address SpaceGlobally shared address space is partitioned References (pointers) are either local or global (meaning possibly remote)Object heapsare shared by defaultGlobal address spacex: 1y: 2Program stacks are privatel: l: l: g: g: g: x: 5y: 6x: 7y: 8p0 p1 pnJanuary 14, 2019CS267 Lecture 1213Use of Global / LocalGlobal references (pointers) may point to remote locationsReference are global by default (unlike UPC)Easy to port shared-memory programsGlobal pointers are more expensive than localTrue even when data is on the same processorCosts


View Full Document

Berkeley COMPSCI C267 - Lecture Notes

Documents in this Course
Lecture 4

Lecture 4

52 pages

Split-C

Split-C

5 pages

Lecture 5

Lecture 5

40 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?