Shared Memory Programming on SCI-Connected Clusters Lab Session SCI Summer School 2001 Trinitiy College Dublin Joachim Worringen Lehrstuhl für Betriebssysteme.

Slides:



Advertisements
Similar presentations
SMiLE Lehrstuhl für Betriebssysteme SCI Low-level programming Lab-Session Joachim Worringen Lehrstuhl für Betriebssysteme RWTH Aachen Martin Schulz Lehrstuhl.
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
CIS 118 – Intro to UNIX Shells 1. 2 What is a shell? Bourne shell – Developed by Steve Bourne at AT&T Korn shell – Developed by David Korn at AT&T C-shell.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
January 13, Csci 2111: Data and File Structures Week1, Lecture 2 Basic File Processing Operations.
Review: Process Management Objective: –Enable fair multi-user, multiprocess computing on limited physical resources –Security and efficiency Process: running.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
Shell Basics CS465 - Unix. Shell Basics Shells provide: –Command interpretation –Multiple commands on a single line –Expansion of wildcard filenames –Redirection.
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
23-Jun-15Advanced Programming Spring 2002 bash Henning Schulzrinne Department of Computer Science Columbia University.
Guide To UNIX Using Linux Third Edition
IDE for ARM 7 board Tutorial 3 IDE of Keil4 V3.a 1.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
CMPE 151: Network Administration Spring Class Description Focus: system and network administration. Sequence of exercises. E.g., installing/configuring.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
University of Washington CSE 351 : The Hardware/Software Interface Section 5 Structs as parameters, buffer overflows, and lab 3.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Advanced Shell Programming. 2 Objectives Use techniques to ensure a script is employing the correct shell Set the default shell Configure Bash login and.
Introduction to Shell Script Programming
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Internet Forms and Database Bob Kisel Amgraf, Inc.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
1 UNIX essentials (hands-on) the directory tree running programs the shell → command line processing → special characters → command types → shell variables.
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Linux+ Guide to Linux Certification, Third Edition
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
1 Week 2 The Crunchy Shell to the Soft and Chewy Kernel… Sarah Diesburg 8/3/2010 COP4610 / CGS5765.
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Module 6 – Redirections, Pipes and Power Tools.. STDin 0 STDout 1 STDerr 2 Redirections.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
The Amiga Operating System: Past and Present Aaron Hensley Kayla Zinn Brad Campbell Gregory Mathurin Josh Benson.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February Session 11.
Lecture 24CS311 – Operating Systems 1 1 CS311 – Lecture 24 Outline Final Exam Study Guide Note: These lecture notes are not intended replace your notes.
Distributed System Concepts and Architectures Services
Chapter Six Introduction to Shell Script Programming.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
© 2015 by McGraw-Hill Education. This proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
Linux+ Guide to Linux Certification, Second Edition
Lesson 8-Specifying Instructions to the Shell. Overview An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Hello world !!! ASCII representation of hello.c.
Wouter Verkerke, NIKHEF 1 Using ‘stoomboot’ for NIKHEF-ATLAS batch computing What is ‘stoomboot’ – Hardware –16 machines, each 2x quad-core Pentium = 128.
Learning Unix/Linux Based on slides from: Eric Bishop.
Linux Administration Working with the BASH Shell.
1 The user’s view  A user is a person employing the computer to do useful work  Examples of useful work include spreadsheets word processing developing.
Lecture 3 Translation.
Chapter 11 Command-Line Master Class
CSE 303 Concepts and Tools for Software Development
INTRODUCTION TO UNIX: The Shell Command Interface
LING 408/508: Computational Techniques for Linguists
Chapter Four UNIX File Processing.
BIC 10503: COMPUTER ARCHITECTURE
Command line.
Chapter 1: Introduction CSS503 Systems Programming
Presentation transcript:

