The Parallel Software Design Process. Parallel Software Design

Similar documents
GENETIC ALGORITHM with Hands-On exercise

Evolutionary Computation Part 2

Mutations for Permutations

Artificial Intelligence Application (Genetic Algorithm)

CHAPTER 4 GENETIC ALGORITHM

Genetic Algorithms for Vision and Pattern Recognition

CONCEPT FORMATION AND DECISION TREE INDUCTION USING THE GENETIC PROGRAMMING PARADIGM

Local Search (Greedy Descent): Maintain an assignment of a value to each variable. Repeat:

Introduction to Genetic Algorithms. Based on Chapter 10 of Marsland Chapter 9 of Mitchell

Genetic Programming. and its use for learning Concepts in Description Logics

Genetic Programming. Charles Chilaka. Department of Computational Science Memorial University of Newfoundland

Introduction to Genetic Algorithms

March 19, Heuristics for Optimization. Outline. Problem formulation. Genetic algorithms

Chapter 9: Genetic Algorithms

Genetic Algorithms. Kang Zheng Karl Schober

A Genetic Algorithm for Graph Matching using Graph Node Characteristics 1 2

Genetic programming. Lecture Genetic Programming. LISP as a GP language. LISP structure. S-expressions

Genetic Algorithms Variations and Implementation Issues

Escaping Local Optima: Genetic Algorithm

CHAPTER 5 ENERGY MANAGEMENT USING FUZZY GENETIC APPROACH IN WSN

Evolutionary Algorithms. CS Evolutionary Algorithms 1

Suppose you have a problem You don t know how to solve it What can you do? Can you use a computer to somehow find a solution for you?

Information Fusion Dr. B. K. Panigrahi

DETERMINING MAXIMUM/MINIMUM VALUES FOR TWO- DIMENTIONAL MATHMATICLE FUNCTIONS USING RANDOM CREOSSOVER TECHNIQUES

Evolutionary Computation Algorithms for Cryptanalysis: A Study

4/22/2014. Genetic Algorithms. Diwakar Yagyasen Department of Computer Science BBDNITM. Introduction

Genetic Algorithms. Chapter 3

A New Selection Operator - CSM in Genetic Algorithms for Solving the TSP

Heuristic Optimisation

Job Shop Scheduling Problem (JSSP) Genetic Algorithms Critical Block and DG distance Neighbourhood Search

Grid Scheduling Strategy using GA (GSSGA)

Genetic Programming. Modern optimization methods 1

1. Introduction. 2. Motivation and Problem Definition. Volume 8 Issue 2, February Susmita Mohapatra

Computational Intelligence

Multi-objective Optimization

Introduction to Genetic Algorithms. Genetic Algorithms

ARTIFICIAL INTELLIGENCE (CSCU9YE ) LECTURE 5: EVOLUTIONARY ALGORITHMS

Genetic Programming: A study on Computer Language

Similarity Templates or Schemata. CS 571 Evolutionary Computation

Genetic Algorithm Performance with Different Selection Methods in Solving Multi-Objective Network Design Problem

CHAPTER 5 ANT-FUZZY META HEURISTIC GENETIC SENSOR NETWORK SYSTEM FOR MULTI - SINK AGGREGATED DATA TRANSMISSION

The Genetic Algorithm for finding the maxima of single-variable functions

Advanced Search Genetic algorithm

Introduction to Evolutionary Computation

[Premalatha, 4(5): May, 2015] ISSN: (I2OR), Publication Impact Factor: (ISRA), Journal Impact Factor: 2.114

What is GOSET? GOSET stands for Genetic Optimization System Engineering Tool

An Application of Genetic Algorithm for Auto-body Panel Die-design Case Library Based on Grid

Evolutionary Computation. Chao Lan

A Genetic Based Fault Location Algorithm for Transmission Lines

Automata Construct with Genetic Algorithm

Genetic Algorithms and Genetic Programming. Lecture 9: (23/10/09)

Review: Final Exam CPSC Artificial Intelligence Michael M. Richter

Multiprocessor Scheduling Using Parallel Genetic Algorithm

Lecture 6: Genetic Algorithm. An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved

Network Routing Protocol using Genetic Algorithms

Neural Network Weight Selection Using Genetic Algorithms

Grid-Based Genetic Algorithm Approach to Colour Image Segmentation

GENETIC ALGORITHM VERSUS PARTICLE SWARM OPTIMIZATION IN N-QUEEN PROBLEM

