Destroy the Castle – Example Instructions. Functional Decomposition2 Lab 1 Activity 1 Build, Run, and Benchmark.

Slides:



Advertisements
Similar presentations
/ PSWLAB Concurrent Bug Patterns and How to Test Them by Eitan Farchi, Yarden Nir, Shmuel Ur published in the proceedings of IPDPS’03 (PADTAD2003)
Advertisements

Enabling Efficient On-the-fly Microarchitecture Simulation Thierry Lafage September 2000.
Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.
Big Picture Lab 4 Operating Systems Csaba Andras Moritz.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
CS 284a, 8 October 1997 Copyright (c) , John Thornley1 CS 284a Lecture Wednesday, 8 October, 1997.
ISP – 7 th Recitation Mid semester!!! Semaphores – reminder Events Code examples.
1 L50 Multithreading (2). 2 OBJECTIVES  What producer/consumer relationships are and how they are implemented with multithreading.
PathExpander: Architectural Support for Increasing the Path Coverage of Dynamic Bug Detection S. Lu, P. Zhou, W. Liu, Y. Zhou, J. Torrellas University.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 What is the “volatile” Keyword? You can skip locking (thread synchronization) in some cases by using the volatile variables. –No locking/unlocking =
4.7.1 Thread Signal Delivery Two types of signals –Synchronous: Occur as a direct result of program execution Should be delivered to currently executing.
How Beacon Works David Erickson July The Bundle Basic Building Block JAR (zipfile) May Contain – Metadata* META-INF/MANIFEST.MF – Java Classes –
1 Advanced Computer Programming Concurrency Multithreaded Programs Copyright © Texas Education Agency, 2013.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Getting Started The structure of a simple wxWidgets program, Look at where and how a wxWidgets application starts and ends, how to show the main window,
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Dynamic Memory Allocation 9.8.
Lecture 2 Foundations and Definitions Processes/Threads.
Today’s topic Pthread Some materials and figures are obtained from the POSIX threads Programming tutorial at
Race Conditions Defined 1. Every data structure defines invariant conditions. defines the space of possible legal states of the structure defines what.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
CS333 Intro to Operating Systems Jonathan Walpole.
Multi-core Programming Destroy the Castle Lab 4 Code snippets.
Writing a Run Time DLL The application loads the DLL using LoadLibrary() or LoadLibraryEx(). The standard search sequence is used by the operating system.
CS140 Project 1: Threads Slides by Kiyoshi Shikuma.
15.1 Threads and Multi- threading Understanding threads and multi-threading In general, modern computers perform one task at a time It is often.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Fall 2002 CS 325 Class Notes Page 1 Lecture 25 Today –exec() in Unix –CreateProcess in Windows Announcements.
The Log4E logging plug-in David Gallardo. What is logging good for? Tracing program execution during development Debugging Providing an audit trail for.
Eagle: Tcl Integration with the CLR 16th Annual Tcl Conference Joe Mistachkin.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Debugging Threaded Applications By Andrew Binstock CMPS Parallel.
1 OS Review Processes and Threads Chi Zhang
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
Windows CE Overview and Scheduling Presented by Dai Kawano.
Open project in Microsoft Visual Studio → build program in “Release” mode.
Source Level Debugging of Parallel Programs Roland Wismüller LRR-TUM, TU München Germany.
NCHU System & Network Lab Lab #6 Thread Management Operating System Lab.
Debugging In a Multi- Threads Program. Contents Advantages Of Multithreaded Programs Characteristics Of Sequential and Multithreaded Programs.
1 Critical Section Problem CIS 450 Winter 2003 Professor Jinhua Guo.
Win32 Synchronization CS Spring Overview Kernel Synchronization - Spinlocks Executive Synchronization - Dispatcher Objects Wait Operations.
3/17/2016cse synchronization-p2 © Perkins, DW Johnson and University of Washington1 Synchronization Part 2 CSE 410, Spring 2008 Computer.
CSC Multiprocessor Programming, Spring, 2012 Chapter 12 – Testing Concurrent Programs Dr. Dale E. Parson, week 12.
Variables and Inheritance Part 1 Alice. Review: Properties A class defines properties for its own kind of object. When an object is created (instantiated),
pThread synchronization
IST 210: PHP Logic IST 210: Organization of Data IST2101.
Java Thread Programming
Chapter 3: Windows7 Part 5.
Eagle: Tcl Integration with the CLR
August 31 Intro to CS.
Process concept.
CSE 120 Principles of Operating
Why Events Are A Bad Idea (for high-concurrency servers)
CSE 451 Section 4 Project 1 Notes Looking ahead: Project 2.
Background on the need for Synchronization
Threads in C Caryl Rahn.
Threads and Locks.
Chapter 3: Windows7 Part 5.
Game Threading with OpenMP 3.0 Tasks
CS 143A Quiz 1 Solution.
Chapter 05. Multithread.
Multithreaded Programming
Multithreading Why & How.
Data Structures & Algorithms
CS510 Operating System Foundations
Chapter (3) - Procedures
Software Engineering and Architecture
More concurrency issues
Lecture 4 – Data collection List ADT
CS Introduction to Operating Systems
Presentation transcript:

Destroy the Castle – Example Instructions

Functional Decomposition2 Lab 1 Activity 1 Build, Run, and Benchmark

