1. Homepage
  2. Programming
  3. CEG 4136 Computer Architecture - Lab1: Optimizing Forest Fire Simulation with CUDA

CEG 4136 Computer Architecture - Lab1: Optimizing Forest Fire Simulation with CUDA

Engage in a Conversation
OttawaCEG4136Computer ArchitectureOptimizing Forest Fire Simulation with CUDACUDAC

1. Introduction CourseNana.COM

CEG 4136 Computer Architecture III Fall 2024 CourseNana.COM

To be submitted September 28, 11:59 p.m. CourseNana.COM

Lab1: Optimizing Forest Fire Simulation with CUDA CourseNana.COM

In this lab, you will work on a forest fire simulation code that uses a 1000×1000 grid. The fire starts at 100 distinct locations in the forest. The provided code is implemented sequentially. It simulates the propagation of fire, the burning of trees, and their eventual extinction. The grid is displayed using the OpenGL library, where each cell represents a tree or an empty space. CourseNana.COM

The objective of this lab is to parallelize the existing code using CUDA C to leverage the power of graphics processing units (GPUs) to make the simulation faster and more efficient. You will identify parts of the code that are most appropriate for optimization, such as the forest update process, and transform them to run in parallel. CourseNana.COM

2. Objective CourseNana.COM

The primary objective of this lab is to convert the sequential code into an optimized version using CUDA C to accelerate the simulation. You will learn to: CourseNana.COM

  • Identify code sections that can be parallelized. CourseNana.COM

  • Use CUDA C to run computations in parallel on a GPU. CourseNana.COM

  • Measure the performance gains achieved through parallelization. CourseNana.COM

3. Development Platform CourseNana.COM

Development and optimization of the program will be done on machines equipped with CUDA- capable GPUs. The tools to be used include: CourseNana.COM

  • CUDA Toolkit (12.6 or later) for compiling CUDA programs. CourseNana.COM

  • Visual Studio 2022 for editing and debugging the code. CourseNana.COM

  • CUDA Debugger for testing and profiling your CUDA kernels. CourseNana.COM

    You will use OpenGL for rendering the simulation, and work will be carried out on workstations with NVIDIA GPUs that support CUDA. CourseNana.COM

    4. Tasks CourseNana.COM

    Step 1: Understand the Starter Code CourseNana.COM

Analyze the provided code. It is a forest fire simulation where each cell in the grid represents either a tree or an empty space. Fire starts at 100 random locations, spreads to neighboring cells, and burning trees eventually extinguish after a set amount of time. CourseNana.COM

Step 2: Identify Opportunities for Parallelization CourseNana.COM

  • Grid updating is a significant part of the code that can be parallelized. Each cell in the grid can be updated independently of the others. CourseNana.COM

  • Analyze the updateForest() function, which is responsible for updating the state of burning trees and propagating fire to neighboring cells. This is the section that needs to be optimized using CUDA. CourseNana.COM

    Step 3: Implement Parallelization with CUDA C CourseNana.COM

  • CUDA Initialization: Allocate memory for the grid (forest) and burn time (burnTime) on the GPU using cudaMalloc(). CourseNana.COM

  • CUDA Kernel: Implement a kernel that updates the state of each cell in the forest in parallel. CourseNana.COM

  • Parallel Execution: Ensure that each cell in the grid is updated in parallel using multiple threads on the GPU. CourseNana.COM

  • Block and Thread Management: Divide the grid into CUDA thread blocks for optimized execution. CourseNana.COM

    Step 4: Measure Performance CourseNana.COM

    Measure the runtime of the sequential program and compare it to the optimized CUDA version. Use CUDA profiling tools to identify performance gains and any further possible optimizations. CourseNana.COM

CourseNana.COM

5. Deliverables CourseNana.COM

Each team must submit a report containing the following: CourseNana.COM

  • An explanation of the parts of the code that were parallelized. CourseNana.COM

  • The modified source code with the CUDA implementation. CourseNana.COM

  • A performance analysis showing the execution times before and after optimization. CourseNana.COM

  • Screenshots of the running program with visual simulation results. CourseNana.COM

    6. Evaluation Criteria CourseNana.COM

    The following criteria will be considered in the evaluation: CourseNana.COM

  • Correctness: The program must work correctly after optimization. The simulation should behave the same as the sequential version. CourseNana.COM

  • Effective Parallelization: The code should demonstrate proper and effective use of CUDA, with significant parallelization of the appropriate parts of the program. CourseNana.COM

  • Performance Improvement: Measurable performance gains should be demonstrated with the CUDA version. The difference in execution times between the sequential and parallel versions must be clearly explained. CourseNana.COM

  • Code Quality: The code should be well-structured, commented, and follow good programming practices. CourseNana.COM

    Note: This lab serves as an introduction to parallelization using CUDA, so it's important to have a solid understanding of the basics of CUDA before you begin coding. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Ottawa代写,CEG4136代写,Computer Architecture代写,Optimizing Forest Fire Simulation with CUDA代写,CUDA代写,C代写,Ottawa代编,CEG4136代编,Computer Architecture代编,Optimizing Forest Fire Simulation with CUDA代编,CUDA代编,C代编,Ottawa代考,CEG4136代考,Computer Architecture代考,Optimizing Forest Fire Simulation with CUDA代考,CUDA代考,C代考,Ottawahelp,CEG4136help,Computer Architecturehelp,Optimizing Forest Fire Simulation with CUDAhelp,CUDAhelp,Chelp,Ottawa作业代写,CEG4136作业代写,Computer Architecture作业代写,Optimizing Forest Fire Simulation with CUDA作业代写,CUDA作业代写,C作业代写,Ottawa编程代写,CEG4136编程代写,Computer Architecture编程代写,Optimizing Forest Fire Simulation with CUDA编程代写,CUDA编程代写,C编程代写,Ottawaprogramming help,CEG4136programming help,Computer Architectureprogramming help,Optimizing Forest Fire Simulation with CUDAprogramming help,CUDAprogramming help,Cprogramming help,Ottawaassignment help,CEG4136assignment help,Computer Architectureassignment help,Optimizing Forest Fire Simulation with CUDAassignment help,CUDAassignment help,Cassignment help,Ottawasolution,CEG4136solution,Computer Architecturesolution,Optimizing Forest Fire Simulation with CUDAsolution,CUDAsolution,Csolution,