Inducing Parameters of a Decision Tree for Expert System Shell McESE by Genetic Algorithm

Geometric Semantic Genetic Programming ~ Theory & Practice ~

Hybridization EVOLUTIONARY COMPUTING. Reasons for Hybridization - 1. Naming. Reasons for Hybridization - 3. Reasons for Hybridization - 2

International Journal of Scientific & Engineering Research Volume 8, Issue 10, October-2017 ISSN

A Genetic Programming Approach for Distributed Queries

Hill Climbing. Assume a heuristic value for each assignment of values to all variables. Maintain an assignment of a value to each variable.

Regularization of Evolving Polynomial Models

Aero-engine PID parameters Optimization based on Adaptive Genetic Algorithm. Yinling Wang, Huacong Li

The k-means Algorithm and Genetic Algorithm

Topological Machining Fixture Layout Synthesis Using Genetic Algorithms

Research Article Path Planning Using a Hybrid Evolutionary Algorithm Based on Tree Structure Encoding

A Parallel Architecture for the Generalized Traveling Salesman Problem

Genetic Algorithm for Finding Shortest Path in a Network

Time Complexity Analysis of the Genetic Algorithm Clustering Method

Metaheuristic Development Methodology. Fall 2009 Instructor: Dr. Masoud Yaghini

DERIVATIVE-FREE OPTIMIZATION

Graphical Approach to Solve the Transcendental Equations Salim Akhtar 1 Ms. Manisha Dawra 2

Path Planning Optimization Using Genetic Algorithm A Literature Review

Introduction to Artificial Intelligence

Outline. Best-first search. Greedy best-first search A* search Heuristics Local search algorithms

Hybrid of Genetic Algorithm and Continuous Ant Colony Optimization for Optimum Solution

A genetic algorithms approach to optimization parameter space of Geant-V prototype

Outline. Motivation. Introduction of GAs. Genetic Algorithm 9/7/2017. Motivation Genetic algorithms An illustrative example Hypothesis space search

Performance analysis basics

Literature Review On Implementing Binary Knapsack problem

GENETIC ALGORITHM METHOD FOR COMPUTER AIDED QUALITY CONTROL

SIMULATED ANNEALING TECHNIQUES AND OVERVIEW. Daniel Kitchener Young Scholars Program Florida State University Tallahassee, Florida, USA

AN EVOLUTIONARY APPROACH TO DISTANCE VECTOR ROUTING

Meta- Heuristic based Optimization Algorithms: A Comparative Study of Genetic Algorithm and Particle Swarm Optimization

An Introduction to Evolutionary Algorithms

Machine Evolution. Machine Evolution. Let s look at. Machine Evolution. Machine Evolution. Machine Evolution. Machine Evolution

Planning and Search. Genetic algorithms. Genetic algorithms 1

Genetic Programming for Multiclass Object Classification

Global Optimization. for practical engineering applications. Harry Lee 4/9/2018 CEE 696

Software Vulnerability

DB2 is a complex system, with a major impact upon your processing environment. There are substantial performance and instrumentation changes in

Fault Detection in Control Systems via Evolutionary Algorithms

Quality of Genetic Algorithm in the Cloud

Reducing Graphic Conflict In Scale Reduced Maps Using A Genetic Algorithm

Using Genetic Algorithms to Solve the Box Stacking Problem

Learning Adaptive Parameters with Restricted Genetic Optimization Method

RESOLVING AMBIGUITIES IN PREPOSITION PHRASE USING GENETIC ALGORITHM

Transcription:

Parallel Software Design The Parallel Software Design Process Deborah Stacey, Chair Dept. of Comp. & Info Sci., University of Guelph dastacey@uoguelph.ca Why Parallel? Why NOT Parallel? Why Talk about Design? Why Parallel? Why NOT Parallel? It is often not obvious that making an algorithm parallel will have benefits. The designer must first answer the question: why parallel? There are really only two reasons for going parallel: Faster - doing the same amount of work in a smaller amount of time. Bigger - doing more in the same amount of time. Both of these reasons can be argued to produce better results. Bad parallel programs can be worse than their serial cousins. Slower - because of communications overhead Scale Problems - some parallel algorithms are only successful if the problem is very, very large; smaller problems will not show any significant benefits. Not all problems are amenable to parallelism. Understand the Problem. 1