Shared Memory Programming on SCI-Connected Clusters Lab Session SCI Summer School 2001 Trinitiy College Dublin Joachim Worringen Lehrstuhl für Betriebssysteme

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Software Setup Frontend scripts are: smicc to compile SMI applications smirun for launch SMI applications Pathes should be working: verify with type smicc Copy examples to your home directory: cp -r ~worringen2k/lab. cd lab/SMI Open a shell window, from there: xemacs &

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme SMI Experiments First steps towards SMI: helloworld Compiling & starting SMI applications Shared Memory Programming: Establishing different layouts Access characteristics Passing pointers Synchronization

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme helloworld cd helloworld Compiling the programm: smicc helloworld.c –o helloworld Starting the programm: smirun –np 2 helloworld Starting the programm & see what happens: smirun –np 2 –v helloworld (-verbose)  no „machine file“ found! Create a machine file!

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme machine file List of nodes/hosts on which SMI programs can be run – looks like: pc628 pc629 Create a matching machinefile for your 2 nodes! Locations where smirun looks for it: -machinefile filename./machines $(HOME)/.machines Copy your machine file to ~/.machines If not found: All processes on the local host Special option: –nodes,node0,...,nodeN-1

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme More smirun Options Verbose startup: -v Output to seperate terminal windows: -xterm ( xhosts & DISPLAY need to be set correctly) Pipe output through a pager: -pager (can be configured via env. variables) Redirect input / output: -stderr filename, -stdout filename, -stdin filename Separate file generated for each process

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Access Speed cd regions; make Creates different memory layouts: each process sweeps over complete region  measures access time for each process Region types to be used: SMI_SHM_UNDIVIDED SMI_SHM_BLOCKED SMI_SHM_CUSTOMIZED load test_regions.c Variations: Change write to read access Perform accesses with different strides (gaps between accesses)

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Passing Pointers Addresses within shared memory regions: SISCI: different start address for each process  passing of pointers not possible! SMI: identical start address for each process possible Example: pass_pointer.c: Passing the address of a string make, than run pass_pointer – result ? Test with SMI_SHM_NONFIXED flag - result ?  Adaption required: Pass offset relative to region address, not the absolute address!

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Synchronization Techniques (I) Locks: protection of objects (data structures) sequentialization of code segments Polling Barriers: Collective synchronization (all processes need to participate) Polling

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Synchronization Techniques (II) Progress counters: Individual synchronization possible Waiting for certain state of a process Polling Signals: Individual synchronization possible Not polling  Callbacks possible

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Example: Linked List A linked list is created in shared memory Process 0 inserts 50 entries Process 1 prints all entries 50 entries ( ) should appear on screen in order cd sync; make Run shmem_list with 2 processes – result ? Introduce proper synchronization using - Locks ( SMI_Mutex_init, SMI_Mutex_lock, SMI_Mutex_unlock ) - Barriers ( SMI_Barrier ()) - Progress counters

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Copying memory Different types of memory copying techniques achieve best results in different situations SMI_Memcpy() takes care of chosing the right technique, BUT: being smart costs time hints by the user help to save time Utilizing DMA for asynchronous operation: SMI_Imemcpy() starts/enqueues operation SMI_Memwait() waits for completion very low CPU load

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Membench cd membench; make results in membench.out Options: unidirectional write: no options bidirectional write: -b results in membench.out.x (for each process) read instead of write: -r DMA instead of PIO: -a use top to compare CPU load with/without -a

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Sort Sorting an array of integers: Each process sorts a part of the global array Sorted parts of the array are merged: Intermitting merge direction: from upper / from lower rank For each two processes merging: Lower process merges lower halfs of two sorted parts Upper process merges uppers halfs Merging is repeated numproc times  All numbers move up/down to their final locations

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme Merging via Shared Memory Different ways of merging possible: Direct access to other processes‘ array Exchange data via memcpy() operations

SCI Summer School 2001 – DublinLehrstuhl für Betriebsysteme SHM Regions: Creation Speed Common situation: each process exports a region; then imports all other regions Simple approach: For N processes, create N SMI_SHM_UNDIVIDED regions load measure_undivided.c make measure_undivided Advanced approach: create a single SMI_SHM_FRAGMENTED region load measure_fragmented.c make measure_fragmented Compare duration of creation!