Download presentation
Presentation is loading. Please wait.
Published byLeslie Evans Modified over 9 years ago
1
Destroy the Castle – Example Instructions
2
Functional Decomposition2 Lab 1 Activity 1 Build, Run, and Benchmark
3
Functional Decomposition3 Lab 1 Activity 1 Step 1 Open ParallelDemo.sln
4
Functional Decomposition4 Lab 1 Activity 1 Step 2 Set Main as StartUp Project
5
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?
6
Functional Decomposition6 Lab 1 Activity 1 Steps 3-4 Switch to Release Mode or
7
Functional Decomposition7 Lab 1 Activity 1 Steps 5-6 Build and Run
8
Functional Decomposition8 Lab 1 Activity 1 Steps 7-11 Benchmark the Castle Demo
9
Functional Decomposition 9 Lab 1 Activity 1 Results – Single Threaded Run 1Run 2Run 3Average 47 FPS48 FPS47 FPS
10
Functional Decomposition10 Lab 1 Activity 2 Data Synchronization
11
Functional Decomposition11 Lab 1 Activity 2 Step 1 Open ParallelDemo.cpp
12
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; /// //////////////////////////////////////////////////////////////////////////
13
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(); /// //////////////////////////////////////////////////////////////////////////
14
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
15
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 ); /// //////////////////////////////////////////////////////////////////////////
16
Functional Decomposition16 Lab 1 Activity 2 Steps 10-12 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
17
Functional Decomposition17 Lab 1 Activity 2 Step 13 Build and Run
18
Functional Decomposition18 Lab 1 Activity 3 Implement Functional Decomposition Physics AI Particles Main
19
Functional Decomposition19 Lab 1 Activity 3 Steps 1-3 Create Synchronization Events s_hTickDoneEvent[n] = CreateEvent( NULL, TRUE, FALSE, NULL );
20
Functional Decomposition20 Lab 1 Activity 3 Steps 4-6 Destroy Synchronization Events WaitForMultipleObjects( NUM_EVENTS, s_hTickDoneEvent, TRUE, INFINITE ); … CloseHandle( s_hTickDoneEvent[n] );
21
Functional Decomposition21 Lab 1 Activity 3 Steps 7-8 Wait for Threads WaitForMultipleObjects( NUM_EVENTS, s_hTickDoneEvent, TRUE, INFINITE );
22
Functional Decomposition22 Lab 1 Activity 3 Steps 9-12 Thread Functional Block ResetEvent( s_hTickDoneEvent[n] ); QueueUserWorkItem( …ThreadProc, NULL, WT_EXECUTELONGFUNCTION );
23
Functional Decomposition23 Lab 1 Activity 3 Steps 13-15 Implement Threaded Functional Block s_pCastleSimulation->Tick(); or s_pBugs->Tick(); or s_pParticles->Tick(); SetEvent( s_hTickDoneEvent[n] );
24
Functional Decomposition24 Lab 1 Activity 3 Step 16 Build and Run
25
Functional Decomposition25 Lab 1 Activity 3 Steps 17-18 Benchmark Multi-Threaded Version
26
Functional Decomposition 26 Lab 1 Activity 3 Results – Multi-Threaded Run 1Run 2Run 3 AverageSpeed Up 77 FPS79 FPS78 FPS 1.7x
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.