Why Talk About Design? There are many choices when it comes to creating a parallel and/or distributed program. 1. Computation 2. Data 3. Communications 4. Algorithm 5. Expected Result Software Design Principles What is Smart Design? Why is Simple Good? The Parallel Design Process What is Smart Design? Why is Simple Good? Smart design is Simple Modular Iterative Modifiable Maintainable Successful Complexity only begets more complexity. Simple code can be read and understood. Simple code can be changed easily and quickly. Simple successful approaches to problems have to be elegant. Elegance = Understanding. 2

The Parallel Design Process 1. Determine your goal in making the code parallel. 2. Select the appropriate approach to parallelism. 3. Select the metrics to be used to determine success. 4. Develop the code. 5. Test your system using the pre-determined metrics. 6. Re-evaluate the system using the metrics and determine the next step: Re-design with another approach. Fine-tune the current design. Consider a hybrid approach. Different Approaches Perfectly Parallel Data/Task Parallelism Specialty Nodes Massively Parallel Perfectly Parallel Data Parallelism Run copies of the serial algorithm on a number of processors. Result is the aggregate of the individual serial answers. Appropriate for parameter-driven algorithms. No change to the serial algorithm. Little communications overhead or concerns about synchronization. May have concerns about the location of needed data - this may translate into a communications problem, i,e, bandwidth. The data is broken up into appropriate slices and distributed to different processors. Serial algorithm must be changed to accommodate this distribution of the dataset. May result in problems with synchronization of communications and different sections of code. 3

Data Parallelism Task Parallelism Need to have a theory about how to split and recombine the data. Communications overhead is a concern - may only be appropriate when the dataset is HUGE. Size matters: Determine what big means. The algorithm itself is divided into independent tasks that can be distributed onto individual processors. The parallel algorithm may not greatly resemble the serial one. A communications strategy is needed. Communications overhead can be significant. A poor understanding of communications can defeat parallelism. Specialty Nodes Massively Parallel Isolate some tasks that all computations use to only a few (or one) processor. Some ubiquitous calculations (such as random number generation) are more efficient if done in isolation. This approach also allows more flexibility when it comes to develop, refactoring, and testing. Mimics the structure of the problem very closely. Tasks on individual processors are small and simple. Communication between nodes is very high. Usually done on specialty architectures (e.g. Connection Machine). Easy to conceptualize but difficult to implement efficiently. 4

A Case Study Genetic Algorithms The Parallel Genetic Algorithm An Introduction Artificial Evolution Genetic Algorithms John Holland proposed that any problem in adaptation (natural or artificial) can generally be formulated in genetic terms [Adaptation in Natural and Artificial Systems]. A genetic algorithm (GA) simulates Darwinian evolutionary processes and genetic operations on chromosomes. A genetic algorithm is a computational technique that transforms a set (population) of individual mathematical objects (usually fixed length character or binary strings), each with an associated fitness value, into a new population (next generation) using operations patterned after the Darwinian principle of reproduction and survival of the fittest and after naturally occurring genetic operations (sexual recombination, mutation). Genetic Programming by John R. Koza (pg 18) 5

The Representation Scheme Generation 0 The most common representation for individuals in a population is a string of binary digits. Our example problem will be represented as a string of length L=3 over an alphabet of size K=2 (0 and 1). The search space for this problem consists of 2 3 =8 possible combinations. Binary Representation 011 001 110 010 The initial generation consists of randomly created individuals. We must also set an initial population size, M Let us set M to 4 and use the strings 011, 001, 110, 010. Fitness The Initial Population: Generation 0 For each generation, each individual in the population is tested against the unknown environment in order to ascertain its fitness in this environment. Individual 1 Individual 2 0 1 1 0 0 1 f = 3 f = 1 worst In this example, we will equate fitness and the value of the binary string as a binary number. Individual 3 1 1 0 f = 6 best Individual 4 0 1 0 f = 2 6