Functional Decomposition3 Lab 1 Activity 1 Step 1 Open ParallelDemo.sln

Functional Decomposition4 Lab 1 Activity 1 Step 2 Set Main as StartUp Project

Functional Decomposition5 Lab 1 Activity 1 Step 3a Set Project Properties Include Path to point to DX7SDK/include directory Set Project Properties Library Path to point to DX7SDK/Lib Build in Debug Mode and run. ◦ Notice abysmal performance ◦ Why is this the case?

Functional Decomposition6 Lab 1 Activity 1 Steps 3-4 Switch to Release Mode or

Functional Decomposition7 Lab 1 Activity 1 Steps 5-6 Build and Run

Functional Decomposition8 Lab 1 Activity 1 Steps 7-11 Benchmark the Castle Demo

Functional Decomposition 9 Lab 1 Activity 1 Results – Single Threaded Run 1Run 2Run 3Average 47 FPS48 FPS47 FPS

Functional Decomposition10 Lab 1 Activity 2 Data Synchronization

Functional Decomposition11 Lab 1 Activity 2 Step 1 Open ParallelDemo.cpp

Functional Decomposition12 Lab 1 Activity 2 Steps 2-3 Declare Variable for Physics ////////////////////////////////////////////////////////////////////////// /// /// Lab 1 Activity 2: Declare Variable /// /// /// Declare variable pointer for the physics (Dynamics*) /// /// Initialize to NULL /// /// /// INSERT CODE HERE /// Dynamics* pDynamics = NULL; /// //////////////////////////////////////////////////////////////////////////

Functional Decomposition13 Lab 1 Activity 2 Steps 4-5 Get Physics Data ////////////////////////////////////////////////////////////////////////// /// /// Lab 1 Activity 2: Get Physics Data /// /// /// Call the GetDynamics function of the castle simulation class /// /// (s_pCastleSimulation) /// /// /// INSERT CODE HERE /// pDynamics = s_pCastleSimulation->GetDynamics(); /// //////////////////////////////////////////////////////////////////////////

Functional Decomposition14 Lab 1 Activity 2 Steps 6-7 Replace with Variable ////////////////////////////////////////////////////////////////////////// /// /// Lab 1 Activity 2: Replace Dynamics /// /// /// Replace call to GetDynamics with the newly created variable /// /// /// INSERT CODE HERE /// s_pBugs->Update( s_pCastleSimulation->GetDynamics() ); /// ////////////////////////////////////////////////////////////////////////// pDynamics

Functional Decomposition15 Lab 1 Activity 2 Steps 8-9 Get Insect Data ////////////////////////////////////////////////////////////////////////// /// /// Lab 1 Activity 2: Get Bug Data /// /// /// Call the GetInstances function of the bugs class (s_pBugs) /// /// /// INSERT CODE HERE /// s_pBugs->GetInstances( &pBugInstances ); /// //////////////////////////////////////////////////////////////////////////

Functional Decomposition16 Lab 1 Activity 2 Steps Replace with Variable ////////////////////////////////////////////////////////////////////////// /// /// Lab 1 Activity 2: Replace Dynamics and Bugs /// /// /// Replace call to GetDynamics with the newly created variable /// /// Remove the call to get bug information /// /// /// INSERT CODE HERE /// s_pBugs->GetInstances( &pBugInstances ); s_pParticles->Update( s_pCastleSimulation->GetDynamics(), g_pCamera, pBugInstances, ( s_bPauseSimulation || s_bPauseParticles ) ); /// ////////////////////////////////////////////////////////////////////////// pDynamics

Functional Decomposition17 Lab 1 Activity 2 Step 13 Build and Run

Functional Decomposition18 Lab 1 Activity 3 Implement Functional Decomposition Physics AI Particles Main

Functional Decomposition19 Lab 1 Activity 3 Steps 1-3 Create Synchronization Events s_hTickDoneEvent[n] = CreateEvent( NULL, TRUE, FALSE, NULL );

Functional Decomposition20 Lab 1 Activity 3 Steps 4-6 Destroy Synchronization Events WaitForMultipleObjects( NUM_EVENTS, s_hTickDoneEvent, TRUE, INFINITE ); … CloseHandle( s_hTickDoneEvent[n] );

Functional Decomposition21 Lab 1 Activity 3 Steps 7-8 Wait for Threads WaitForMultipleObjects( NUM_EVENTS, s_hTickDoneEvent, TRUE, INFINITE );

Functional Decomposition22 Lab 1 Activity 3 Steps 9-12 Thread Functional Block ResetEvent( s_hTickDoneEvent[n] ); QueueUserWorkItem( …ThreadProc, NULL, WT_EXECUTELONGFUNCTION );

Functional Decomposition23 Lab 1 Activity 3 Steps Implement Threaded Functional Block s_pCastleSimulation->Tick(); or s_pBugs->Tick(); or s_pParticles->Tick(); SetEvent( s_hTickDoneEvent[n] );

Functional Decomposition24 Lab 1 Activity 3 Step 16 Build and Run

Functional Decomposition25 Lab 1 Activity 3 Steps Benchmark Multi-Threaded Version

Functional Decomposition 26 Lab 1 Activity 3 Results – Multi-Threaded Run 1Run 2Run 3 AverageSpeed Up 77 FPS79 FPS78 FPS 1.7x