
Structured Dagger Basics and Load Balancing Illustration
Explore structured dagger basics including when statements, serial blocks, and while loops, along with the concept of load balancing. An example demonstrating these concepts is illustrated, and further documentation can be accessed at https://charm.cs.illinois.edu/help. Dive into a 5-point stencil for 1-D decomposition and a Jacobi module for a comprehensive understanding.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
The concepts needed for our exercise Structured dagger basics When statement, serial blocks, for an while loops. How to invoke load balancing We will illustrate them both through one example Also: see the documentation at: https://charm.cs.illinois.edu/help 1
5-point Stencil 1-D decomposition: each chare object owns a strip Need to exchange top and bottom boundaries 2
Jacobi: .ci file mainmodule jacobi1d { readonly CProxy Main mainProxy; readonly int blockDimX; readonly int numChares; mainchare Main { entry Main(CkArgMsg m); }; array [1D] Jacobi { entry Jacobi(void); entry void recvGhosts(int iter, int dir, int size, double gh[size]); entry [reductiontarget] void isConverged(bool result); entry void run() { // ... main loop (next slide) ... }; }; }; 3
while (!converged) { serial "send_to_neighbors" { iter++; thisProxy(top).recvGhosts(iter, BOTTOM, arrayDimY, &value[1][1]); thisProxy(bottom).recvGhosts(iter, TOP, arrayDimY, &value[blockDimX][1]); } for(imsg = 0; imsg < neighbors; imsg++) when recvGhosts[iter] (int iter, int dir, int size, double gh[size]) serial "update_boundary" { int row = (dir == TOP) ? 0 : blockDimX+1; for(int j=0; j<size; j++) value[row][j+1] = gh[j]; } top = (thisIndex+1)%numChares; bottom = ; serial "do_work" { conv = check_and_compute(); // conv: a boolean indicating local convergence CkCallback cb = CkCallback(CkReductionTarget(Jacobi, isConverged), thisProxy); Contribute(sizeof(bool), &conv, CkReduction::logical_and, cb); } when isConverged(bool result) serial "check_converge" { converged = result; if (result && thisIndex == 0) CkExit(); } } 4
while (!converged) { serial "send_to_neighbors" { iter++; thisProxy(top).recvGhosts(iter, BOTTOM, arrayDimY, &value[1][1]); thisProxy(bottom).recvGhosts(iter, TOP, arrayDimY, &value[blockDimX][1]); } for(imsg = 0; imsg < neighbors; imsg++) when recvGhosts[iter] (int iter, int dir, int size, double gh[size]) serial "update_boundary" { int row = (dir == TOP) ? 0 : blockDimX+1; for(int j=0; j<size; j++) value[row][j+1] = gh[j]; } top = (thisIndex+1)%numChares; bottom = ; serial "do_work" { conv = check_and_compute(); // conv: a boolean indicating local convergence CkCallback cb = CkCallback(CkReductionTarget(Jacobi, isConverged), thisProxy); Contribute(sizeof(bool), &conv, CkReduction::logical_and, cb); } when isConverged(bool result) serial "check_converge" { converged = result; if (result && thisIndex == 0) CkExit(); } if (iter % LBPERIOD == 0) {serial "start_lb" { AtSync();} when ResumeFromSync() {}} } 5
Next: hands on instructions for Compile, run and submit an example job Download, install and run projections tool on your laptop Explanation for each exercise: Key-Value store Particle simulation A sequence of assignments that modifies given code in specific ways Instructions are at: http://charm.cs.illinois.edu/tutorial_anl/ 6
Key-Value Clients KeyValueStore 7