Fitness Proportionate Reproduction Crossover Fitness proportionate reproduction copies the individuals in the current population into the next generation with a probability proportional to their fitness. String Fitness Probability Mating New X i f(x i ) Pool Fitness 011 3 0.25 011 3 001 1 0.08 110 6 110 6 0.50 110 6 010 2 0.17 010 2 Recombination, or crossover, allows new individuals to be created, thus testing new points in the search space. The two individuals participating in crossover are selected proportionate to fitness. Crossover produces two offspring which are usually different from their parents and from each other. Crossover is applied to a specified percentage of the mating pool, the crossover probability, using fitness as a selection criterion. Crossover Generation 0 vs. Generation 1 Parents 0 1 1 1 1 0 Children 0 1 0 1 1 1 Generation 0 Mating Pool After Xover after Reprod (Gen 1) String Fit Prob Mating Pool X X i f(x i ) Pool f(x i ) Pt X i f(x i ) 011 3 0.25 001 3 2 111 7 001 1 0.08 110 6 2 010 2 110 6 0.50 110 6-110 6 010 2 0.17 010 2-110 2 7

Mutation Mutation Another genetic operation is mutation which is an asexual operation that only operates on one individual. An individual is randomly selected from the mating pool and a mutation point is randomly selected as a number between 1 and L. The single character at the mutation point is changed: in a binary alphabet, the character is complemented The frequency of application of the mutation operation is controlled by a parameter called the mutation probability. Mutation Termination The GA continues to produce new generations of individuals until some termination criterion is satisfied. 0 1 0 A particular GA run may go on for thousands of generations. 1 1 0 This termination criterion can be: when a maximum number of generations has been produced, a perfect solution is recognized, or when the population has certain characteristics. 8

Using GAs for Problem Solving Step 1. Determine the representation scheme. the mapping of each possible point in the search space to a fixed-length character string. Step 2. Determine the fitness measure. must be able to evaluate all strings. Step 3. Determine the parameters for controlling the algorithm. population size, maximum number of generations, probabilities of reproduction, crossover and mutation. Step 4. Determine a method for designating the answer and the criterion for termination. The Perfectly Parallel GA Characteristics PPGA.1 PPGA.2 Advantages and Disadvantages Characteristics The GA is a parameter-driven technique. Selection Probability Crossover probability Mutation probability Population size and individual representation scheme Operators - selection, crossover, mutation Extra operators - e.g. elitism The GA is a stochastic technique (randomness involved). Probabilities Generation of the original population. Perfectly Parallel GA Versions The Perfectly Parallel GA (PPGA.1) Run multiple parameter settings and compare results. Goal: Faster How: Multiple variations done in the same time The Perfectly Parallel GA (PPGA.2) Run multiple instances using the same parameter settings and generate aggregate results with statistical analysis. Goal: Faster How: To guarantee statistically significant results, the GA would have to be run multiple times and statistics gathered. 9

Advantages and Disadvantages Advantages Faster No communications overhead or synchronization issues. Same data used by all processes - no data splitting/joining. Easy to understand and measure success. The multiple running of the same GA has to be done anyways so why not in parallel? The Task Parallel GA Disadvantages No speed up of an individual instance of the GA. Bigger: does not affect the size of problem that can be attacked. Boring Characteristics Design and Design Issues Advantages and Disadvantages Characteristics Design Algorithm performance analysis - what part of the GA takes the most time? Generate Population Calculate Fitness For some GA s the most expensive part of the algorithm is the calculation of the fitness function. If each individual fitness calculation is expensive then can we speed up the algorithm by doing multiple fitness calculations at the same time? Select Mating Pool Operators New Population Calculate Fitness Calculate Fitness Calculate Fitness Calculate Fitness 10

Design Issues How many processors are devoted to fitness calculation? How do you distribute all individuals in a population to those processors? Do you increase the size of the population? Are there other parts of the algorithm that can be parallelized? Resource allocation is difficult. How many processors can you successfully use? Advantages and Disadvantages Advantages Faster Bigger Still a simple adaptation of the original algorithm. Very little communications overhead and simple synchronization. Disadvantages Cost-benefit analysis: how many processors are too many? Only applicable when fitness calculation is computational intensive. Characteristics There are many variations of the standard GA The Data Parallel GA One of the variations is called the Island GA In this algorithm, the standard GA is started on a number of separate populations or islands Characteristics Design Advantages and Disadvantages Using various criteria, individuals are exchanged between these islands 11

Design Island 1 Island 2 Island 3... Broadcast or Point-to-Point Island n Advantages and Disadvantages Advantages Bigger - total population is large Faster - faster than serial Island GA but Disadvantages How can this technique be evaluated? Possibly complex communications strategy How many islands? Evaluation is essential and hard. Alternatives The Hybrid Parallel GA Combine the Perfectly Parallel and the Task Parallel. Run multiple copies of a Task Parallelized GA. Aggregation Alternatives Advantages and Disadvantages 12

Alternatives Alternatives Combine the Data Parallel and the Task Parallel. Each Island uses Task Parallelism. Island 1 Island 2 Island 3 Island n Combine any of the other versions or even just a serial GA with a specialty node that just serves out random numbers. Why? Need lots of random numbers for selection, operators, etc. Lots of different random number generators. Specialty node can be generating random numbers continually and serving them out as needed. Cost for each random number is the cost of communication to the specialty node. Advantages and Disadvantages Advantages Faster Bigger Modularity Disadvantages Complexity Decisions, decisions, decisions Cost-Benefit analysis Evaluation Where is the speed-up coming from? Where are the bottle-necks? Which Approach is Best? Why Parallel? - Revisited Evaluating the Design Restructuring or Refactoring Testing is Central Testing Strategy Components 13

Why Parallel? - Revisited Evaluating the Design Approach should match the goal of making the algorithm parallel Faster How much faster does the algorithm have to be to be considered a success? How many resources can be devoted to the parallel version? Measure the speed up with a modest set of resources. Identify any bottlenecks particularly with communications. Identify what aspect of the parallelism is causing the speedup. Perform a cost-benefit analysis. Bigger Why does the problem have to be bigger? Is bigger better? Time Number of Processors Restructuring or Refactoring Refactoring means improving the design of existing code. It is the process of changing a software system in such a way that it does not alter the external behaviour of the code yet improves its internal structure. Restructuring is the transformation from one design structure to another, while preserving the subject system s external behaviour (functionality and semantics). Restructuring or Refactoring Often restructuring involves transformations designed to remove complexity or to make complexity easier to handle and maintain. Restructuring creates does not normally involve modifications because of new requirements, but it may lead to observations that suggest changes that would improve aspects of the system. Defeat complexity - embrace simplicity. 14

Restructuring or Refactoring Testing is Central When should refactoring be used: Adding a new feature - refactoring is good preparation for modifying code. Fixing a bug - understanding the algorithm well enough to fix a known bug means you understand it well enough to simplify it. Performing code review - when you examine the code base implemented by the development team, one of the goals should be to simplify code structure and algorithms in context of the entire application. [Refactoring: Shifting development back into first gear Issued by: Citigate Ballard King http://www.itweb.co.za/office/compuwaresa/ 0301230732.htm] Objectives of the testing of parallel programs: Detection of communication problems Detection of performance bottlenecks Debugging Refactoring/restructuring opportunities Testing Strategy Components Instrumentation Experiments Analysis Testing Strategy Components Instrumentation Tools and libraries used to acquire information about a program s execution. This can be dependent on platform specific monitoring resources or can be as simple as embedded generic profiling statements. Experiments Random execution: run the program many times to find problems Deterministic execution: the order of logged communication events is verified against the specification Analysis Tools that analyze trace files, produce execution profiles (i.e., characterization, classification, and location), and generate graphics for visualization. Faster, Bigger, but Better? Revisit the requirements often. 15

Fast, Bigger, but Better? First, define what is meant by better for the particular algorithm. Go back to the requirements for the program: How fast does it have to be to meet the requirements? How much work has to be done to produce a result? Do the requirements have to be changed? Increased expectations. Possible efficiencies and simplifications. But is the program maintainable? Another Case Study The Problem The Requirements Possible Parallel Approaches The Problem Fingerprints Fingerprints are found on all people and some animals. They are unique to the individual and usually remain unchanged over a lifetime. Worldwide databases of billions of unique fingerprints exist. Examiners identify prints by making comparisons of one friction ridge print with another. Modern computerized fingerprint analysis allows the process to be automated and speeds up searching for a match. 16

The Requirements Must be able to handle millions of fingerprint records. The matching requirements must be a parameter. When a line on a fingerprint stops or splits it is called a typica. The amount of typica necessary for a match differs between countries. In the Netherlands, 10 to 12 characteristic points with no differences are required and in South Africa it is 7 points for an identification. In England and the U.S. there is no rule; an expert decides what is sufficient. The amount of time for searching is also a parameter. Possible Parallel Approaches Data Parallelism? How can the data be distributed? What is the possible speed up? Task Parallelism? Are there opportunities to parallelize searching/matching? How can this approach be analysed and evaluated? Resource Allocation How big is realistic? Can the benefits of parallelism be measured? 17