SlideShare a Scribd company logo
Visit https://ebookfinal.com to download the full version and
explore more ebooks
Multicore Software Development Techniques
Applications Tips and Tricks 1st Edition Oshana
_____ Click the link below to download _____
https://ebookfinal.com/download/multicore-software-
development-techniques-applications-tips-and-
tricks-1st-edition-oshana/
Explore and download more ebooks at ebookfinal.com
Here are some suggested products you might be interested in.
Click the link to download
Fundamentals of Multicore Software Development 1st Edition
Victor Pankratius
https://ebookfinal.com/download/fundamentals-of-multicore-software-
development-1st-edition-victor-pankratius/
Oracle Internals Tips Tricks and Techniques for DBAs 1st
Edition Donald K. Burleson
https://ebookfinal.com/download/oracle-internals-tips-tricks-and-
techniques-for-dbas-1st-edition-donald-k-burleson/
GPU Gems Programming Techniques Tips and Tricks for Real
Time Graphics 1st Edition Randima Fernando
https://ebookfinal.com/download/gpu-gems-programming-techniques-tips-
and-tricks-for-real-time-graphics-1st-edition-randima-fernando/
Adobe Photoshop CS3 Top 100 Simplified Tips Tricks Top 100
Simplified Tips Tricks 1st Edition Lynette Kent
https://ebookfinal.com/download/adobe-photoshop-
cs3-top-100-simplified-tips-tricks-top-100-simplified-tips-tricks-1st-
edition-lynette-kent/
100 Game Design Tips Tricks 1st Edition Wlad Marhulets
https://ebookfinal.com/download/100-game-design-tips-tricks-1st-
edition-wlad-marhulets/
Mac Os Catalina Tricks And Tips 2020 2nd Edition Techgo
https://ebookfinal.com/download/mac-os-catalina-tricks-and-
tips-2020-2nd-edition-techgo/
John Walkenbach s Favorite Excel 2010 Tips and Tricks 1st
Edition John Walkenbach
https://ebookfinal.com/download/john-walkenbach-s-favorite-
excel-2010-tips-and-tricks-1st-edition-john-walkenbach/
Photoshop Elements 7 Top 100 Simplified Tips Tricks 1st
Edition Rob Sheppard
https://ebookfinal.com/download/photoshop-
elements-7-top-100-simplified-tips-tricks-1st-edition-rob-sheppard/
Expert Cube Development with SSAS Multidimensional Models
Expert Tips and Tricks for Designing Analysis Services
Multidimensional Models 2nd Edition Alberto Ferrari
https://ebookfinal.com/download/expert-cube-development-with-ssas-
multidimensional-models-expert-tips-and-tricks-for-designing-analysis-
services-multidimensional-models-2nd-edition-alberto-ferrari/
Multicore Software Development Techniques Applications Tips and Tricks 1st Edition Oshana
Multicore Software Development Techniques
Applications Tips and Tricks 1st Edition Oshana Digital
Instant Download
Author(s): Oshana, Robert
ISBN(s): 9780128010372, 0128010371
Edition: 1
File Details: PDF, 18.79 MB
Year: 2015
Language: english
Multicore Software
Development Techniques
Multicore Software
Development Techniques
Applications, Tips, and Tricks
Rob Oshana
AMSTERDAM • BOSTON • HEIDELBERG • LONDON
NEW YORK • OXFORD • PARIS • SAN DIEGO
SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Newnes is an imprint of Elsevier
Newnes is an imprint of Elsevier
The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, UK
225 Wyman Street, Waltham, MA 02451, USA
Copyright r 2016 Elsevier Inc. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or any information storage and
retrieval system, without permission in writing from the publisher. Details on how to seek
permission, further information about the Publisher’s permissions policies and our arrangements
with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency,
can be found at our website: www.elsevier.com/permissions.
This book and the individual contributions contained in it are protected under copyright by the
Publisher (other than as may be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and
experience broaden our understanding, changes in research methods, professional practices,
or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in
evaluating and using any information, methods, compounds, or experiments described herein.
In using such information or methods they should be mindful of their own safety and the safety
of others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors,
assume any liability for any injury and/or damage to persons or property as a matter of products
liability, negligence or otherwise, or from any use or operation of any methods, products,
instructions, or ideas contained in the material herein.
ISBN: 978-0-12-800958-1
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library
Library of Congress Cataloging-in-Publication Data
A catalog record for this book is available from the Library of Congress
For information on all Newnes publications
visit our website at http://store.elsevier.com/
This book is dedicated to my family, Susan, Sam, and Noah.
CHAPTER 1
1
Principles of Parallel Computing
A multicore processor is a computing device that contains two or more
independent processing elements (referred to as “cores”) integrated
on to a single device, that read and execute program instructions.
There are many architectural styles of multicore processors, and many
application areas, such as embedded processing, graphics processing,
and networking.
There are many factors driving multicore adoption:
• Increases in mobile traffic
• Increases in communication between multiple devices
• Increase in semiconductor content (e.g., automotive increases in
semiconductor content are driving automotive manufacturers to
consider multicore to improve affordability, “green” technology,
safety, and connectivity, see Figure 1.1)
Windows & mirrors
Security and access
Comfort & information
Lighting
…………….14
…………..11
.……….18
………………………….22
Total………….65
Example
Figure 1.1 Semiconductor content in automotive is increasing.
Multicore Software Development Techniques. DOI: http://dx.doi.org/10.1016/B978-0-12-800958-1.00001-2
© 2016 Elsevier Inc. All rights reserved.
A typical multicore processor will have multiple cores which can
be the same (homogeneous) or different (heterogeneous) accelerators
(the more generic term is “processing element”) for dedicated functions
such as video or network acceleration, as well as a number of shared
resources (memory, cache, peripherals such as ethernet, display,
codecs, UART, etc.) (Figure 1.2)
1.1 CONCURRENCY VERSUS PARALLELISM
There are important differences between concurrency and parallelism
as they relate to multicore processing.
Concurrency: A condition that exists when at least two software
tasks are making progress, although at different times. This is a more
generalized form of parallelism that can include time-slicing as a form
of virtual parallelism. Systems that support concurrency are designed
for interruptability.
Parallelism: A condition that arises when at least two threads
are executing simultaneously. Systems that support parallelism are
designed for independentability, such as a multicore system.
A program designed to be concurrent may or may not be run in
parallel; concurrency is more an attribute of a program, parallelism
may occur when it executes (see Figure 1.3).
Cores
Acceleration
Shared resources
Figure 1.2 A generic multicore system (left) and an example multicore device from industry (right).
2 Multicore Software Development Techniques
It is time to introduce an algorithm that should be memorized when
thinking about multicore systems. Here it is:
High-performance 5 parallelism 1 memory hierarchy  contention
• “Parallelism” is all about exposing parallelism in the application
• “Memory hierarchy” is all about maximizing data locality in the
network, disk, RAM, cache, core, etc.
• “Contention” is all about minimizing interactions between cores
(e.g., locking, synchronization, etc.)
To achieve the best HPC or “High Peformance Computing” result,
to get the best performance we need to get the best possible parallelism,
use memory efficiently, and reduce the contention. As we move forward
we will touch on each of these areas.
1.2 SYMMETRIC AND ASYMMETRIC MULTIPROCESSING
Efficiently allocating resources in multicore systems can be a challenge.
Depending on the configuration, the multiple software components in
these systems may or may not be aware of how other components are
using these resources. There are two primary forms of multiprocessing,
as shown in Figure 1.4;
• Symmetric multiprocessing
• Asymmetric multiprocessing
Time
Time
Task 1
Task 2
Task 1
Task 2
Task 1
Task 2
Concurrency
Parallelism
Figure 1.3 Concurrency versus parallelism.
3
Principles of Parallel Computing
1.2.1 Symmetric Multiprocessing
Symmetric multiprocessing (SMP) uses a single copy of the oper-
ating system on all of the system’s cores. The operating system
has visibility into all system element, and can allocate resources
on the multiple cores with little or no guidance from the applica-
tion developer. SMP dynamically allocates resources to specific
applications rather than to cores which leads to greater
utilization of available processing power. Key characteristics of
SMP include:
A collection of homogeneous cores with a common view of system
resources such as sharing a coherent memory space and using CPUs
that communicate using a large coherent memory space.
Applicable for general purpose applications or applications that
may not be entirely known at design time. Applications that my need
to suspend because of memory accesses or may need to migrate or
restart on any core fit into a SMP model as well. Multithreaded
applications are SMP friendly.
1.2.2 Asymmetric Multiprocessing
AMP can be:
• homogeneous—each CPU runs the same type and version of the
operating system
• heterogeneous—each CPU runs either a different operating system
or a different version of the same operating system
In heterogeneous systems, you must either implement a proprietary
communications scheme or choose two OSs that share a common
Figure 1.4 Asymmetric multiprocessing (left) and symmetric multiprocessing (right).
4 Multicore Software Development Techniques
API and infrastructure for interprocessor communications. There
must be well-defined and implemented methods for accessing shared
resources.
In an AMP system, an application process will always runs on the
same CPU, even when other CPUs run idle. This can lead to one CPU
being under- or overutilized. In some cases it may be possible to
migrate a process dynamically from one CPU to another. There may
be side effects of doing this, such as requiring checkpointing of state
information or a service interruption when the process is halted on one
CPU and restarted on another CPU. This is further complicated if the
CPUs run different operating systems.
In AMP systems, the processor cores communicate using large
coherent bus memories, shared local memories, hardware FIFOS, and
other direct connections.
AMP is better applied to known data-intensive applications where
it is better at maximizing efficiency for every task in the system such as
audio and video processing. AMP is not as good as a pool of general
computing resources.
The key reason there are AMP multicore devices is because it
is the most economical way to deliver multiprocessing to specific
tasks. The performance, energy, and area envelope is much better
than SMP.
Table 1.1 is a summary of SMP and AMP multicore systems.
Table 1.1 Comparison of SMP and AMP
Feature SMP AMP
Dedicated processor by function No Yes
Legacy application migration In most cases Yes
Intercore messaging Fast (OS primitives) Slow (application)
Load balancing Yes No
Seamless resource sharing Yes No
Scalable beyond dual CPU Yes Limited
Mixed OS environment No Yes
Thread synchronization between CPU’s Yes No
5
Principles of Parallel Computing
1.3 PARALLELISM SAVES POWER
Multicore reduces average power comsumption. It is becoming harder
to achieve increased processor performance from traditional techniques
such as increasing the clock frequency or developing new architectural
approaches to increase instructions per cycle (IPC). Frequency scaling
of CPU cores is no longer valid, primarily due to power challenges.
An electronic circuit has a capacitance, C, associated with it.
Capacitance is the ability of a circuit to store energy. This can be
defined as;
C 5 charge ðqÞ=voltage ðVÞ;
And the charge on a circuit can therefore be q 5 CV
Work can be defined as the act of pushing something (charge)
across a “distance.” In this discussion we can define this in electrostatic
terms as pushing the charge, q from 0 to V volts in a circuit.
W 5 VTq; or in other terms; W 5 VTCV or W 5 CV2
Power is defined as work over time, or in this discussion it is how
many times a second we oscillate the circuit.
P 5 ðworkÞW=ðtimeÞT and since T 5 1=F then P 5 WF or substituting;
P 5 CV2
F
We can use an example to reflect this. Assuming the circuit in
Figure 1.5.
Input data Output data
Capacitance = C
Voltage = V
Frequency = F
Power = CV²F
Figure 1.5 A simple circuit.
6 Multicore Software Development Techniques
This simple circuit has a capacitance C, a Voltage V, a frequency F,
and therefore a Power defined as P 5 CV2
F
If we instead use a multicore circuit as shown in Figure 1.6, we can
make the following assumptions;
• We will use two cores instead of one
• We will clock this circuit as half the frequency for each of the two
cores
• We will use more circuitry (capacitance C) with two cores instead of
one, plus some additional circuitry to manage these cores, assume
2.1 3 the capacitance
• By reducing the frequency, we can also reduce the voltage across
the circuit, assume we can use a voltage of 0.7 or the single core
circuit (it could be half the single core circuit but lets assume a bit
more for additional overhead)
Given these assumptions, the Power can be defined as
P 5 CV2
F 5 ð2:1Þð0:7Þ2
ð0:5Þ 5 0:5145
What this says is by going from one core to multicore we can
reduce overall power consumption by over 48%, given the conservative
assumptions above.
Input data Output data
Capacitance = 2.1C
Voltage = 0.6V
Frequency = 0.7F
Power = 0.5145CV²F
Input data Output data
Output data
Figure 1.6 A parallel multicore circuit.
7
Principles of Parallel Computing
There are other benefits from going to multicore. When we can
use several smaller simpler cores instead of one big complicated core,
we can achieve more predictable performance and achieve a simpler
programming model in some cases.
1.3.1 Limit: “Hidden Parallelism” Gains are Slowing Down
Application performance has been increasing by 52% per year as mea-
sured by SpecInt benchmarks. This performance was due to transistor
density improvements and architectural changes such as improvements
in Instruction Level Parallelism (ILP)
Superscalar designs provided many forms of parallelism not visible
to programmer, such as
• multiple instruction issue done by the hardware (advances in VLIW
architectures support multiple instruction issue using an optimizing
compiler)
• dynamic scheduling: hardware discovers parallelism between
instructions
• speculative execution: look past predicted branches
• nonblocking caches: multiple outstanding memory ops
The good thing for the software developer is that these
architectural improvements did not require the software developer
to do anything different or unique, all of the work was done by the
hardware. But in the past decade or so, there have been few signifi-
cant changes to keep promoting this performance improvement
further.
1.3.2 Another Limit: Chip Yield and Process Technologies
Semiconductor process technologies are getting very expensive. Process
technologies continue to improve but manufacturing costs and yield
problems limit use of density. As fabrication costs go up, the yield (the
percentage of usable devices) drops.
This is another place where parallelism can help. Generally speaking,
more smaller, simpler processors are easier to design and validate.
Using many of these at the same time is actually a valid business model
used by several multicore vendors.
8 Multicore Software Development Techniques
1.3.3 Another Limit: Basic Laws of Physics and the
Speed of Light
Data needs to travel some distance, r, to get from memory to the CPU.
So to get one data element per cycle, this means 1012
times per second
at the speed of light, c 5 3 3 108
m/s. Thus r , c/1012
5 0.3 mm.
If our goal is lets say 1 teraflop, then we need to put 1 Tbyte of
storage in a 0.3 mm 3 0.3 mm area. At this area, each bit must occupy
about 1 square Angstrom, or the size of a small atom. Obviously this
is not possible today so we have no choice but to move to parallelism.
Also keep in mind that chip density is continuing to increase B2 3
every 2 years, but the clock speed is not. So what is the solution? Well
we need to double the number of processor cores instead. If you
believe that there is little or no hidden parallelism (ILP) to be found,
then parallelism must be exposed to and managed by software.
1.4 KEY CHALLENGES OF PARALLEL COMPUTING
Parallel computing does have some challenges. The key challenges of
parallel and multicore computing can be summarized as follows;
1. Finding enough parallelism
2. Achieving the right level of Granularity
3. Exploiting Locality in computation
4. Proper Load balancing
5. Coordination and synchronization
All of these things makes parallel programming more challenging
than sequential programming. Lets take a look at each of of these.
1.4.1 Finding Enough Parallelism
A computer program always has a sequential part and a parallel part.
What does this mean? Lets start with a simple example below.
1. A 5 B 1 C
2. D 5 A 1 2
3. E 5 D 1 A
4. For (i 5 0; i , E; i11)
5. N(i) 5 0;
9
Principles of Parallel Computing
In this example, steps 1, 2 and 4 are “sequential.” There is a data
dependence that prevents these three instructions from executing in
parallel.
Steps 4 and 5 are parallel. There is no data dependence and
multiple iterations of N(i) can execute in parallel.
Even with E a large number, say 200, the best we can do is to
sequentially execute 4 instructions, no matter how many processors we
have available to us.
Multicore architectures have sensitivity to the structure of software.
In general, parallel execution incurs overheads that limit the expected
execution time benefits that can be achieved. Performance improve-
ments therefore depend on the software algorithms and their imple-
mentations. In some cases, parallel problems can achieve speedup
factors close to the number of cores, or potentially more if the
problem is split up to fit within each core’s cache(s), which avoids
the use of the much slower main system memory. However, as we
will show, many applications cannot be accelerated adequately unless
the application developer spends a significant effort to refactor the
portions of the application.
As an example, we can think of an application as having both
sequential parts and parallel parts as shown in Figure 1.7.
This application, when executed on a single core processor, will
execute sequentially and take a total of 12 time units to complete
(Figure 1.8).
Figure 1.7 An application showing sequential (control) parts and data (parallel) parts.
10 Multicore Software Development Techniques
If we run this same application on a dual core processor
(Figure 1.9), the application will take a total of 7 time units, limited by
the sequential part of the code that cannot execute in parallel due to
reasons we showed earlier.
This is a speedup of 12/7 5 1.7 3 from the single core processor.
If we take this further to a four core system (Figure 1.10), we can
see a total execution time of 5 units for a total speedup of 12/5 5 2.4 3
from the single core processor and 7/5 5 1.4 3 over the 2 core system.
Task
(Control)
Task
(Control)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Figure 1.8 Execution on a single core processor, 12 total time units.
Important—This part cannot be treated in parallel.
This is your performance limit.
CPU
Task
(Control)
Task
(Control)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
CPU
Figure 1.9 Execution on a two core multicore processor, 7 total time units.
CPU
Task
(Control)
Task
(Control)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
Task
(Data)
SPARE
SPARE
CPU
CPU
CPU
Figure 1.10 Execution on a four core multicore processor, 5 total time units.
11
Principles of Parallel Computing
If the fraction of the computation that cannot be divided into
concurrent tasks is f, and no overhead incurs when the computation is
divided into concurrent parts, the time to perform the computation
with n processors is given by tp $ fts 1 [(1 2 f)ts]/n, as shown in
Figure 1.11.
If we use the results from the above example and plot speedup ver-
sus number of cores, we get the plot shown in Figure 1.12.
The general solution to this is called “Amdahl’s Law” and is shown
in Figure 1.13.
Amdahl’s Law states that parallel performance is limited by the
portion of serial code in the algorithm. Specifically:
Speedup 5 1=ðS 1 ð1 2 SÞ=NÞ
3
2.5
2
1.5
Speedup
1
0.5
0
0 0.5 1 1.5 2
Number of cores
Speedup
2.5 3 3.5 4 4.5
Figure 1.12 Speedup trend (# cores versus speedup).
Serial section Parallel section Parallel section ………………Parallel section Parallel section
Serial section Parallel section
Parallel section
………………
Parallel section
Parallel section
One processor
Multiple
processors
n
processors
ts
fts (1–f)ts
(1–f)ts/ n
tp
Figure 1.11 General solution of multicore scalability.
12 Multicore Software Development Techniques
where S is the portion of the algorithm running serialized code and
N is the number of processors running parallelized code.
Amdahl’s Law implies that adding additional cores results in addi-
tional overheads and latencies. These overheads and latencies serialize
execution between communicating and noncommunicating cores by
requiring mechanisms such as hardware barriers, resource contention,
etc. There are also various interdependent sources of latency and
overhead due to processor architecture (e.g., cache coherency), system
latencies and overhead (e.g., processor scheduling), and application
latencies and overhead (e.g., synchronization).
Parallelism overhead comes from areas such as;
• Overhead from starting a thread or process
• Overhead of communicating shared data
• Overhead of synchronizing
• Overhead from extra (redundant) computation required to parallelize
some parallel algorithms
Of couse Amdahl’s Law is sensitive to application workloads
(e.g., data dependencies) and predicts that as the number of cores
increase, the size of the overheads and latencies increases as well.
Lets look at a couple more quick examples:
Assume 95% of a program’s execution time occurs inside a loop
that can be executed in parallel. What is the maximum speedup
14
12
10
8
Speedup
6
4
2
0
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
Number of cores
S = 0.3
S = 0.2
S = 0.1
S = 0.05
Figure 1.13 Amdahl’s Law.
13
Principles of Parallel Computing
we should expect from a parallel version of the program executing
on 8 CPUs?
Speedup 5
1
S 1 1 2 S
N
S 5 Portion of algorithm running serialized code
N 5 Number of Processors running serialized code
95% program’s execution time can be executed in parallel
8 CPUs
S 5 1 2 0.95 5 0.05
N 5 8
Speedup 5
1
0:05 1 1 2 0:05
8
Speedup 5 5.9
Assume 5% of a parallel program’s execution time is spent within
inherently sequential code. What is the maximum speedup achievable
by this program, regardless of how many processing elements
are used?
Speedup 5
1
S 1 1 2 S
N
5% parallel program’s execution time is spent within inherently
sequential code
N 5 N
Speedup 5
1
0:05 1 1 2 0:05
N
5
1
0:05
5 20
Given the impact of these latencies and overhead, the application
developer tuning focus must change to reducing or eliminating these
sources of latency as we will see later.
There are some inherent limmitations to Amdahl’s Law. Its proof
focuses on the steps in a particular algorithm, but does not consider
whether other algorithms with more parallelism may exist. As an
14 Multicore Software Development Techniques
application developer, one should always consider refactoring algorithms
to make them more parallel if possible. Amdahl’s Law also focused on
“fixed” problem sizes such as the processing of a video frame, where sim-
ply adding more cores will eventually have diminishing returns due to the
extra communication overhead incurred as the number of cores increases.
There are other models, such as Gustafson’s Law which models a
multicore system where the proportion of the computations that are
sequential normally decreases as the problem size increases. In other
words, for a system where the problem size is not fixed, the perfor-
mance increases can continue to grow by adding more processors. For
example for a networking application which inputs TCP/IP network
packets, additional cores will allow for more and more network packets
to be processed with very little additional overhead as the number of
packets increases.
Gustafson’s Law states that “Scaled Speedup” 5 N 1 (1 2 N) 3 S,
where S is the serial portion of the algorithm running parallelized and
N is the number of processors. You can see from Figure 1.14 that the
curves do not flatten out as severely as Amdahl’s Law.
This limitation then leads to a tradeoff that the application devel-
oper needs to understand. In each application, the important algorithm
need sufficiently large units of work to run fast in parallel (i.e., large
granularity), but not so large that there is not enough parallel work to
perform.
35
30
25
20
Speedup
15
10
5
0
1 3 5 7 9 11 13 15
Number of cores
S = 0.05
S = 0.1
S = 0.2
S = 0.3
17 19 21 23 25 27 29 31
Figure 1.14 Gustafson’s Law.
15
Principles of Parallel Computing
1.4.2 Data Dependencies
Lets spend a bit more time on data dependencies.
When algorithms are implemented serially, there is a well-defined
operation order which can be very inflexible. In the edge detection
example, for a given data block, the Sobel cannot be computed until
after the smoothing function completes. For other sets of operations,
such as within the correction function, the order in which pixels are
corrected may be irrelevant.
Dependencies between data reads and writes determine the partial
order of computation. There are three types of data dependencies
which limit the ordering: true data dependencies, antidependencies,
and output dependencies (Figure 1.15).
True data dependencies imply an ordering between operations in
which a data value may not be read until after its value has been
written. These are fundamental dependencies in an algorithm, although
it might be possible to refactor algorithms to minimize the impact of
this data dependency.
Antidependencies have the opposite relationship and can possibly be
resolved by variable renaming. In an antidependency, a data value cannot
be written until the previous data value has been read. In Figure 1.15, the
final assignment to A cannot occur before B is assigned, because B needs
the previous value of A. In the final assignment, variable A is renamed to
D, then the B and D assignments may be reordered.
Renaming may increase storage requirements when new variables
are introduced if the lifetimes of the variables overlap as code is
parallelized. Antidependencies are common occurrences in sequential
code. For example, intermediate variables defined outside the loop
may be used within each loop iteration. This is fine when operations
occur sequentially. The same variable storage may be repeatedly
Figure 1.15 Key data dependencies that limit parallelism.
16 Multicore Software Development Techniques
reused. However, when using shared memory, if all iterations were run
in parallel, they would be competing for the same shared intermediate
variable space. One solution would be to have each iteration use its
own local intermediate variables. Minimizing variable lifetimes
through proper scoping helps to avoid these dependency types.
The third type of dependency is an output dependency. In an output
dependency, writes to a variable may not be reordered if they change
the final value of the variable that remains when the instructions
are complete. In Figure 1.15c, the final assignment to A may not be
moved above the first assignment, because the remaining value will
not be correct.
Parallelizing an algorithm requires both honoring dependencies
and appropriately matching the parallelism to the available resources.
Algorithms with a high amount of data dependencies will not parallelize
effectively. When all antidependencies are removed and still partitioning
does not yield acceptable performance, consider changing algorithms to
find an equivalent result using an algorithm which is more amenable
to parallelism. This may not be possible when implementing a standard
with strictly prescribed algorithms. In other cases, there may be effective
ways to achieve similar results.
Data dependencies fundamentally order the code.
Discuss three main types
Analyze code to see where critical dependencies are and if they can
be removed or must be honored
Parallel dependencies are usually not so local—rather between tasks
or iterations.
Lets take a look at some examples;
Loop nest 1
forði 5 0; i , n; i 11 Þf
a½i 5 a½i 2 1 1 b½i
g
Loop 1: a [
0]5 a [
2 1]1 b [
0]
Loop 2: a [
1]5 a [
0]1 b [
1]
. . .. . .
Loop N: a [
N]5 a [
N 2 1]1 b [
N]
17
Principles of Parallel Computing
Here, Loop 2 is dependent on result of Loop 1: To compute a [1],
one needs a [0] which can be obtained from Loop 1. Hence, Loop nest
1 cannot be parallelized because there is a loop carried dependence
flow on the other loop.
Loop nest 2
forði 5 0; i , n; i 11 Þf
a½i 5 a½i 1 b½i
g
Loop 1: a [
0]5 a [
0]1 b [
0]
Loop 2: a [
1]5 a [
1]1 b [
1]
. . .. . .
Loop N: a [
N]5 a [
N]1 b [
N]
Here, Loop nest 2 can be parallelized because the antidependence
from the read of a [i] to the write of a [i] has an (5) direction and it is
not loop carried.
Loop nest 3
forði 5 0; i , n; i 11 Þf
a½4Ti 5 a½2Ti 2 i
g
Loop 1: a [
0]5 a [
2 1]
Loop 2: a [
4]5 a [
1]
. . .. . .
Loop N: a [
4
N]5 a [
2
N 2 1]
We can see that there is no dependency between any loops in Loop
nest 3. Hence, Loop nest 3 can b parallelized.
1.4.3 Achieving the Right Level of Granularity
Granularity can be described as the ratio of computation to communi-
cation in a parallel program. There are two types of granularity as
shown in Figure 1.16;
Fine-grained parallelism implies partitioning the application into
small amounts of work done leading to a low computation to commu-
nication ratio. For example, if we partition a “for” loop into indepen-
dent parallel computions by unrolling the loop, this would be
an example of fine-grained parallelism. One of the downsides to fine-
grained parallelism is that there may be many synchronization points,
18 Multicore Software Development Techniques
for example, the compiler will insert synchronization points after
each loop iteration, that may cause additional overhead. Also, many
loop iterations would have to be parallelized in order to get decent
speedup, but the developer has more control over load balancing the
application.
Coarse-grained parallelism is where there is a high computation to
communication ratio. For example, if we partition an application into
several high level tasks that then get allocated to different cores, this
would be an example of coarse-grained parallelism. The advantage of
this is that there is more parallel code running at any point in time and
there are fewer synchronizations required. However, load balancing
may not be ideal as the higher level tasks are usually not all equivalent
as far as execution time.
Lets take one more example. Lets say we want to multiply each
element of an array, A by a vector X (Figure 1.17). Lets think about
how to decompose this problem into the right level of granularity. The
code for something like this would look like:
for (i 5 0, N 2 1)
for (j 5 0, N 2 1)
y [
i] 5 A [
I,j] 
x [
j];
From this algorithm we can see that each output element of y
depends on one row of A and all of x. All tasks are of the same size in
terms of number of operations.
Application
Task B
Task A Task C
Subtask A.2
Subtask A.1 Subtask A.3 Subtask C.2
Subtask C.1 Subtask C.3
Subtask B.1
Loop B.1.2
Loop B.1.1 Loop B.1.3
Course grained
parallelism
Fine grained
parallelism
Figure 1.16 Course-grained and fine-grained parallelism.
19
Principles of Parallel Computing
How can we break this into tasks? Course-grained with a smaller
number of tasks or fine-grained with a larger number of tasks.
Figure 1.18 shows an example of each.
1.4.4 Locality and Parallelism
As you may know from your introductory computer architecture
courses in college, large memories are slow, fast memories are small
A x y
0 1 n
* =
Figure 1.17 Matrix multiplication with a vector.
A
(a)
(b)
x y
0 1 n
0 1 n
* =
Task 1
Task 2
.
.
.
.
.
.
Task n
A x y
* =
Task 1
Task 2
Figure 1.18 (a) Fine-grained parallelism. (b) Course-grained parallelism.
20 Multicore Software Development Techniques
(Figure 1.19). The slow accesses to “remote” data we can generalize
as “communication.”
In general, storage hierarchies are large and fast. Most multicore
processors have large, fast caches. Of course, our multicore algorithms
should do most work on local data closer to the core.
Lets first discuss how data is accessed. In order to improve perfor-
mance in a multicore system (or any system for that matter) we should
strive for these two goals:
1. Data reuse: when possible reuse the same or nearby data used
multiple times. This approach is mainly Intrinsic in computation
2. Data locality: with this approach the goal is for data to be reused
and to be present in “fast memory” like a cache. Take advantage of
the same data or the same data transfer
Computations that have reuse can achieve locality using appropriate
data placement and layout and with intelligent Code reordering and
transformations.
Some common cache terminology can now be reviewed:
• Cache hit: this is an in-cache memory access and from a computation
perspective is “cheap” in the sense that the access time is generally
only one cycle
• Cache miss: this is a noncached memory access and are computa-
tionally “expensive” in the sense that multiple cycles are required to
Core
On chip
memory
L1 cache
L2 cache
Main memory
Fast
Slow
Figure 1.19 Memory hierarchies.
21
Principles of Parallel Computing
access a noncached memory location, and the CPU must access
next, slower level of memory hierarchy
• Cache line size: this is defined as the number of bytes loaded
together in one entry in the cache. This is usually a few machine
words per entry
• Capacity: this is the amount of data that can be simultaneously
stored in cache at any one time
• Associativity; the way in which cache is designed and used. A
“direct-mapped” cache has only one address (line) in a given range
in cache. An “n-way cache” has n $ 2 lines where different addresses
can be stored
Lets take the example of a matrix multiply. We will consider a
“naïve” version of matrix multiple and a “cache” version. The “naïve”
version is the simple, triply-nested implementation we are typically
taught in school. The “cache” version is a more efficient implementa-
tion that takes the memory hierarchy into account. A typical matrix
multiply is shown in Figure 1.20.
One consideration with matrix multiplication is that row-major ver-
sus column-major storage pattern is language dependent.
Languages like C and C11 use a row-major storage pattern for
2-dimensional matrices. In C/C11, the last index in a multidimen-
sional array indexes contiguous memory locations. In other words, a[i]
[j] and a[i][j 1 1] are adjacent in memory. See Figure 1.21.
Row i
Column j
a11
ai1 ai2 ai3 ain
an1 an2 an3 ann
a12
c11
ci1 ci2
cn1 cn2
c12
cin
cnn
c1n
cij Entry on row i
column j
cnj
c1j
a13 a1n b11
bi1 bi2 bin
bn1 bn2 bnn
b12 b1n
bij
bnj
b1j
Figure 1.20 Matrix multiple algorithm.
22 Multicore Software Development Techniques
The stride between adjacent elements in the same row is 1. The
stride between adjacent elements in the same column is the row length
(10 in the example in Figure 1.21).
This is important because memory access patterns can have a
noticeable impact on performance, especially on systems with a
complicated multilevel memory hierarchy. The code segments in
Figure 1.22 access the same elements of an array, but the order of
accesses is different.
We can see this by looking at code for a “naïve” 512 3 512 matrix
multiple shown in Appendix A. This code was run on a 4 core ARM-
based multicore system shown in Figure 1.23.
The code to perform the matrix-matrix multiply is shown in
Appendix A. Notice the structure of the triply-nested loop in the
_DoParallelMM function: it’s an ijk loop nest where the innermost
loop (k) accesses a different row of B each iteration.
The code for a “cache friendly” matrix-matrix multiply is also in
Appendix A. Interchange the two innermost loops, yielding an ikj loop
nest. The innermost loop (j) should now access a different column of B
during each iteration—along the same row. As we discussed above,
this exhibits better cache behavior.
Access by rows
for (i = 0; i  5; i++)
for (j = 0; j  10; j++)
a[i][j] = ...
Access by columns
for (j = 0; j  10; j++)
for (i = 0; i  5; i++)
a[i][j] = ...
Figure 1.22 Access by rows and by columns.
1 2 3 4 5 6 7 8
0 10 11 12 13 14 15 16 17
9 18 19
1 2 3 4 5 6 7 8
0
10 11 12 13 14 15 16 17
9
18 19
Figure 1.21 Row major storage ordering for C/C11.
23
Principles of Parallel Computing
We can apply additional optimizations, including “blocking.”
“Block” in this discussion does not mean “cache block.” Instead, it
means a subblock within the matrix we are using in this example.
As an example of a “block” we can break our matrix into blocks
N 5 8; sub-block size 5 4
Here is the way it works; Instead of the row access model that we
just described;
/
row access method 
/
for (i 5 0; i , N; i 5 i 1 1)
for (j 5 0; j , N; j 5 j 1 1)
{r 5 0;
for (k 5 0; k , N; k 5 k 1 1){
r 5 r 1 y[i][k]
z[k][j];};
x[i][j] 5 r;
};
With the blocking approach we use two Inner Loops. One loop
reads all N 3 N elements of z[]. The other loop will read N elements
of 1 row of y[] repeatedly. The final step is to write N elements of
1 row of x[].
Subblocks (i.e., Axy) can be treated just like scalars in this example
and we can compute;
C11 5 A11B11 1 A12B21
C12 5 A11B12 1 A12B22
ARM
4K L1 cache
ARM
4K L1 cache
ARM
4K L1 cache
ARM
4K L1 cache
2M shared L2 cache
Figure 1.23 Four core ARM multicore system with private L1 and shared L2 cache.
24 Multicore Software Development Techniques
C21 5 A21B11 1 A22B21
C22 5 A21B12 1 A22B22
Now a “blocked” matrix multiply can be implemented as;
for (jj 5 0; jj , n; jj 1 5 bsize) {
for (i 5 0; i , n; i11)
for (j 5 jj; j , min(jj 1 bsize,n); j11)
c[i][j] 5 0.0;
for (kk 5 0; kk , n; kk 1 5 bsize) {
for (i 5 0; i , n; i11) {
for (j 5 jj; j , min(jj 1 bsize,n); j11) {
sum 5 0.0
for (k 5 kk; k , min(kk 1 bsize,n); k11) {
sum 1 5 a[i][k] 
b[k][j];
}
c[i][j] 1 5 sum;
}
}
}
}
In this example the loop ordering is bijk. The innermost loop pair
multiplies a 1 3 bsize sliver of A by a bsize 3 bsize block of B and
sums into 1 3 bsize sliver of C. We then loop over i steps through n
row slivers of A  C, using the same B (See Figure 1.24).
Here is an excellent summary of cache optimizations (see page 6
in particular): http://www.cs.rochester.edu/Bsandhya/csc252/lectures/
lecture-memopt.pdf
The results are shown in Figure 1.25 part a. As you can see, row
order access is faster than column order access.
Of course we can also increase the number of threads to achieve
higher performance as shown in Figure 1.25 as well. Since this
multicore processor has only has 4 cores, running with more than 4
threads—when threads are compute-bound—only causes the OS to
“thrash” as it switches threads across the cores. At some point, you
can expect the overhead of too many threads to hurt performance and
slow an application down. See the discussion on Amdahl’s Law!
The importance of caching for multicore performance cannot be
overstated.
25
Principles of Parallel Computing
Remember back to my favorite “algorithm”:
High-performance 5 parallelism1memory hierarchy2contention
You to need to not only expose parallelism, but you also need to
take into account the memory hierarchy, and work hard to eliminate/
minimize contention. This becomes increasingly true as the number of
cores grows, and the speed of each core.
kk jj jj
kk
i i
A B C
Row sliver accessed
bsize times
Block reused n
times in succession
Update successive
elements of sliver
Figure 1.24 Blocking optimization for cache.
Multicore optimization
18.000
16.000
14.000
12.000
10.000
8.000
6.000
4.000
2.000
0.000
1 2 3
Naïve cache, increasing
threads
Smart cache,
increasing
Block size, one
thread
Smart cache,
increasing
Block size, 4
threads
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Figure 1.25 (a) Performance of naïve cache with matrix multiply (column order) and increasing threads, (b) row
order and blocking optimizations with just one thread, and (c) row access with blocking caches and four threads
of execution.
26 Multicore Software Development Techniques
1.4.5 Load Imbalance
Load imbalance is the time that processors in the system are idle due
to (Figure 1.26):
• insufficient parallelism (during that phase)
• unequal size tasks
Unequal size tasks can include things like tree-structured computa-
tions and other fundamentally unstructured problem. The algorithm
needs to balance load where possible and the developer should profile
the application on the multicore processor to look for load balancing
issues. Resources can sit idle when load balancing issues are present
(Figure 1.27)
1.4.6 Speedup
“Speedup” is essentially the measure of how much faster a computa-
tion executes versus the best serial code, or algorithmically:
Serial time=parallel time
As an example, suppose I am starting a car wash. I estimate it
takes 20 min to wash a car. It also takes 10 min to set up the
equipment to wash the car, and 15 min to break it down and put
the equipment away. I estimate I will wash 150 cars in a weekend. If I
hire one person to wash all of the cars, how long will this take? What
if I hire 5 people that can all wash cars in parallel? How about 10
in parallel? Figure 1.28 shows the resulting speedup and efficiency
improvements.
Thread 1
Time
Thread 2
Thread 3
Thread 4
Figure 1.26 Load imbalance between threads on a multicore processor.
27
Principles of Parallel Computing
Efficiency can be defined as the measure of how effectively the
computation resources (e.g., threads) are kept busy, or algorithmically:
Speedup=number of threads
Usually this is expressed as the average percentage of nonidle time
Efficiency is important because it is a measure of how busy the
threads are during parallel computations. Low efficiency numbers may
prompt the user to run the application on fewer threads/processors and
free up resources to run something else (another threaded process,
other user’s codes).
The degree of concurrency of a task graph is the number of tasks
that can be executed in parallel. This may vary over the execution, so
we can talk about the maximum or average. The degree of concurrency
increases as the decomposition becomes finer in granularity.
Figure 1.27 Example load balancing for several applications. Source: Geoffrey Blake, Ronald G. Dreslinski, and
Trevor Mudger, University of Michigan.
28 Multicore Software Development Techniques
1.4.7 Directed Graphs
A directed path in a task graph represents a sequence of tasks that
must be processed one after the other. The critical path is the longest
such path. These graphs are normally weighted by the cost of each
task (node), and the path lengths are the sum of weights.
We say that an instruction x precedes an instruction y, sometimes
denoted x , y, if x must complete before y can begin.
In a diagram for the dag, x , y means that there is a positive-length
path from x to y.
If neither x , y nor y , x, we say the instructions are in parallel,
denoted x|y.
In Figure 1.29, we have, for example, 1 , 2, 3 , 10, and 4|22.
When we analyze a DAG as shown in Figure 1.29 we can estimate the
total amount of “work” performed at each node (or instruction). “Work”
is the total amount of time spent in all the instructions in Figure 1.29.
Work Law:Tp $ T1=P
where
Tp: the fastest possible execution time of the application on P
processors
T1: execution time on one processor
The “Span” of a DAG is essentially the “critical path” or the lon-
gest path through the DAG. Similarly, for P processors, the execution
time is never less than the execution time on an infinite number of
processors. Therefore, the Span Law can be stated as:
Span Law:Tp $ TN
Figure 1.28 Speedup and efficiency.
29
Principles of Parallel Computing
Lets look at a quick example of how to compute “Work,” “Span,”
and “Parallelism” but analyzing the DAG in Figure 1.29.
T(P) is the execution time of the program on P processors.
T(1) is the Work
T(N) is the Span
Parallelism 5 T(1)/T(N)
Work:
T(1) 5 30
Span:
T(N) 5 10
which corresponds to the path 1 . 2 . 3 . 22. 27 . 28. 29 .
30 . 26. 31
Parallelism:
T(1)/T(N) 5 30/10 5 3.0
See the excellent discussion by Charles Leiserson on this topic;
http://www.akira.ruc.dk/Bkeld/teaching/IPDC_f10/How_to_Survive_the_
Multicore_Software_Revolution-1.pdf.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 18
19
20
21
22
23
24
25
26
27
28
29
30
Figure 1.29 A directed asyclic graph (DAG).
30 Multicore Software Development Techniques
CHAPTER 2
2
Parallelism in All of Its Forms
There are many forms of parallelism. We have been moving in this
direction for many years, and they take different forms. Some of the key
movements toward parallelism include:
• Bit-level parallelism
• Instruction-level parallelism (ILP)
• Simultaneous multithreading
• Single instruction, multiple data (SIMD)
• Data parallelism
• Task parallelism
• Accelerators/coprocessors
2.1 BIT-LEVEL PARALLELISM
We all know about this. Bit-level parallelism extends the hardware
architecture to operate simultaneously on larger data. For example, on
an 8-bit core, performing computation on a 16-bit data object requires
two instructions. If we extend the word length (the native data length
that a core works with) from 8 to 16, the operation can now be executed
by a single instruction. You’ve seen this happen. As the computer indus-
try has matured, word length has doubled from 4-bit cores through 8-,
16-, 32-, and 64-bit cores.
2.2 INSTRUCTION-LEVEL PARALLELISM (ILP)
Instruction-level parallelism (ILP) is a technique for identifying instruc-
tions that do not depend on each other, such as working with different
variables and executing them at the same time (Figure 2.1). Because pro-
grams are typically sequential in structure, this takes effort which is why
ILP is commonly implemented in the compiler or in superscalar hardware.
Multicore Software Development Techniques. DOI: http://dx.doi.org/10.1016/B978-0-12-800958-1.00002-4
© 2016 Elsevier Inc. All rights reserved.
Certain applications, such as signal processing for voice and video,
can function efficiently in this manner. Other techniques in this area
are speculative and out-of-order execution.
2.3 SIMULTANEOUS MULTITHREADING
With simultaneous multithreading (SMT), instructions from multiple
threads are issued on same cycle. This approach uses register renaming
and dynamic scheduling facilities of multi-issue architecture in the core.
So this approach needs more hardware support, such as additional
register files, program counters for each thread, and temporary result
registers used before commits are performed. There also needs to be
hardware support to sort out which threads get results from which
instructions. The advantage of this approach is that it maximizes the
utilization of the processor execution units. Figure 2.2 shows the distinc-
tion between how a superscalar processor architecture utilizes thread
execution, versus a multiprocessor approach and the hyperthreading (or
SMT) approach.
2.4 SINGLE INSTRUCTION, MULTIPLE DATA (SIMD)
Single instruction, multiple data (SIMD) is one of the architectures of
Flynn’s taxomony shown in Figure 2.3. This approach has been around
for a long time. Since many multimedia operations apply the same set
of instructions to multiple narrow data elements, having a computer
with multiple processing elements that are able to perform the same
operation on multiple data points simultaneously is an advantage.
Figure 2.1 Processor pipeline.
32 Multicore Software Development Techniques
(a) Superscalar
architecture
Thread 0 Thread 1
Time
(CPU
cycles)
(b) Multiprocessor
architecture
(B) Hyper-
threading
Figure 2.2 SMT requires hardware support but allows for multiple threads of execution per core.
Single
data stream
Multiple
data streams
Single
data stream
Single
instruction
Multiple
instruction
streams
Single
instruction
Single
instruction
SISD
(Uniprocessor)
MISD
(Hard to find)
MIMD
(Shared
memory)
SIMD
(Vector or array
processor)
Multiple
data streams
(a) (b)
(c) (d)
……
……
……..
Figure 2.3 Flynn’s taxonomy.
33
Parallelism in All of Its Forms
(Michael) Flynn’s taxonomy is a classification system used for
computer architectures and defines four key classifications.
• Single instruction, single data stream (SISD); this is sequential
computer with no inherent parallelism in the instruction and data
streams. A traditional uniprocessor is an example of SISD.
• Single instruction, multiple data streams (SIMD); this architecture is
designed to allow multiple data streams and a single instruction
stream. This architecture performs operations which are paralleliz-
able. Array processors and graphics processing units fall into this
category.
• Multiple instruction, single data stream (MISD); This architecture is
designed allowmultiple instructions to operate on a single data
stream. This is not too common today but some systems that are
designed for fault tolerance may use this approach (like redundant
systems on the space shuttle).
• Multiple instruction, multiple data streams (MIMD); in this approach
multiple autonomous or independent processors simultaneously exe-
cute different instructions on different data. The multicore superscalar
processors we discussed earlier are examples of MIMD architectures.
With that in mind lets discuss one of the more popular architec-
tures, SIMD. This type of architecture exploits data level parallelism,
but not concurrency. This is because there are simultaneous (or what
we are calling parallel) computations, but only a single process (in this
case, instruction) at a given cycle (Figure 2.4).
X
Y
X*Y
Scalar SIMD
X0 X1 X2 X3
Y0 Y1 Y2 Y3
X0*Y0 X1*Y1 X2*Y2 X3*Y3
* *
Figure 2.4 Scalar versus SIMD operations.
34 Multicore Software Development Techniques
2.5 DATA PARALLELISM
Data parallelism is a parallelism approach where multiple units process
data concurrently. Performance improvement depends on many cores
being able to work on the data at the same time. When the algorithm
is sequential in nature, difficulties arise. For example Crypto protocols,
such as 3DES (triple data encryption standard) and AES (advanced
encryption standard), are sequential in nature and therefore difficult to
parallelize. Matrix operations are easier to parallelize because data is
interlinked to a lesser degree (we have an example of this coming up).
In general, it is not possible to automate data parallelism in hardware
or with a compiler because a reliable, robust algorithm is difficult to
assemble to perform this in an automated way. The developer has to own
part of this process.
Data parallelism represents any kind of parallelism that grows with
the data set size. In this model, the more data you give to the algorithm,
the more tasks you can have and operations on data may be the same
or different. But the key to this approach is its scalability.
Figure 2.5 shows the scalable nature of data parallelism.
Data
Task 1
for (i=m; in; i++) for (i=r; is; i++)
for (j=r;js; j++)
for (j=m;jn; j++)
X[i,j] = sqrt(c * A[i,j]; X[i,j] = sqrt(c * A[i,j];
for (i=u; i; vi++)
for (j=u;jv; j++)
X[i,j] = sqrt(c * A[i,j];
}
}
Task 2 Task n
…
…
…
…
}
}
…
…
…
…
}
}
…
…
...........
…
…
Figure 2.5 Data parallelism is scaleable with the data size.
35
Parallelism in All of Its Forms
In the example in Figure 2.6, an image is decomposed into sections or
“chunks” and partitioned to multiple cores to process in parallel. The
“image in” and “image out” management tasks are usually performed by
one of the cores (an upcoming case study will go into this in more detail).
2.6 TASK PARALLELISM
Task parallelism distributes different applications, processes, or threads
to different units. This can be done either manually or with the help of
the operating system. The challenge with task parallelism is how to
divide the application into multiple threads. For systems with many
small units, such as a computer game, this can be straightforward.
However, when there is only one heavy and well-integrated task, the
partitioning process can be more difficult and often faces the same pro-
blems associated with data parallelism.
Figure 2.7 is an example of task parallelism. Instead of partitioning
data to different cores, the same data is processed by each core (task),
but each task is doing something different on the data.
Filter image
Filter image
Filter image
Filter image
Receive
image
Inspect
image
Image
in
Image
out
Figure 2.6 Data parallel approach.
Identify words
Identify people
Identify things
Identify place
Receive
image
Classify
results
Image
People
Words
Things
Place
Figure 2.7 Task parallel approach.
36 Multicore Software Development Techniques
Exploring the Variety of Random
Documents with Different Content
touch of personal baseness—“am I not something like this?” That is
the moral of Jason and countless personages of Euripides: they are
so detestable and yet so like ourselves. Jason indeed dupes himself
as well as others. He really thinks he is kind and gentle, when he is
only surrendering to an emotional atmosphere. His great weakness
is the mere perfection of his own egotism; he has no power at all to
realize another’s point of view. Throughout the play he simply
refuses to believe that Medea feels his desertion as she asserts. For
him her complaints are “empty words”.[433] To the very end his self-
centred stupidity is almost pathetic: “didst thou in truth determine
on their death for the sake of wifely honour?”[434] One of the most
deadly things in the play hangs on this blindness. Medea has just
asked him, with whatever smile she can summon up, to induce “your
wife” to procure pardon for the children. Jason, instead of destroying
himself on the spot in self-contempt, replies courteously: “By all
means; and I imagine that I shall persuade her, if she is like the rest
of women”.[435] Considering all the circumstances, this is perhaps
unsurpassed for shameless brutality. Medea, however, with a gleam
in her eye which one may imagine, answers with equal urbanity,
even with quiet raillery. She has perhaps no reason to complain; it is
precisely this portentous insensibility which will secure her success.
The minor characters are, in their degree, excellently drawn—
Creon above all. His short scene is unforgettable; it is that familiar
sight—a weak man encouraging himself to firmness by exaggerating
his own severity. His delicious little grumble, “my chivalrous instincts
have got me into trouble more often than I like to think of,”[436]
stamps him as the peer of Dogberry and Justice Shallow.
As a piece of Greek, the Medea is perhaps the finest work of
Euripides. The iambics have a simple brilliance and flexible ease
which had been unknown hitherto, and which indeed were never
rivalled afterwards. Such things as
σὺ γὰρ τί μ’ ἠδίκηκας; ἐξέδου κόρην
ὅτῳ σε θυμὸς ἦγεν,[437]
in Medea’s appeal to Creon, or Jason’s rebuke to her:
πᾶν κέρδος ἡγοῦ ζημιουμένη φυγῇ,[438]
or the expression of her “melting mood”:
ἔτικτον αὐτούς· ζῆν δ’ ὅτ’ ἐξηύχου τέκνα,
εἰσῆλθέ μ’ οἶκτος εἰ γενήσεται τάδε,[439]
are in their unobtrusive way masterpieces of language. But it is in
vain to quote specimens; the whole work is as novel and as great in
linguistic skill as in dramatic art. In particular the speeches of the
nurse at the opening, of Medea when rebuking and again when
conciliating Jason—above all, her fearful soliloquy and address to her
children, touch the summit of dramatic eloquence. The lyric
passages are on the whole less remarkable, but the mystic loveliness
of the ode[440] celebrating the glories of Attica, and the
anapæsts[441] which give so haunting an expression to a parent’s
yearning over his children, are among the most precious things this
tender as well as terrible poet has bequeathed to us.
The Heracleidæ
[442] (Ἡρακλεῖδαι) or Children of Heracles, is a
short[443] play of uncertain date, usually referred to the early years
of the Peloponnesian War (431-404) and by some to the date 422
b.c. Nothing is known as to the companion plays, or the success
obtained by the tetralogy.
The scene is laid before the temple of Zeus at Marathon in Attica.
The young sons of Heracles are discovered with the aged Iolaus,
their father’s comrade, who explains how, after Heracles departed to
Heaven, Eurystheus of Argos has hunted the hero’s family through
Greece. They have taken refuge in Attica; Alcmena, mother of
Heracles, and the daughters are now within the temple; Hyllus, the
eldest son, has gone to seek another refuge in case Athens fails
them. Copreus,[444] a herald from Argos, enters and is dragging the
suppliants away when the chorus of aged Athenians enter. Copreus
disregards their remonstrances, but is confronted by the king,
Demophon, and his brother Acamas. He insists that the Heracleidæ
are Argive subjects: let not Demophon risk war with Argos. Iolaus
appeals for protection, and is granted it; Copreus retires with threats
of instant war. After an ode of defiance by the chorus, Demophon
returns with news that a noble virgin must be sacrificed to
Persephone, and he will not slay an Athenian girl. Iolaus is in
despair, when Macaria, one of Heracles’ daughters, comes forth and
offers herself. After a proud but melancholy farewell she goes. A serf
of Hyllus arrives, bringing, he says, good news. At this Iolaus joyfully
summons Alcmena, who imagines that another herald is assaulting
him; but he announces that Hyllus has returned with a large host of
allies. Iolaus, despite the serf’s rueful gibes, insists on going to the
fray and, dressed in ancient arms from the temple, totters off. The
chorus proclaim the justice of their cause, invoking Zeus and Athena.
The attendant returns with news of complete victory. Iolaus was
taken into Hyllus’ chariot and being (by favour of Heracles and
Hebe) miraculously restored for a while to his youthful vigour,
captured Eurystheus. The chorus celebrate the glory of Athens and
acclaim Heracles, who is now proved (despite report) to be dwelling
in Heaven. Eurystheus is led in and Alcmena gloats over him,
promising him death. The messenger intervenes: Athenians do not
kill prisoners. She insists. Then Eurystheus breaks silence: it was
Hera who forced him to these persecutions, and if he is now slain in
cold blood, a curse will fall on the slayer. The chorus at length accept
Alcmena’s evasion that he be killed and his corpse be given to his
friends. Eurystheus presents Athens with an oracle which declares
that his spirit shall be hostile to the Heracleidæ, when, forgetting
this kindness, they invade Attica.[445] Alcmena bids her attendants
convey Eurystheus within and destroy him. The chorus[446] briefly
express satisfaction at being free from this guilt, and the play ends.
The Heracleidæ is one of the least popular[447] among Euripides’
works. It has indeed unmistakable beauties. The heroic daughter of
Heracles and her proud insistence on no rivalry in her sacrifice have
always moved admiration. The Greek style, moreover, though not
equal to that of the Medea, has all the Euripidean limpidity and ease.
Such lines as
τίς δ’ εἶ σύ; ποῦ σοι συντυχὼν ἀμνημονῶ;[448]
in Iolaus’ conversations with Hyllus’ thrall, and the lyric phrase
ἁ δ’ ἀρετὰ βαίνει διὰ μόχθων[449]
haunt the ear. Moreover, the chivalry with which Demophon and his
citizens champion the helpless must have stirred Athenian hearts.
But our pleasure is repeatedly checked by incidents grotesque,
horrible, or inexplicable. To the first category belongs the absurd
scene in which Iolaus totters away amid badinage to do battle with
Argos. There is a comic note, again, in the scene where Alcmena for
the first time appears and supposes that Hyllus’ messenger is
another hostile herald from Argos. As we know who he is, her attack
on him shows that painful mixture of the pathetic and the ludicrous
which so often marks Euripides’ work; here the comic prevails over
the touching. Secondly, the interview in which Eurystheus is
presented to Alcmena, who gloats at her ease over him, is horrible,
however natural. And finally the inexplicable or at least puzzling
features are perhaps the most striking of all.
The first difficulty concerns the personality which forms the
background of the whole; the apotheosis of Heracles is treated in
equivocal fashion throughout. Iolaus[450] alone seems entirely
convinced. Alcmena, after news of the victory to which her son has
given miraculous aid, utters the candid words:—[451]
After long years, O Zeus, my woes have touched thee,
Yet take my thanks for all that hath been wrought.
My son—though erstwhile I refused belief—
I know in truth doth dwell amid the gods.
And her faith is echoed in less prosaic language[452] by the chorus,
who proclaim the falsehood of the story that Heracles after his
passing by fire went down to the abode of Hades; in truth he dwells
in Heaven and in the golden court lives as the spouse of Hebe. But
these confessions are due to the marvels on the battle-field, marvels
upon which the narrator himself takes pains to throw grave doubt.
[453] Macaria, though she has every reason[454] to dilate on the
glories of her father, speaks of him but briefly and with only the
normal filial respect.[455] Of the others, Copreus ignores him; from
the man’s character we expect sneers and refutations of the
miraculous stories such as are put by our poet in the mouth of
Lycus.[456] Eurystheus speaks of him generously, but in terms which
imply that he has never heard, much less accepted, the marvellous
accounts of his enemy: “I knew thy son was no mere cypher, but in
good sooth a man; for even though he was mine enemy, yet will I
speak well of him, that man of worth”.[457] Demophon himself, the
champion of Heracles’ children, even when he has been reminded
(by Iolaus) how the hero rescued Theseus, father of Demophon,
from Hades itself, in his reply treats this overwhelming claim
ambiguously and with nothing more than politeness.[458] All this
seems to show the dramatist’s belief that Heracles was simply a
“noble man”—an ἐσθλὸς ἀνήρ—whose divine traits are the offspring
of minds like those of Iolaus and Alcmena, whose sagacity
throughout the drama is painfully low.
Macaria’s fate, also, at first sight causes perplexity. After she
leaves the scene, nothing[459] more is heard of her. When and
where she dies we are not told; the promise[460] of Iolaus that she
shall be honoured by him in death, as in life, above all women,
produces no effect—for we are told nothing about her burial;
whether the advent of Hyllus’ reinforcements should or does make
any difference to the necessity for the sacrifice is not discussed. But
there is good reason to suppose that a whole episode, on Macaria’s
death, has been lost.
The army of Hyllus is the most astonishing feature in the play. All
the action and all the pathos depend upon the helplessness which
involves the Heracleidæ. Every other city has rejected them; if
Athens fails all is lost—so we are told repeatedly.[461] Yet at the last
moment Hyllus returns with a positive army. Whence has it come?
How can Iolaus have been ignorant that such aid was possible? We
are told nothing. The Athenian leaders apparently, Iolaus and
Alcmena[462] certainly, receive these incredible tidings with no
feeling save placid satisfaction.
Finally, if this drama is composed in order to extol the nobility of
Athens in espousing the cause of the weak, it is extraordinary that
so dubious an example should be selected. The suppliants are
ancestors of those very Spartans who, when the drama was
produced, were the bitter and dangerous enemies of Athens. Was
not her ancient kindness in saving the first generation of these foes
a piece of folly? Eurystheus points this moral at the close.[463]
Alcmena herself, in her cold ferocity[464] and her quibbling[465] over
the dues of piety, is a clear prophecy of what fifth-century Athenians
most detested in the Spartan character. Moreover, the plea of
Copreus is perfectly just: Argos has a right to punish her own people
if condemned; whether they were wrongly so condemned is no
concern of Athens.
The upshot seems to be that Eurystheus has a bitter quarrel with
a powerful noble, so bitter that when his enemy dies the king dares
not leave his children at large. Through the sentimental weakness of
her ruler Athens is drawn into the dispute, and history shows that
she made a frightful mistake.
The Hippolytus
[466] (Ἱππόλυτος Στεφανίας[467] or Στεφανηφόρος)
was produced in 428 b.c. and obtained the first prize. The scene is
laid in Trœzen before a house belonging to Theseus, King of Athens.
Aphrodite, the goddess of love, speaks the prologue, explaining how
Hippolytus, son of Theseus, scorns her and consorts always with
Artemis, the virgin huntress-deity. Aphrodite therefore has caused
Phædra, the wife of Theseus, to fall in love with her stepson. The
king in his wrath shall bring about the death of his son. The prince
enters followed by his huntsmen, and turning to the statue of
Artemis with a beautiful prayer places garlands upon it, but
disregards the image of Aphrodite. After the hunters have entered
the palace, the chorus of Trœzenian women come to inquire after
the ailing Phædra. She is borne forth, attended by her nurse, who
seeks to calm the feverishness of her mistress and her passionate
longing for the wild regions of the chase. She gradually learns that
the queen is consumed by passion for Hippolytus. Phædra, now
quite calm, describes her fight with temptation; when she saw that
victory was impossible she chose death, and for this reason has
refused food. The nurse offers very different counsel. Why should
Phædra strive against her instincts? Even the gods have erred
through love; she will cure her mistress. The remedy, she soon hints,
is nothing but surrender. At this Phædra is so indignant that the
other again takes refuge in ambiguity; she retires to fetch certain
charms. The ode which follows proclaims the irresistible sway of
love. The queen, in the meantime, has been standing near the
palace-door and now recoils in horror—she has heard Hippolytus
reviling the nurse; nothing, she cries, is now left to her but speedy
death. Hippolytus enters in fury, followed by the nurse. After an
altercation in which he threatens to break his oath of secrecy, he
breaks forth into a lengthy and bitter tirade against women, but
finally promises to keep his oath. When the prince has retired
Phædra proclaims her resolve to avoid shame for her family and
herself by death, obtaining from the chorus a promise not to divulge
what has occurred; at the same time she obscurely threatens
Hippolytus. After she has gone, the chorus voice their yearning to be
free from this world of sin and woe; surely this trouble is a curse
brought by Phædra from her house in Crete, a curse which is even
now forcing her neck into the noose. A messenger rushes forth
crying out that the queen has hanged herself. Theseus returns home
and is speedily apprised of his loss. Suddenly he sees a letter
clutched in his dead wife’s hand; on reading it he announces in fury
that Hippolytus has violated his connubial rights. He appeals to his
father Poseidon, god of the sea, who has promised to grant him any
three prayers, to destroy Hippolytus. The prince returns, and
Theseus, after a stinging attack on his son’s pretensions, banishes
him. Hippolytus is prevented by his oath from defending himself
effectually, and sorrowfully turns away. The chorus ponder upon the
mysterious ways of Heaven and lament the downfall of the brilliant
prince. One of Hippolytus’ attendants returns and informs Theseus
that his son is on the point of death. A gigantic bull, sent by
Poseidon out of the sea, terrified Hippolytus’ horses, which bolted
and mangled their master. Theseus receives these tidings with grim
satisfaction, but the goddess Artemis appears and reveals all the
facts. Theseus is utterly prostrated. Hippolytus is carried in,
lamenting his agony and unmerited fate. Artemis converses with him
affectionately and there follows between the two men a few words
lamenting the curse fulfilled by Poseidon. Artemis consoles her
favourite and disappears. Hippolytus gives his father full forgiveness,
and dies in his embrace.
The main impression left by a repeated study of this magnificent
drama is a sense of the loveliness and delight which the transfusing
genius of a poet can throw around the ruin worked by blind instinct
and hate, even around a whole world tortured by belief in gods
whose supreme intelligence, will, and power, are quick to punish, but
never pardon. No poem in the world conveys more pungently the
aroma of life’s inextinguishable beauty and preciousness. Life does
not become ugly because full of sin or pain. It can only become ugly
by growing unintelligible. So long as it can be understood, it remains
to man, whose joys are all founded upon perception, a thing that
can be loved; this is the one and sufficient reason why tragic drama
is beautiful.
For the writer of the Hippolytus, then, life is something profoundly
sorrowful yet profoundly dear. Hippolytus’ address to Artemis on his
return from the chase is compact of that mystic loveliness which fills
remote glades with a visible presentment of the beauty of holiness:
—
For thee, my Queen, this garland have I twined
Of blossoms from that meadow virginal,
Where neither shepherd dares to graze his flock,
Nor hath the scythe made entry: yet the bee
Doth haunt the mead, that voyager of spring,
’Mid Nature’s shyest charm of stream and verdure.
There may no base man enter; only he,
Who, taught by instinct, uninstructed else,
Hath taken Virtue for his star of life,
May pluck the flow’rets of that pleasance pure.
Come, Queen belovèd, for thy shining hair
Accept this wreath from hands of innocence!
To me alone of all mankind is given
Converse to hold and company with thee,
Hearing thy voice, although thy face be hid.
To the end of life, as now, may I be thine![468]
This passion for natural beauty as the background of emotional life
recurs throughout. The Trœzenian women as they enter tell of their
informant—not “some one talking near the place where men play
draughts,” as in the Medea, but a woman in a picture:—
Where waters leap,
Waters that flow (men say) from the far-off western sea,
Down the rock-face,
And gush from the steep
To a deep place
Where pitchers may dip far down—thence hath come a message
to me.[469]
Phædra in her delirium sees visions of unfettered life “beneath the
poplars, amid the deep grass,” she fancies herself cheering on the
hunting hounds through the pine-glades, and yearns to feel in her
grasp “the iron-pointed shaft”—words to which we come back with
deeper pain when in almost the same language Hippolytus, now
himself delirious, longs to let out his tortured life with a “two-edged
spear”.[470] When she enters the house to seek death, the chorus
pour forth their yearning for escape from the sin and sorrow of this
life to romantic regions where all is grace and unstained peace:—
[471]
In yon precipice-face might I hide me from sorrow,
And God, in his love, of the air make me free!
Ah, to speed with the sea-gulls—alight on the morrow
Where Eridanus mingles his waves with the sea!
There for ever the sisters of Phaethon languish,
For grief of his fate bowing hush’d o’er the stream;
Like eyes in the gloaming, the tears of their anguish
Up through the dark water as amber-drops gleam.
Or far let me wing to the fäery beaches
Where the Maids of the Sunset ’neath apple-boughs dance,
And the Lord of the Waters his last purple reaches
Hath closed to the mariner’s restless advance;
Where from Atlas the sky arches down to the streaming
Of the sea, and the spring of Eternity flows
Where the mansion of Zeus on earth’s bosom is dreaming
’Mid life like a lily and bliss like a rose.
Theseus himself expresses this sense of the fragile beauty of life in
lines[472] which recall the unearthly charm of Sophocles:—
ὄρνις γὰρ ὥς τις ἐκ χερῶν ἄφαντος εἶ,
πήδημ’ ἐς Αἵδου κραιπνὸν ὁρμήσασά μοι.
Even Artemis the unloving can tell of life’s charm surviving death
itself in some wise, an immortality of beautiful remembrance.[473]
Throughout, the poet has used all his power to invest the theme
with loveliness of phrasing. Elsewhere, skilful as his writing is, he
often gives us what is practically prose; the Hippolytus is his nearest
approach to the manner of Sophocles.
Nor is the likeness confined to verbal expression. The theology is,
or claims to be, the theology of Sophocles. The traditional Olympians
are accepted as persons, with the powers and purposes which
current belief attributed to them. This is the view which Sophocles
accepts and expounds. Euripides who certainly did not accept it,
here expounds it—in his own way and with deadly results. Many
times Euripides questions the very existence of these deities, but
now he sees fit to accept them for a moment, and depicts life as
lived under such rulers. Men and women can feel and recreate the
beauty of this world, but these gods time and again dash all into
pitiful fragments. “The world is ruled by stupid fiends, who spend
eternity thwarting one another. Do we dwell in a universe or a
grinning chaos?”
Is this all? Very far from it. Almost all the action of the tragedy
could be accounted for—had we not this disconcerting divine
explanation—on purely “human” lines, though what “human” means
is, as the poet plainly perceives, no less difficult a question than that
of theology. But at least the sorrows of Trœzen scarcely need the
baneful persons of Olympus. For the three sufferers are, after all,
not blameless. They share that casual sinfulness—for we cannot
avoid the use of question-begging words—which is the lot of man.
Hippolytus errs (in Greek eyes) by his complete aversion from sexual
passion; he errs in all eyes by the arrogance with which he proclaims
it. His famous speech[474] is too long for a spontaneous burst of
resentment; it becomes a frigid piece of self-glorification. It is
precisely this arrogance which stings Phædra to the thought of
revenge.[475] Theseus, in spite of the pathetic blindness with which
he imputes[476] his misery to some ancestor’s sin, is the original
cause of it. Hippolytus is the offspring of his youthful incontinence.
[477] Then, when he has “settled down,” it is precisely his
respectable marriage which brings the consequence of his early
amour to fruition; his son and his young wife are of nearly the same
age. As for Phædra herself, the passion which she feels need not be
attributed to a personal goddess. Lawlessness is in her veins; her
mother and sister have both sinned:[478] Crete, “the Isle of Awful
Love,”[479] brands its name upon line after line of the play. For this
predisposition to unchastity many of Euripides’ contemporaries, as of
our own, would have blamed her heartily. The poet himself does not,
as his splendidly sympathetic treatment of her shows; but neither
does he feel any need to lay the blame upon Aphrodite. Phædra’s
offence, her contribution to disaster, lies in her early toying with her
passion, when she founded a shrine of the love-goddess in
Hippolytus’ name;[480] in her accompanying Theseus (apparently
without a struggle) to Trœzen and the society of the prince; in her
determination to punish Hippolytus for his bitter pride.
To banish “the gods” and attribute sin to “heredity,” is that not
merely to substitute one word for another? Yes, but the poet herein
has his eye fixed on formal theology. Well aware that the glib
invocation of “heredity” or “environment” is no more conclusive than
“the will of the gods,” he yet insists that sin is a matter of
psychology. We must study human nature if we mean to understand
and conquer sin. If we regard Aphrodite or Artemis as persons
external to ourselves and of superhuman power we lose all hope of
moral improvement in our own hearts. But if we accept these
devastating powers as forces in human nature, we may hope by
study and self-discipline in some degree to control them.
Thus the drama is full of subtly wise psychology: it is an
interesting comment on much that has been written about “realist”
play-writing that the Hippolytus, which contains some of the most
romantic poetry in Greek literature, is also as sincere and profound
in characterization as the work of Ibsen himself. Theseus and his son
we have already considered; Phædra and her nurse require deeper
study. The latter is a masterpiece among the “minor” characters of
Euripides. Her tenderness for the young queen and passionate desire
at all costs to win her peace; the dignity which life and its
contemplation can give even to coarse-fibred[481] natures; her
feeling for the deepest pathos of life—these things constitute a great
dramatic figure. It is to her that the poet gives his most poignant
expression of that mingled pain and beauty which we discussed a
moment ago:—
But if any far-off state there be,
Dearer than life to mortality;
The hand of the Dark hath hold thereof,
And mist is under and mist above,
And so we are sick for life and cling
On earth to this nameless and shining thing.
For other life is a fountain sealed,
And the deeps below us are unrevealed,
And we drift on legends for ever![482]
She, too, it is who in words[483] of almost equal beauty urges
Phædra to yield to her passion:—
Thy love—why marvel thereat? ’Tis the tale
Of many. Wouldst thou lose thy life for love?
Good sooth! A guerdon strange, if lovers now
And evermore must meet such penalty!
Who shall withstand the Cyprian’s rising flood?
Yield to her spell: she comes in gentleness;
Make high thy pride and stand on niceties,
She flings thee pell-mell into ignominy.
Amid the sky she walks, amid the surge
Of the sea-billows. All things live from her.
The seed is hers and hers the yearning throe
Whence spring we all that tread the ways of earth
Ask them that con the half-forgotten seers
Of elder time, and serve the Muse themselves.
They knew how Zeus once pined for Semele,
How for love’s sake the Goddess of the Dawn
Stooped from her radiant sphere to Cephalus
And stole him to the sky. Yet these abide
In Heaven, nor shun the converse of the gods,
Bowing, belike, to conquering circumstance.
And wilt not thou? Nay, if this law thou spurnest,
Thy sire, when he begat thee, should have writ
Some compact countersigned by gods unknown!
The nurse makes moral weakness into a very religion,[484] and
Phædra’s heart, one would suppose, is finally broken when, to this
appeal that the gods themselves are against her, is added proof that
man is utterly unable to understand. “If thy life had not been in such
danger,” says the nurse, “and thou hadst happened to be a chaste
woman, I should not thus lead thee on,”[485] and again: “Thy duty,
to be sure, forbids sin; but, as things are, be advised by me”.[486]
This hideous purring is perhaps Phædra’s bitterest shame. No one
can understand, except the prince who seems so utterly remote.
Hippolytus, after her death, can say[487]
Unchaste in passion, chaste in soul was she;
Me hath my passionless purity dishonoured.
What does Phædra herself say? Is there any reply to the dreadful
eloquence of her old attendant? There is only one reply conceivable,
and she offers it: “Whatever gods may do, or men think, I must so
act as to be able to respect myself”.[488] Euripides insists that the
centre of ethics lies in man himself. For Phædra there is no soul on
which she can rely but her own; the conflict must be fought out
within herself. The great speech[489] in which she tells her spiritual
history to the chorus without any reserve or faltering, is the kernel of
the tragedy. We realize how empty of all comfort life can be for
those who resolutely reject outworn creeds and turn to seek for a
better. Here is no thought, no hint, of a saviour; the puny soul must
struggle alone with an uncomprehended universe. Æschylus had
found a saviour in Zeus;[490] Euripides can see no comfort in gods
who are less virtuous than men. In this speech, too, we note for the
first time a portrayal of moral temptation and a clear conception of
conscience. Sophocles understands well how duty can brace the soul
to heroic life or death, but for him the sanction of duty lies in the will
of external deities. For Euripides conscience is sufficient as a rule of
conduct.
Phædra is a masterpiece of characterization. Whatever we are to
guess of the earlier[491] picture, she is here a noble and spirited
woman, who cannot help her instincts but who can and will dispute
their power over her life. She is, of course, not perfect—if she were
she would be no fit subject for drama—and the manner in which
Euripides has caused the action to hinge precisely upon her
weaknesses, without lessening our respect and affection, is one of
the most improving studies provided by dramatic art. The little
crevices of circumstance by which wrong-doing—the destruction of
Hippolytus—creeps into her soul are beautifully indicated. She is
wasted by fasting,[492] a state conducive to keener perception and
weaker will. She has been brought—without any attempt on her
part, so surely she may indulge in the disastrous joy[493]—from
Athens to the little town where the prince lives. Her husband, as it
chances,[494] is from home and her life is left empty for “long, long
thoughts”.[495] When she dwells upon her passion the recollection of
her mother’s and her sister’s fate half attracts while it half repels.
[496] Her passionate nature insists on revealing some part of her
distress to the keen eyes of the nurse, who forthwith joins the claims
of old affection[497] to this new secret pain. So it is that she is half-
conquered by what she will not do:—
Nay, in God’s name, forbear! Thy words are vile
But wise withal. Love in my soul too well
Hath mined his way. Urge sin thus winningly
And passion sweeps my fears into the gulf.[498]
But the nurse will not forbear, and the comforting promise of a
charm which shall “still this disease,”[499] as Phædra perhaps half-
suspects,[500] is an undertaking to win Hippolytus. The dread strain
of illness, passion, and shame have turned the woman for a moment
into a nervous child.[501] Thus it comes about that without disgrace,
without forfeiture of her conscience, Phædra moves towards the
dread moment[502] at which she hears the outcry of Hippolytus.
Then after all the anguish, she listens to his intolerable endless
speech! Such is the situation in which murder is conceived. In this
way Hippolytus’ σωφροσύνη has certainly been his undoing.[503]
We are told[504] that this play is a second version of the theme,
and that it was called The Crowned Hippolytus (from the lovely
address to Artemis) to distinguish it from the first, called The Veiled
Hippolytus. This version (now lost) is said to have contained
“improprieties” which the poet afterwards removed. This refers to
the attitude of Phædra, who showed less reserve in her passion than
in the later play. She invoked the moon-goddess, perhaps to aid her
in winning Hippolytus, and boldly pointed to the infidelities of
Theseus as an excuse for her own passion.[505] The reproaches[506]
which Aristophanes lays upon Phædra refer perhaps only to this
earlier version, but his most famous gibe[507] is upon a line[508] of
our text,
ἡ γλῶσσ’ ὀμώμοχ’, ἡ δὲ φρὴν ἀνώμοτος,
“My tongue hath sworn; my soul abides unsworn.” This seems to
give us the measure of the comic poet’s criticism; he blames
Euripides for this sentiment, and yet Hippolytus even in his most
desperate trouble will not clear himself by breaking his oath. One
cannot, however, refrain from pointing out that even if he had
broken it, Theseus would not have believed him,[509] and that
Hippolytus realizes this.[510]
The Hecuba (Ἑκάβη) is the next play in order of date; it was
performed about 425 b.c.[511] This tragedy was enormously popular
throughout antiquity, as the great volume of the scholia proves. It
was one of the three plays—the others were Phœnissæ and Orestes
—used as an Euripidean reading-book in the Byzantine schools.
The scene is laid in Thrace, where the Greeks are encamped after
the fall of Troy; the background is a tent wherein captive Trojan
women are quartered. The ghost of Polydorus, Priam’s youngest son,
tells how he has been murdered by the Thracian king, Polymestor;
he has appeared in a dream to his mother Hecuba. On his
departure, Hecuba enters, and soon learns that her daughter
Polyxena is to be sacrificed at the tomb of Achilles. Odysseus comes
to fetch the maiden, who welcomes death as a relief from slavery.
Soon Talthybius enters, summoning Hecuba to bury Polyxena, whose
noble death has filled the Greeks with admiration. Hecuba sends a
woman to fetch sea-water for the obsequies, and this messenger
returns with the body of Polydorus. Hecuba exclaims that the
murderer is Polymestor: her dream has told her. Agamemnon enters,
and she induces him to connive at her taking vengeance upon the
Thracian, his ally. Next she sends for Polymestor and his children,
and (after a beautiful ode on the last hours of Troy), they arrive.
Polymestor is induced to go with his little sons within the tent, where
they are slaughtered and he himself blinded. His cries bring back
Agamemnon, who rejects the pleas of Polymestor. The Thracian, in
his despair, prophesies the strange end both of Agamemnon and of
Hecuba. He is dragged away, and the drama ends with preparations
for the voyage to Greece.
This tragedy, let it be said plainly, is on the whole poor and
uninteresting.[512] It has been frequently noted, for example, that
the plot is “episodic,” that it falls into two divisions, the story of
Polyxena and the vengeance upon Polymestor, which are really two
small dramas with no genuine connexion. To this it has been replied
that the spiritual history of Hecuba supplies unity to the whole; that
these episodes bring out her development from a victim into a fiend.
[513] But this is scarcely satisfactory. For the two parts are developed
so completely along their several lines, they have so little
dependence upon one another, that they could stand apart; and that
is the real test. Further, the poet himself is uneasy. He is anxious to
make some sort of connexion, but it is curiously adventitious. His
device, that the corpse of Polydorus is discovered by the woman
sent for water wherewith to bathe the body of Polyxena, has won
too high praise. An attempt to strengthen it, or rather to draw
attention to its neatness, is supplied in the conversation between
Hecuba and Agamemnon:[514] “How did he die?” “By the hands of
his Thracian host.” ... “Who brought his body hither?” ... “This
woman. She found it upon the sea-shore.” “Was she looking for it, or
busied with some other task?” The last question is absurd;
Agamemnon has no reason to ask it. Other little hooks,[515] less
obtrusive than this, are provided here and there to connect the two
parts. If the play were an unity they would not be needed.
Again, the favourite charge against Euripides, that he delights in
quasi-judicial disputes, is brought in here also. The accusation is
generally unfair. Critics have been so eager to condemn this poet
that they forget the trial scene of the Eumenides, the altercation
between Œdipus and Creon in the Œdipus at Colonus and various
other passages in the earlier tragedians. If a dispute occurs at all, it
is in accordance with the genius of Greek tragedy to set it out in
formally opposed speeches. One might as well complain of Hamlet’s
soliloquies. But in the Hecuba there is more than this. The queen
has a gusto not merely for eloquent appeals or invective, but for
self-conscious rhetoric, “Filled with lament, not destitute of
tears,”[516] is abominable. One is not surprised to learn that the
queen is interested in professional teachers of rhetoric,[517] and one
remembers that Gorgias, the greatest of them, paid his first visit to
Athens a year or two[518] before this play was produced.
The whole piece in its tone and method is far below the best of
Euripides’ work. Certain things are undoubtedly excellent—the
famous chorus[519] already mentioned, and above all the
speech[520] of Polyxena and the narrative of her death.[521] The
whole work has not enough calibre. The pathos has no subtlety; the
characterization is machine-made; the style, though clear and even
elegant—one must allow that the first speech[522] of Polymestor, as
a piece of conversational Greek, is unobtrusively perfect—has
remarkably few of those feats[523] of idiom which delight us
elsewhere.
Polyxena is charming, but a slight sketch only compared with the
Medea and the Phædra who have preceded her. Agamemnon the
cautious prince, Odysseus the opportunist, Polymestor the brutally
wicked barbarian, are characters whom dozens of Euripides’
contemporaries could have produced with ease. Talthybius the
herald, still more shadowy, claims remembrance by his naïve conceit.
[524] Hecuba herself is hardly better. True, the poet has shown
admirably how she progresses from weakness to frightful strength
under the pressure of injustice, but without any very sympathetic
psychology we fall short of genuine tragedy and touch only
melodrama. And she is more than a little grotesque. Her strange
passion for rhetorical studies we have already noted. She has,
moreover, a taste for inopportune theorizing,[525] even concerning
theology.[526] Her griefs themselves command our respect, and she
can in one or two flashes of inspiration speak of them in
language[527] not unworthy of Shakespeare himself; but there is too
much repetition of merely melancholy adjectives, and though there
should be only one emotion in us towards a woman who has lost all
her children, we can hardly retain it when she reminds us that they
were fifty in number.[528]
The apparition of the murdered Polydorus is an interesting
element in the action. First, we view the early part of the drama with
greater sympathy for the queen, knowing as we do the new horror
which awaits her. Secondly, it is necessary that Hecuba should know
how Polydorus died. Though but vaguely affected by the vision at
first,[529] when parts of it are fulfilled, she remembers and believes
definitely in the rest, and knows that Polymestor is the murderer.
[530]
The Andromache (Ἀνδρομάχη) is perhaps the next[531] extant play
in the order of time. It was not originally brought out at Athens.[532]
The action takes place before the house of Neoptolemus, prince of
Phthia in Thessaly; at one side of the orchestra is the shrine of
Thetis. Andromache delivers the prologue. After the fall of Troy she
became the prize of Neoptolemus to whom she has borne a son,
Molottus. Later the prince married Hermione, daughter of the
Spartan king Menelaus. Andromache has hidden the child and
herself taken sanctuary in the shrine of Thetis; the boy’s father is
from home, having gone to Delphi to ask Apollo’s pardon for
demanding reparation for Achilles’ death. Andromache now sends a
fellow-slave to ask the aid of Peleus, king of Phthia and her master’s
grandfather. Soon she is joined by the chorus, a company of Phthian
women who sympathize but urge submission. Hermione enters, and
after a spiteful altercation, in which she tries in vain to make the
captive leave her sanctuary, departs with threats. Menelaus enters,
leading Molottus; he offers Andromache her choice: will she submit
to death, or see the boy slain? Andromache gives herself up,
whereupon Menelaus announces that, while she must die, Molottus
lies at the mercy of Hermione. By this treachery Andromache is
goaded into the most bitter invective to be found in Euripides. The
chorus dwell upon the folly of domestic irregularities such as those
of Neoptolemus. Next Menelaus leads forth Andromache and
Molottus for death, when Peleus hurries in and releases them. After
a violent quarrel Menelaus throws up his daughter’s cause and
departs. Peleus leads the captives away while the chorus sing his
youthful exploits. From the palace comes Hermione’s nurse:
deserted by her father and dreading her husband’s vengeance the
princess is seeking to destroy herself. Next moment Hermione
rushes out in distraction and the nurse is attempting to calm her
when Orestes enters, explaining that he has called to inquire after
his cousin Hermione. She begs him to take her away to Menelaus
before her husband returns. Orestes agrees, reminding her that she
has in the past been betrothed to him; now Neoptolemus shall pay
for his insults by death at Delphi. After their departure the chorus
sing of the gods who built but abandoned Troy, and of Orestes’
vengeance upon Clytæmnestra. Peleus returns, having heard of
Hermione’s flight. In a moment arrives a messenger who tells how
Neoptolemus has been murdered by Delphians at the instigation of
Orestes. The body is borne in, and Peleus laments over it until
interrupted by the goddess Thetis, his bride of long ago. She
comforts him with a promise of immortality. Andromache is to marry
Helenus, king of Molossia,[533] and her son is to be ancestor of a
dynasty in that land.
Certain remarkable difficulties in the plot must be faced.
First is the breakdown of Menelaus in the presence of Peleus. The
first half of the play has exhibited his unswerving resolve to destroy
Andromache and her child. Every conceivable argument save one
has been addressed to him in vain. That one argument is physical
compulsion, and Peleus certainly does not offer it.[534] After a storm
of mutual abuse the Spartan withdraws from the whole situation,
muttering an excuse which is scarcely meant to be taken seriously:
he is in a hurry to chastise an unfriendly state.[535] He goes just far
enough to embitter his enemies to the utmost and not far enough to
redeem his threats; and he retires without a word to his daughter
after committing her to a deeply dangerous project. Menelaus has
faults, but crass stupidity is not one of them; on the contrary he is
reviled as the type of base cunning. Why, then, does he act with
such utter futility at a crisis which anyone could have foreseen?
In the second place, when was Neoptolemus murdered? Orestes
declares that the prince will be slain at Delphi, and at once departs
with Hermione. After a choric song Peleus comes back, and almost
at once receives the news of his grandson’s death. When Orestes
utters his prophecy the messenger from Delphi can hardly be more
than a mile from the house. Has he already committed the murder
as a prelude to an innocent and irrelevant pilgrimage to Dodona?
And, if so, why does he reveal, or rather not reveal, the fact? And
why has he risked himself in Phthia when the news of his crime may
at any moment be revealed?[536]
Thirdly, there is a grave difficulty in the structure, independent of
Menelaus’ conduct and the dating of Orestes’ crime. The play seems
to fall into two halves with but a slight connexion—the plight of
Andromache and the woes of Neoptolemus’ house.
The late Dr. Verrall’s theory[537] of the play explains all these
things together. Menelaus has come to see that it is to his interest
that his daughter should be the wife of the Argive rather than of the
Phthiote prince. He and Orestes therefore concoct a plan to this end.
Two things must be achieved: Neoptolemus must be removed, and
Hermione, passionately as she loves her lord, must be induced to
accept his assassin. The cunning of Menelaus fastens upon the
failings of his son-in-law as the path to success. First, he has
offended the Delphians, and thus Orestes finds it easy to compass
his death. Second, he has caused bitterness in his own house by his
connexion with Andromache. Menelaus, while Orestes is at Delphi,
urges Hermione into action which her jealousy approves but which
her intellect (when it is allowed to speak) must and does condemn.
The Spartan has no intention of killing the captives, but he sees to it
that Hermione is, in the eyes of Peleus and his subjects, irretrievably
committed to such an intention, which will beyond doubt incense
Neoptolemus most bitterly—or would, were he still alive as Hermione
supposes. Then, when she has committed herself, he calmly bows to
the outburst of Peleus and leaves her ready to snatch at any hope in
her hysterical despair. At this moment, carefully awaited by the
plotters, Orestes appears. He has already murdered Neoptolemus,
and is now ready to take Hermione away. But this is not enough.
She must appear to come by her own suggestion, and it must
appear that she has known at the moment of her elopement what
has happened at Delphi. As she hurries from the scene he utters,
apparently in consolation of her (though really she is out of hearing),
so that it may lodge in the minds of the chorus, a prophecy of
Neoptolemus’ fate. Later, she is to be reminded by her father and
her new suitor how completely she is involved in suspicion of
complicity. Thus she will be thrown into the arms of Orestes, and
whatever blame there is will be laid upon Delphi.[538]
This view should in its essentials be adopted. Every dramatist
commits faults; but these apparent faults in the Andromache prove
too much. They tend to show not that Euripides is here inferior in
construction and psychology to Sophocles, but that he is insane. Few
readers could compose a speech like that of Andromache beginning
ὦ πᾶσιν ἀνθρώποισιν ἔχθιστοι βροτῶν, or like the messenger’s
narrative. But we could all manage the exit of Menelaus better.
There is one great general objection to Verrall’s theory. Is it not
much too subtle? If readers have always missed the point, would not
spectators do so even more certainly? Verrall, in answer, points to a
passage in the Greek Argument: τὸ δὲ δρᾶμα τῶν δευτέρων, which
he takes to mean “this play is one of the sequels”.[539] He believes
that the audience had a sufficient knowledge of the earlier part of
the story to follow the Andromache with no perplexity. Whether this
knowledge was given by an earlier play of Euripides is not of course
certain, but may be regarded as likely.
We next note a feature of equal importance—the atmosphere.
Every reader observes strange anachronisms of sentiment and
allusion—Hermione’s outburst[540] against women who destroy the
confidence between husband and wife, Peleus’ comments on
Lacedæmonian society,[541] and the like, which have no relevance to
the “Homeric age” of the Trojan war. But the whole tone of the play
is unheroic; even if these special features were removed it would
remain quite unlike a Sophoclean drama. Euripides has, in fact,
written a play about his own generation with a definite purpose. He
takes stories from myths as the foundation of his plays, but his
interest is in his own time. In spite of “thy mother Helen” and “the
hapless town of the Phrygians,” his work concerns essentially fifth-
century Athenians. Hence the almost complete absence of poetic
colour, which is only found in the conventional lyrics and the goddess
of the epilogue, who is no more in tune with the rest of the piece
than a fairy-queen would be at the close of A Doll’s House. His chief
concern is the danger to family life involved in the practice of slave-
holding. Neoptolemus loses his life, and Hermione consents to the
wreck of her own happiness, simply because of Andromache’s
position in the home. She is the fulcrum which the astute villains
employ; without her Hermione would never have been manageable.
In harmony with this realistic spirit is the character-drawing. None
of the personages is of heroic stature, but all are amazingly real,
however disagreeable. The two conspirators, Menelaus and Orestes,
of course, do not reveal their natures plainly. The latter, as far as this
incident alone is concerned, might strike one as almost featureless;
but there cling to him significant little fragments from the earlier
history of Hermione. A sinister faithfulness actuates him. In spite of
his repulse he has not forgotten his affection for Hermione, not even
her last words of renunciation.[542] Nor has he ceased to brood on
the insults of Neoptolemus—perhaps nothing in the play is more
effective than the gloomy triumph with which he flings back the
hated word: “and the matricide shall teach thee”.... Menelaus, as a
study in successful villainy combined with the domestic virtues, is
quite perfect in his kind; ces pères de famille sont capables de tout.
But it is upon the three victims, Hermione, Andromache, and Peleus,
that the poet has lavished his skill most notably. Each has precisely
the virtues and the failings which are fit to make them answer with
the precision of machinery to each string pulled by the Spartan
diplomatist. Peleus may be relied upon to provide Menelaus with an
excuse for retiring when he wishes, and to utter wild language which
can be used to prove that he is responsible for Hermione’s flight.
[543] Andromache, earning and receiving our pity for her past woes
and her present anguish, yet alienates us by her arrogance and a
certain metallic brutality in repartee and invective which again are
invaluable to the men whose puppet she is. That she should not
cower before Hermione or her father is natural, but that is not the
point; her trampling tactlessness[544] is a positive disease. She is
indeed (except in her love for Molottus) as callous as Menelaus. This
is a point of absolutely fundamental import. That interview early in
the play, which might have been priceless to both women, ends only
in the hopeless embitterment of Hermione. The latter is the best-
drawn character of all. Swayed by strong primitive impulses, jealousy
and fear, without any balance of mind or emotion, curiously liable to
accept the domination of a stronger personality, she is fatally suited
to the machinations of her father. When she first appears, it is fairly
plain that she has come to suggest a compromise to Andromache.
[545] What she wishes is not blood, but servility. Spiteful and vulgar,
she cannot forgive the captive for the effortless dignity which she
has inherited from Trojan kings. Hers is no vision of a murdered
rival: how petty yet how horribly natural it is—she wishes to see
Andromache scrubbing the floor![546] But vulgar and spiteful as she
is, the princess can be wrought upon, as the later part of the action
shows, and if only to self-respect Andromache had added tact and
sympathy Hermione would have been her passionate friend before
thirty lines had been spoken. The pathos of the scene lies above all
in the misunderstanding which pits the two women against one
another, where they should have combined against the callous craft
which was using them both for the ends of politics.
The deities whom we find in this play need detain us only a
moment. Thetis is no more than sweetening for the popular taste.
Soothing and beautiful as are her consolations to the aged sufferer,
such a personage has no real concern with a drama so utterly
secular. As for Apollo, it is here plainer than usual that his name is
nothing but a convenient short term for the great priestly
organization at Delphi. That there is a genuine divine person who
has aided Orestes and punished Neoptolemus we cannot believe.
The only touch of religious awe to be found lies in the messenger’s
report. When the assassins are fleeing before their courageous
victim, “from the midst of the shrine some one raised an awful voice
whereat the hair stood up, and rallied the host again to fight”.[547] It
is this same speaker, however, who thus sums up his account of the
whole event: “And thus hath he that gives oracles to others, he who
for all mankind is the judge of righteousness, thus hath he entreated
the son of Achilles who offered him amends. Like a man that is base
hath he remembered an ancient grudge. How, then, can he be
wise?” To the simple Thessalian confronted for the first time with
doubts of Olympian justice, such phrasing is natural. For Euripides
the conclusion is that Apollo does not exist at all. “Apollo” does not
take vengeance upon the blasphemer at the time of his offence, but
waits unaccountably till his second visit, when he comes to make
amends and when by an accident, fortunate for the god, a
conspiracy of villainous men happens to make his enemy their
victim.[548]
In keeping with all this is the literary tone of the work. The lyrics
are of little interest to a reader, though one[549] of them markedly
sums up the situation and forces home the moral. For the rest, the
dialogue is utterly unheroic and unpoetical but splendidly vigorous,
terse, and idiomatic; in this respect the Andromache is equal to the
best work of Euripides. Could anything of its kind be more perfect
than the first speech of Hermione[550]—this mixture of pathetic
heart-hunger, of childish snobbery and petulance, this terribly
familiar instinct to cast in the teeth of the unfortunate precisely
those things for which one formerly envied them, these scraps of
ludicrously inaccurate slander against “barbarians” picked up from
the tattle of gossiping slaves, and the heavy preachments about “the
marriage-question” which cry aloud their origin from the lips of
Menelaus? In
δεῖ σ’ ἀντὶ τῶν πρὶν ὀλβίων φρονημάτων
πτῆξαι ταπεινήν, προσπεσεῖν τ’ ἐμὸν γόνυ,
σαίρειν τε δῶμα τοὐμόν, ἐκ χρυσηλάτων
τεύχεων χερὶ σπείρουσαν Ἀχελῴου δρόσον,
γνῶναι θ’ ἵν’ εἶ γῆς,[551]
the last phrase is marvellous. The very sound and fall of the words,
with the two long monosyllables, can only be described as a verbal
box on the ears. Observe too the great speech[552] of Andromache.
In the lines
νῦν δ’ ἐς γυναῖκα γοργὸς ὁπλίτης φανείς
κτείνεις μ’· ἀπόκτειν’, ὡς ἀθώπευτόν γέ σε
γλώσσης ἀφήσω τῆς ἐμῆς καὶ παῖδα σήν,
one can hear the words gurgling in her throat before they issue in
speech; at the end she is positively hissing. Peleus, too, ineffectual
as he may be in argument, is a master of pungent rhetoric.[553]
For readers who admire exclusively the Sophoclean type of play,
the Andromache is a painful experience to be forgotten as soon as
possible. For any who find interest in the behaviour of ordinary
beings at a great testing moment, this work is an endless delight.
The Hercules Furens
[554] or Mad Heracles (Ἡρακλῆς Μαινόμενος) is
perhaps the next play in order of time. Most critics place it about the
year 420 b.c. or a little earlier; the chief reason for this is the
celebrated chorus about old age—it is natural supposition that the
poet had recently passed beyond the military age, and so would now
be just over sixty.
The scene is laid before the house of Heracles at Thebes.
Amphitryon, reputed father of the hero, explains the situation.
Heracles, leaving his wife Megara and his three sons with
Amphitryon, has departed to Hades in quest of Cerberus. In his
absence one Lycus has seized the throne and intends to murder
Heracles’ family. Megara would submit, but Amphitryon still hopes
for Heracles’ return. Certain aged Thebans, who form the chorus,
arrive, followed by Lycus who, after sneers at Heracles, orders his
henchmen to burn his victims in their house. Megara begs of Lycus
that they be given time to array themselves for death. He consents,
and the sufferers retire. Lycus departs, and soon the sad procession
returns. Suddenly Heracles himself enters. He tells that he has
brought back Cerberus and released Theseus, King of Athens, from
the lower world; he promises to destroy Lycus and goes within. A
splendid ode laments the weakness of old age but glorifies the
Muses. Lycus returns, enters the house, and is slain; the chorus
greet his yells with delight and hail Heracles as now proved the son
of Zeus. Suddenly Iris and Frenzy sweep down from the sky, sent by
Hera to drive Heracles mad. Frenzy herself is reluctant, but enters
the house, and the chorus raise cries of horror, amid which the
house totters in ruin. A messenger relates how Heracles, after
slaying Lycus, has been seized with madness and destroyed his wife
and children. The eccyclema shows the hero sunk in stupor. He
awakes and, realizing his situation, meditates suicide, but Theseus
arrives and wins him back to courage; after terrible outbursts
against Heaven he departs to live with Theseus in Athens.
After a cursory reading of this play one’s impressions are doubtful.
Many features excite warm admiration, such as the superb lyric[555]
on old age, the speeches[556] of Megara about her fatherless boys,
Heracles’ replies[557] to Theseus; even the wrangle between Lycus
and Amphitryon is full of idiomatic vigour.[558] But to be blunt, what
is the play about? It works up to a climax in the deliverance of
Amphitryon and his kin, and then begins again. Long before the
close we have forgotten Lycus. We feel that the play is structureless,
or (which is worse) that it falls so clearly into two dramas that we
cannot view it as a single piece of art. But if we seriously seek for
unity, we naturally look for it in the fortunes of Heracles himself. This
granted, we shall expect to find that the incident which in a bare
summary seems to disjoint the whole is specially treated. Looking
then at the incursion of Lycus, we find that at every moment the
events are considered from the point of view of Heracles, in terms of
his actions, and the sentiments which cling to his personality. We are
only prevented from seeing this at first by the modern supposition
that the culmination of a tragedy is the death of a leading person,
not a spiritual crisis. The discussion between Amphitryon and
Megara about instant submission is dominated by despair of the
hero’s return in the latter’s mind and by hope of it in the former’s. As
soon as Lycus arrives, he asks: “What hope, what defence find ye
against death? Believe ye that the father of these lads, he who lies
in Hades, will return?” Whereupon he proceeds to a long tirade in
abuse of the hero, and Amphitryon’s even more garrulous response
deals almost solely with his son’s achievements and the gratitude
which he merits from Thebes and Greece. As the doomed party go
indoors the old man reminds Heaven itself of the help it owes to
Heracles, and the following lyrics are an elaborate chronicle of his
marvellous exploits. Finally, when at point to die, Megara in a
beautifully natural manner turns her farewell to her sons into a
painful memory of the plans which their father used to make for
them. In this way the danger of his family is considered as a test of
Heracles’ powers and greatness. Will he make good the promise of
his past glories? Will he return and free them from Lycus?
Dr. Verrall[559] follows this line of thought, giving to it far greater
precision and colour. He believes that the subject of this play is the
miraculous tone investing the traditional stories about Heracles.
According to popular belief in the poet’s day, Heracles was a son of
Zeus; he performed many exploits which were definitely
superhuman, culminating in a descent to Hades and return
therefrom. These stories are untrue. The play indicates this simply
and directly, giving, however, most attention to the method by which
they won credence. In a primitive civilization, when men had not yet
attained to clear thinking, remarkable but human feats like those of
Heracles were extolled as miraculous by the uncritical. Such are
Amphitryon and the chorus, who when challenged by Lycus are
capable only of violent reiteration of their belief, but offer, and can
offer, no proof that the miracles happened. It is a curious symptom
of the former’s vague credulity that while loving and defending
Heracles as his own son, he yet claims[560] the help of Zeus on the
ground that the god is himself Heracles’ father. The Theban elders
join[561] in this irrational belief—as soon as it appears that the divine
parentage is established by the return from Hades, which even if
true would of course have nothing to do with the question. It is in
such minds as this that belief in the miraculous life of Heracles first
sprang up. But this belief rests largely upon the accounts of his
adventures given by Heracles himself; thus we come to the heart of
the tragedy, the mental condition of the hero.
Near the end he exclaims against the consolations of Theseus:
“Alas! such words as thine are too trivial for my sorrows. I think not
that the gods love unlawful unions, and that they put chains upon
one another is a belief I never held nor will I ever. God, if he be God,
in truth needs naught. These are but poets’ wretched tales.”[562]
Plainly, the sober and reasonable speech which begins thus
repudiates the highly-coloured but pernicious stories of tradition to
which Theseus has just appealed. Heracles believes in one God
utterly above human weaknesses. Then what of Zeus’ love of
Alcmena, the jealousy of Hera, the whole basis of his suffering as
conceived by the orthodox? And what of his own semi-divine nature,
the foundation again of his superhuman deeds? They are delusions.
Heracles is no demi-god; his exploits, however great and valuable,
are in no sense miraculous. This view, moreover, is precisely that
which we ought to gain from the early part of the drama. Lycus is no
doubt an insolent bully, but would certainly not brave annihilation
(whether at the hands of Zeus or of his son) by slaughtering a demi-
god’s family. That he acts so proves that he does not believe in the
divine parentage of Heracles; and the support so readily given by
Thebes to his policy shows as plainly that to the mass of citizens no
real proofs of superhuman nature have been offered. In brief, the
actions and language of every one in the play except Heracles
himself, Amphitryon, and the chorus—of every one, including
Theseus and even Megara, imply that in this play Heracles is indeed
a person of note, but an “eminent man” of no very startling
eminence.
But the hero himself long before this repudiation of “poets’
wretched tales” has himself given them authority. He tells his father
that in truth he has visited Hades, dragged Cerberus thence, and
rescued Theseus. At many places[563] in the drama he refers without
misgiving or query to legendary monsters which he has quelled, and
to his safe return from Hades. This inconsistency, according to Dr.
Verrall, is the root of the drama. Heracles suffers from a growing
tendency to madness; in his sane moods he knows that all his story
is human, all the nobler for its humanity, but in his dark hours he
accepts the vulgar splendours which rumour throws round his
adventures, at such times lending nascent myth the support of his
own false witness. The tragedy of his life has been this mental
distemper, which has finally caused him to destroy his wife and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com

More Related Content

PDF
Multicore Software Development Techniques Applications Tips and Tricks 1st Ed...
PDF
Multicore Software Development Techniques Applications Tips and Tricks 1st Ed...
PDF
Multicore Software Development Techniques Applications Tips and Tricks 1st Ed...
PDF
Real World Multicore Embedded Systems 1st Edition Bryon Moyer
PDF
An Introduction to Parallel Programming 2. Edition Pacheco
PDF
Full Download Real World Multicore Embedded Systems 1st Edition Bryon Moyer P...
PDF
W22 - WebSphere Performance for Multicore and Virtualised Platforms
PPT
Chapter_1.ppt Peter S Pacheco, Matthew Malensek – An Introduction to Parallel...
Multicore Software Development Techniques Applications Tips and Tricks 1st Ed...
Multicore Software Development Techniques Applications Tips and Tricks 1st Ed...
Multicore Software Development Techniques Applications Tips and Tricks 1st Ed...
Real World Multicore Embedded Systems 1st Edition Bryon Moyer
An Introduction to Parallel Programming 2. Edition Pacheco
Full Download Real World Multicore Embedded Systems 1st Edition Bryon Moyer P...
W22 - WebSphere Performance for Multicore and Virtualised Platforms
Chapter_1.ppt Peter S Pacheco, Matthew Malensek – An Introduction to Parallel...

Similar to Multicore Software Development Techniques Applications Tips and Tricks 1st Edition Oshana (20)

PPT
Chapter_1_16_10_2024.pptPeter S Pacheco, Matthew Malensek – An Introduction t...
PPTX
Choosing the right parallel compute architecture
PDF
Programming Massively Parallel Processors A Handson Approach David B Kirk
PPTX
Dori Exterman, Considerations for choosing the parallel computing strategy th...
PPTX
intro, definitions, basic laws+.pptx
PDF
Real-world Concurrency : Notes
PPTX
Multicore processor by Ankit Raj and Akash Prajapati
PDF
0321711378.pdf
PPT
Chapter_1.ppt, why parallel computing? parallel algorithms
PPTX
parellelisum edited_jsdnsfnjdnjfnjdn.pptx
PDF
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
PPTX
Lecture 04 Chapter 1 - Introduction to Parallel Computing
PDF
Uniprocessors to multiprocessors Uniprocessors to multiprocessors
PDF
Refactoring Applications for the XK7 and Future Hybrid Architectures
PDF
A Parallel Computing-a Paradigm to achieve High Performance
PPTX
Computer architecture multi core processor
PPTX
Massively Scalable Applications - TechFerry
PDF
Parallel Computing - Lec 6
DOCX
Multi-Core on Chip Architecture *doc - IK
Chapter_1_16_10_2024.pptPeter S Pacheco, Matthew Malensek – An Introduction t...
Choosing the right parallel compute architecture
Programming Massively Parallel Processors A Handson Approach David B Kirk
Dori Exterman, Considerations for choosing the parallel computing strategy th...
intro, definitions, basic laws+.pptx
Real-world Concurrency : Notes
Multicore processor by Ankit Raj and Akash Prajapati
0321711378.pdf
Chapter_1.ppt, why parallel computing? parallel algorithms
parellelisum edited_jsdnsfnjdnjfnjdn.pptx
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
Lecture 04 Chapter 1 - Introduction to Parallel Computing
Uniprocessors to multiprocessors Uniprocessors to multiprocessors
Refactoring Applications for the XK7 and Future Hybrid Architectures
A Parallel Computing-a Paradigm to achieve High Performance
Computer architecture multi core processor
Massively Scalable Applications - TechFerry
Parallel Computing - Lec 6
Multi-Core on Chip Architecture *doc - IK
Ad

Recently uploaded (20)

PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Insiders guide to clinical Medicine.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
RMMM.pdf make it easy to upload and study
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Cell Structure & Organelles in detailed.
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Computing-Curriculum for Schools in Ghana
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
VCE English Exam - Section C Student Revision Booklet
Insiders guide to clinical Medicine.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
O7-L3 Supply Chain Operations - ICLT Program
RMMM.pdf make it easy to upload and study
Sports Quiz easy sports quiz sports quiz
Pharmacology of Heart Failure /Pharmacotherapy of CHF
2.FourierTransform-ShortQuestionswithAnswers.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Pre independence Education in Inndia.pdf
PPH.pptx obstetrics and gynecology in nursing
Cell Structure & Organelles in detailed.
Complications of Minimal Access Surgery at WLH
Final Presentation General Medicine 03-08-2024.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Supply Chain Operations Speaking Notes -ICLT Program
102 student loan defaulters named and shamed – Is someone you know on the list?
Computing-Curriculum for Schools in Ghana
Ad

Multicore Software Development Techniques Applications Tips and Tricks 1st Edition Oshana

  • 1. Visit https://ebookfinal.com to download the full version and explore more ebooks Multicore Software Development Techniques Applications Tips and Tricks 1st Edition Oshana _____ Click the link below to download _____ https://ebookfinal.com/download/multicore-software- development-techniques-applications-tips-and- tricks-1st-edition-oshana/ Explore and download more ebooks at ebookfinal.com
  • 2. Here are some suggested products you might be interested in. Click the link to download Fundamentals of Multicore Software Development 1st Edition Victor Pankratius https://ebookfinal.com/download/fundamentals-of-multicore-software- development-1st-edition-victor-pankratius/ Oracle Internals Tips Tricks and Techniques for DBAs 1st Edition Donald K. Burleson https://ebookfinal.com/download/oracle-internals-tips-tricks-and- techniques-for-dbas-1st-edition-donald-k-burleson/ GPU Gems Programming Techniques Tips and Tricks for Real Time Graphics 1st Edition Randima Fernando https://ebookfinal.com/download/gpu-gems-programming-techniques-tips- and-tricks-for-real-time-graphics-1st-edition-randima-fernando/ Adobe Photoshop CS3 Top 100 Simplified Tips Tricks Top 100 Simplified Tips Tricks 1st Edition Lynette Kent https://ebookfinal.com/download/adobe-photoshop- cs3-top-100-simplified-tips-tricks-top-100-simplified-tips-tricks-1st- edition-lynette-kent/
  • 3. 100 Game Design Tips Tricks 1st Edition Wlad Marhulets https://ebookfinal.com/download/100-game-design-tips-tricks-1st- edition-wlad-marhulets/ Mac Os Catalina Tricks And Tips 2020 2nd Edition Techgo https://ebookfinal.com/download/mac-os-catalina-tricks-and- tips-2020-2nd-edition-techgo/ John Walkenbach s Favorite Excel 2010 Tips and Tricks 1st Edition John Walkenbach https://ebookfinal.com/download/john-walkenbach-s-favorite- excel-2010-tips-and-tricks-1st-edition-john-walkenbach/ Photoshop Elements 7 Top 100 Simplified Tips Tricks 1st Edition Rob Sheppard https://ebookfinal.com/download/photoshop- elements-7-top-100-simplified-tips-tricks-1st-edition-rob-sheppard/ Expert Cube Development with SSAS Multidimensional Models Expert Tips and Tricks for Designing Analysis Services Multidimensional Models 2nd Edition Alberto Ferrari https://ebookfinal.com/download/expert-cube-development-with-ssas- multidimensional-models-expert-tips-and-tricks-for-designing-analysis- services-multidimensional-models-2nd-edition-alberto-ferrari/
  • 5. Multicore Software Development Techniques Applications Tips and Tricks 1st Edition Oshana Digital Instant Download Author(s): Oshana, Robert ISBN(s): 9780128010372, 0128010371 Edition: 1 File Details: PDF, 18.79 MB Year: 2015 Language: english
  • 7. Multicore Software Development Techniques Applications, Tips, and Tricks Rob Oshana AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO Newnes is an imprint of Elsevier
  • 8. Newnes is an imprint of Elsevier The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, UK 225 Wyman Street, Waltham, MA 02451, USA Copyright r 2016 Elsevier Inc. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher. Details on how to seek permission, further information about the Publisher’s permissions policies and our arrangements with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions. This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted herein). Notices Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary. Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility. To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the material herein. ISBN: 978-0-12-800958-1 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library Library of Congress Cataloging-in-Publication Data A catalog record for this book is available from the Library of Congress For information on all Newnes publications visit our website at http://store.elsevier.com/
  • 9. This book is dedicated to my family, Susan, Sam, and Noah.
  • 10. CHAPTER 1 1 Principles of Parallel Computing A multicore processor is a computing device that contains two or more independent processing elements (referred to as “cores”) integrated on to a single device, that read and execute program instructions. There are many architectural styles of multicore processors, and many application areas, such as embedded processing, graphics processing, and networking. There are many factors driving multicore adoption: • Increases in mobile traffic • Increases in communication between multiple devices • Increase in semiconductor content (e.g., automotive increases in semiconductor content are driving automotive manufacturers to consider multicore to improve affordability, “green” technology, safety, and connectivity, see Figure 1.1) Windows & mirrors Security and access Comfort & information Lighting …………….14 …………..11 .……….18 ………………………….22 Total………….65 Example Figure 1.1 Semiconductor content in automotive is increasing. Multicore Software Development Techniques. DOI: http://dx.doi.org/10.1016/B978-0-12-800958-1.00001-2 © 2016 Elsevier Inc. All rights reserved.
  • 11. A typical multicore processor will have multiple cores which can be the same (homogeneous) or different (heterogeneous) accelerators (the more generic term is “processing element”) for dedicated functions such as video or network acceleration, as well as a number of shared resources (memory, cache, peripherals such as ethernet, display, codecs, UART, etc.) (Figure 1.2) 1.1 CONCURRENCY VERSUS PARALLELISM There are important differences between concurrency and parallelism as they relate to multicore processing. Concurrency: A condition that exists when at least two software tasks are making progress, although at different times. This is a more generalized form of parallelism that can include time-slicing as a form of virtual parallelism. Systems that support concurrency are designed for interruptability. Parallelism: A condition that arises when at least two threads are executing simultaneously. Systems that support parallelism are designed for independentability, such as a multicore system. A program designed to be concurrent may or may not be run in parallel; concurrency is more an attribute of a program, parallelism may occur when it executes (see Figure 1.3). Cores Acceleration Shared resources Figure 1.2 A generic multicore system (left) and an example multicore device from industry (right). 2 Multicore Software Development Techniques
  • 12. It is time to introduce an algorithm that should be memorized when thinking about multicore systems. Here it is: High-performance 5 parallelism 1 memory hierarchy contention • “Parallelism” is all about exposing parallelism in the application • “Memory hierarchy” is all about maximizing data locality in the network, disk, RAM, cache, core, etc. • “Contention” is all about minimizing interactions between cores (e.g., locking, synchronization, etc.) To achieve the best HPC or “High Peformance Computing” result, to get the best performance we need to get the best possible parallelism, use memory efficiently, and reduce the contention. As we move forward we will touch on each of these areas. 1.2 SYMMETRIC AND ASYMMETRIC MULTIPROCESSING Efficiently allocating resources in multicore systems can be a challenge. Depending on the configuration, the multiple software components in these systems may or may not be aware of how other components are using these resources. There are two primary forms of multiprocessing, as shown in Figure 1.4; • Symmetric multiprocessing • Asymmetric multiprocessing Time Time Task 1 Task 2 Task 1 Task 2 Task 1 Task 2 Concurrency Parallelism Figure 1.3 Concurrency versus parallelism. 3 Principles of Parallel Computing
  • 13. 1.2.1 Symmetric Multiprocessing Symmetric multiprocessing (SMP) uses a single copy of the oper- ating system on all of the system’s cores. The operating system has visibility into all system element, and can allocate resources on the multiple cores with little or no guidance from the applica- tion developer. SMP dynamically allocates resources to specific applications rather than to cores which leads to greater utilization of available processing power. Key characteristics of SMP include: A collection of homogeneous cores with a common view of system resources such as sharing a coherent memory space and using CPUs that communicate using a large coherent memory space. Applicable for general purpose applications or applications that may not be entirely known at design time. Applications that my need to suspend because of memory accesses or may need to migrate or restart on any core fit into a SMP model as well. Multithreaded applications are SMP friendly. 1.2.2 Asymmetric Multiprocessing AMP can be: • homogeneous—each CPU runs the same type and version of the operating system • heterogeneous—each CPU runs either a different operating system or a different version of the same operating system In heterogeneous systems, you must either implement a proprietary communications scheme or choose two OSs that share a common Figure 1.4 Asymmetric multiprocessing (left) and symmetric multiprocessing (right). 4 Multicore Software Development Techniques
  • 14. API and infrastructure for interprocessor communications. There must be well-defined and implemented methods for accessing shared resources. In an AMP system, an application process will always runs on the same CPU, even when other CPUs run idle. This can lead to one CPU being under- or overutilized. In some cases it may be possible to migrate a process dynamically from one CPU to another. There may be side effects of doing this, such as requiring checkpointing of state information or a service interruption when the process is halted on one CPU and restarted on another CPU. This is further complicated if the CPUs run different operating systems. In AMP systems, the processor cores communicate using large coherent bus memories, shared local memories, hardware FIFOS, and other direct connections. AMP is better applied to known data-intensive applications where it is better at maximizing efficiency for every task in the system such as audio and video processing. AMP is not as good as a pool of general computing resources. The key reason there are AMP multicore devices is because it is the most economical way to deliver multiprocessing to specific tasks. The performance, energy, and area envelope is much better than SMP. Table 1.1 is a summary of SMP and AMP multicore systems. Table 1.1 Comparison of SMP and AMP Feature SMP AMP Dedicated processor by function No Yes Legacy application migration In most cases Yes Intercore messaging Fast (OS primitives) Slow (application) Load balancing Yes No Seamless resource sharing Yes No Scalable beyond dual CPU Yes Limited Mixed OS environment No Yes Thread synchronization between CPU’s Yes No 5 Principles of Parallel Computing
  • 15. 1.3 PARALLELISM SAVES POWER Multicore reduces average power comsumption. It is becoming harder to achieve increased processor performance from traditional techniques such as increasing the clock frequency or developing new architectural approaches to increase instructions per cycle (IPC). Frequency scaling of CPU cores is no longer valid, primarily due to power challenges. An electronic circuit has a capacitance, C, associated with it. Capacitance is the ability of a circuit to store energy. This can be defined as; C 5 charge ðqÞ=voltage ðVÞ; And the charge on a circuit can therefore be q 5 CV Work can be defined as the act of pushing something (charge) across a “distance.” In this discussion we can define this in electrostatic terms as pushing the charge, q from 0 to V volts in a circuit. W 5 VTq; or in other terms; W 5 VTCV or W 5 CV2 Power is defined as work over time, or in this discussion it is how many times a second we oscillate the circuit. P 5 ðworkÞW=ðtimeÞT and since T 5 1=F then P 5 WF or substituting; P 5 CV2 F We can use an example to reflect this. Assuming the circuit in Figure 1.5. Input data Output data Capacitance = C Voltage = V Frequency = F Power = CV²F Figure 1.5 A simple circuit. 6 Multicore Software Development Techniques
  • 16. This simple circuit has a capacitance C, a Voltage V, a frequency F, and therefore a Power defined as P 5 CV2 F If we instead use a multicore circuit as shown in Figure 1.6, we can make the following assumptions; • We will use two cores instead of one • We will clock this circuit as half the frequency for each of the two cores • We will use more circuitry (capacitance C) with two cores instead of one, plus some additional circuitry to manage these cores, assume 2.1 3 the capacitance • By reducing the frequency, we can also reduce the voltage across the circuit, assume we can use a voltage of 0.7 or the single core circuit (it could be half the single core circuit but lets assume a bit more for additional overhead) Given these assumptions, the Power can be defined as P 5 CV2 F 5 ð2:1Þð0:7Þ2 ð0:5Þ 5 0:5145 What this says is by going from one core to multicore we can reduce overall power consumption by over 48%, given the conservative assumptions above. Input data Output data Capacitance = 2.1C Voltage = 0.6V Frequency = 0.7F Power = 0.5145CV²F Input data Output data Output data Figure 1.6 A parallel multicore circuit. 7 Principles of Parallel Computing
  • 17. There are other benefits from going to multicore. When we can use several smaller simpler cores instead of one big complicated core, we can achieve more predictable performance and achieve a simpler programming model in some cases. 1.3.1 Limit: “Hidden Parallelism” Gains are Slowing Down Application performance has been increasing by 52% per year as mea- sured by SpecInt benchmarks. This performance was due to transistor density improvements and architectural changes such as improvements in Instruction Level Parallelism (ILP) Superscalar designs provided many forms of parallelism not visible to programmer, such as • multiple instruction issue done by the hardware (advances in VLIW architectures support multiple instruction issue using an optimizing compiler) • dynamic scheduling: hardware discovers parallelism between instructions • speculative execution: look past predicted branches • nonblocking caches: multiple outstanding memory ops The good thing for the software developer is that these architectural improvements did not require the software developer to do anything different or unique, all of the work was done by the hardware. But in the past decade or so, there have been few signifi- cant changes to keep promoting this performance improvement further. 1.3.2 Another Limit: Chip Yield and Process Technologies Semiconductor process technologies are getting very expensive. Process technologies continue to improve but manufacturing costs and yield problems limit use of density. As fabrication costs go up, the yield (the percentage of usable devices) drops. This is another place where parallelism can help. Generally speaking, more smaller, simpler processors are easier to design and validate. Using many of these at the same time is actually a valid business model used by several multicore vendors. 8 Multicore Software Development Techniques
  • 18. 1.3.3 Another Limit: Basic Laws of Physics and the Speed of Light Data needs to travel some distance, r, to get from memory to the CPU. So to get one data element per cycle, this means 1012 times per second at the speed of light, c 5 3 3 108 m/s. Thus r , c/1012 5 0.3 mm. If our goal is lets say 1 teraflop, then we need to put 1 Tbyte of storage in a 0.3 mm 3 0.3 mm area. At this area, each bit must occupy about 1 square Angstrom, or the size of a small atom. Obviously this is not possible today so we have no choice but to move to parallelism. Also keep in mind that chip density is continuing to increase B2 3 every 2 years, but the clock speed is not. So what is the solution? Well we need to double the number of processor cores instead. If you believe that there is little or no hidden parallelism (ILP) to be found, then parallelism must be exposed to and managed by software. 1.4 KEY CHALLENGES OF PARALLEL COMPUTING Parallel computing does have some challenges. The key challenges of parallel and multicore computing can be summarized as follows; 1. Finding enough parallelism 2. Achieving the right level of Granularity 3. Exploiting Locality in computation 4. Proper Load balancing 5. Coordination and synchronization All of these things makes parallel programming more challenging than sequential programming. Lets take a look at each of of these. 1.4.1 Finding Enough Parallelism A computer program always has a sequential part and a parallel part. What does this mean? Lets start with a simple example below. 1. A 5 B 1 C 2. D 5 A 1 2 3. E 5 D 1 A 4. For (i 5 0; i , E; i11) 5. N(i) 5 0; 9 Principles of Parallel Computing
  • 19. In this example, steps 1, 2 and 4 are “sequential.” There is a data dependence that prevents these three instructions from executing in parallel. Steps 4 and 5 are parallel. There is no data dependence and multiple iterations of N(i) can execute in parallel. Even with E a large number, say 200, the best we can do is to sequentially execute 4 instructions, no matter how many processors we have available to us. Multicore architectures have sensitivity to the structure of software. In general, parallel execution incurs overheads that limit the expected execution time benefits that can be achieved. Performance improve- ments therefore depend on the software algorithms and their imple- mentations. In some cases, parallel problems can achieve speedup factors close to the number of cores, or potentially more if the problem is split up to fit within each core’s cache(s), which avoids the use of the much slower main system memory. However, as we will show, many applications cannot be accelerated adequately unless the application developer spends a significant effort to refactor the portions of the application. As an example, we can think of an application as having both sequential parts and parallel parts as shown in Figure 1.7. This application, when executed on a single core processor, will execute sequentially and take a total of 12 time units to complete (Figure 1.8). Figure 1.7 An application showing sequential (control) parts and data (parallel) parts. 10 Multicore Software Development Techniques
  • 20. If we run this same application on a dual core processor (Figure 1.9), the application will take a total of 7 time units, limited by the sequential part of the code that cannot execute in parallel due to reasons we showed earlier. This is a speedup of 12/7 5 1.7 3 from the single core processor. If we take this further to a four core system (Figure 1.10), we can see a total execution time of 5 units for a total speedup of 12/5 5 2.4 3 from the single core processor and 7/5 5 1.4 3 over the 2 core system. Task (Control) Task (Control) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Figure 1.8 Execution on a single core processor, 12 total time units. Important—This part cannot be treated in parallel. This is your performance limit. CPU Task (Control) Task (Control) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) CPU Figure 1.9 Execution on a two core multicore processor, 7 total time units. CPU Task (Control) Task (Control) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) Task (Data) SPARE SPARE CPU CPU CPU Figure 1.10 Execution on a four core multicore processor, 5 total time units. 11 Principles of Parallel Computing
  • 21. If the fraction of the computation that cannot be divided into concurrent tasks is f, and no overhead incurs when the computation is divided into concurrent parts, the time to perform the computation with n processors is given by tp $ fts 1 [(1 2 f)ts]/n, as shown in Figure 1.11. If we use the results from the above example and plot speedup ver- sus number of cores, we get the plot shown in Figure 1.12. The general solution to this is called “Amdahl’s Law” and is shown in Figure 1.13. Amdahl’s Law states that parallel performance is limited by the portion of serial code in the algorithm. Specifically: Speedup 5 1=ðS 1 ð1 2 SÞ=NÞ 3 2.5 2 1.5 Speedup 1 0.5 0 0 0.5 1 1.5 2 Number of cores Speedup 2.5 3 3.5 4 4.5 Figure 1.12 Speedup trend (# cores versus speedup). Serial section Parallel section Parallel section ………………Parallel section Parallel section Serial section Parallel section Parallel section ……………… Parallel section Parallel section One processor Multiple processors n processors ts fts (1–f)ts (1–f)ts/ n tp Figure 1.11 General solution of multicore scalability. 12 Multicore Software Development Techniques
  • 22. where S is the portion of the algorithm running serialized code and N is the number of processors running parallelized code. Amdahl’s Law implies that adding additional cores results in addi- tional overheads and latencies. These overheads and latencies serialize execution between communicating and noncommunicating cores by requiring mechanisms such as hardware barriers, resource contention, etc. There are also various interdependent sources of latency and overhead due to processor architecture (e.g., cache coherency), system latencies and overhead (e.g., processor scheduling), and application latencies and overhead (e.g., synchronization). Parallelism overhead comes from areas such as; • Overhead from starting a thread or process • Overhead of communicating shared data • Overhead of synchronizing • Overhead from extra (redundant) computation required to parallelize some parallel algorithms Of couse Amdahl’s Law is sensitive to application workloads (e.g., data dependencies) and predicts that as the number of cores increase, the size of the overheads and latencies increases as well. Lets look at a couple more quick examples: Assume 95% of a program’s execution time occurs inside a loop that can be executed in parallel. What is the maximum speedup 14 12 10 8 Speedup 6 4 2 0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 Number of cores S = 0.3 S = 0.2 S = 0.1 S = 0.05 Figure 1.13 Amdahl’s Law. 13 Principles of Parallel Computing
  • 23. we should expect from a parallel version of the program executing on 8 CPUs? Speedup 5 1 S 1 1 2 S N S 5 Portion of algorithm running serialized code N 5 Number of Processors running serialized code 95% program’s execution time can be executed in parallel 8 CPUs S 5 1 2 0.95 5 0.05 N 5 8 Speedup 5 1 0:05 1 1 2 0:05 8 Speedup 5 5.9 Assume 5% of a parallel program’s execution time is spent within inherently sequential code. What is the maximum speedup achievable by this program, regardless of how many processing elements are used? Speedup 5 1 S 1 1 2 S N 5% parallel program’s execution time is spent within inherently sequential code N 5 N Speedup 5 1 0:05 1 1 2 0:05 N 5 1 0:05 5 20 Given the impact of these latencies and overhead, the application developer tuning focus must change to reducing or eliminating these sources of latency as we will see later. There are some inherent limmitations to Amdahl’s Law. Its proof focuses on the steps in a particular algorithm, but does not consider whether other algorithms with more parallelism may exist. As an 14 Multicore Software Development Techniques
  • 24. application developer, one should always consider refactoring algorithms to make them more parallel if possible. Amdahl’s Law also focused on “fixed” problem sizes such as the processing of a video frame, where sim- ply adding more cores will eventually have diminishing returns due to the extra communication overhead incurred as the number of cores increases. There are other models, such as Gustafson’s Law which models a multicore system where the proportion of the computations that are sequential normally decreases as the problem size increases. In other words, for a system where the problem size is not fixed, the perfor- mance increases can continue to grow by adding more processors. For example for a networking application which inputs TCP/IP network packets, additional cores will allow for more and more network packets to be processed with very little additional overhead as the number of packets increases. Gustafson’s Law states that “Scaled Speedup” 5 N 1 (1 2 N) 3 S, where S is the serial portion of the algorithm running parallelized and N is the number of processors. You can see from Figure 1.14 that the curves do not flatten out as severely as Amdahl’s Law. This limitation then leads to a tradeoff that the application devel- oper needs to understand. In each application, the important algorithm need sufficiently large units of work to run fast in parallel (i.e., large granularity), but not so large that there is not enough parallel work to perform. 35 30 25 20 Speedup 15 10 5 0 1 3 5 7 9 11 13 15 Number of cores S = 0.05 S = 0.1 S = 0.2 S = 0.3 17 19 21 23 25 27 29 31 Figure 1.14 Gustafson’s Law. 15 Principles of Parallel Computing
  • 25. 1.4.2 Data Dependencies Lets spend a bit more time on data dependencies. When algorithms are implemented serially, there is a well-defined operation order which can be very inflexible. In the edge detection example, for a given data block, the Sobel cannot be computed until after the smoothing function completes. For other sets of operations, such as within the correction function, the order in which pixels are corrected may be irrelevant. Dependencies between data reads and writes determine the partial order of computation. There are three types of data dependencies which limit the ordering: true data dependencies, antidependencies, and output dependencies (Figure 1.15). True data dependencies imply an ordering between operations in which a data value may not be read until after its value has been written. These are fundamental dependencies in an algorithm, although it might be possible to refactor algorithms to minimize the impact of this data dependency. Antidependencies have the opposite relationship and can possibly be resolved by variable renaming. In an antidependency, a data value cannot be written until the previous data value has been read. In Figure 1.15, the final assignment to A cannot occur before B is assigned, because B needs the previous value of A. In the final assignment, variable A is renamed to D, then the B and D assignments may be reordered. Renaming may increase storage requirements when new variables are introduced if the lifetimes of the variables overlap as code is parallelized. Antidependencies are common occurrences in sequential code. For example, intermediate variables defined outside the loop may be used within each loop iteration. This is fine when operations occur sequentially. The same variable storage may be repeatedly Figure 1.15 Key data dependencies that limit parallelism. 16 Multicore Software Development Techniques
  • 26. reused. However, when using shared memory, if all iterations were run in parallel, they would be competing for the same shared intermediate variable space. One solution would be to have each iteration use its own local intermediate variables. Minimizing variable lifetimes through proper scoping helps to avoid these dependency types. The third type of dependency is an output dependency. In an output dependency, writes to a variable may not be reordered if they change the final value of the variable that remains when the instructions are complete. In Figure 1.15c, the final assignment to A may not be moved above the first assignment, because the remaining value will not be correct. Parallelizing an algorithm requires both honoring dependencies and appropriately matching the parallelism to the available resources. Algorithms with a high amount of data dependencies will not parallelize effectively. When all antidependencies are removed and still partitioning does not yield acceptable performance, consider changing algorithms to find an equivalent result using an algorithm which is more amenable to parallelism. This may not be possible when implementing a standard with strictly prescribed algorithms. In other cases, there may be effective ways to achieve similar results. Data dependencies fundamentally order the code. Discuss three main types Analyze code to see where critical dependencies are and if they can be removed or must be honored Parallel dependencies are usually not so local—rather between tasks or iterations. Lets take a look at some examples; Loop nest 1 forði 5 0; i , n; i 11 Þf a½i 5 a½i 2 1 1 b½i g Loop 1: a [ 0]5 a [ 2 1]1 b [ 0] Loop 2: a [ 1]5 a [ 0]1 b [ 1] . . .. . . Loop N: a [ N]5 a [ N 2 1]1 b [ N] 17 Principles of Parallel Computing
  • 27. Here, Loop 2 is dependent on result of Loop 1: To compute a [1], one needs a [0] which can be obtained from Loop 1. Hence, Loop nest 1 cannot be parallelized because there is a loop carried dependence flow on the other loop. Loop nest 2 forði 5 0; i , n; i 11 Þf a½i 5 a½i 1 b½i g Loop 1: a [ 0]5 a [ 0]1 b [ 0] Loop 2: a [ 1]5 a [ 1]1 b [ 1] . . .. . . Loop N: a [ N]5 a [ N]1 b [ N] Here, Loop nest 2 can be parallelized because the antidependence from the read of a [i] to the write of a [i] has an (5) direction and it is not loop carried. Loop nest 3 forði 5 0; i , n; i 11 Þf a½4Ti 5 a½2Ti 2 i g Loop 1: a [ 0]5 a [ 2 1] Loop 2: a [ 4]5 a [ 1] . . .. . . Loop N: a [ 4 N]5 a [ 2 N 2 1] We can see that there is no dependency between any loops in Loop nest 3. Hence, Loop nest 3 can b parallelized. 1.4.3 Achieving the Right Level of Granularity Granularity can be described as the ratio of computation to communi- cation in a parallel program. There are two types of granularity as shown in Figure 1.16; Fine-grained parallelism implies partitioning the application into small amounts of work done leading to a low computation to commu- nication ratio. For example, if we partition a “for” loop into indepen- dent parallel computions by unrolling the loop, this would be an example of fine-grained parallelism. One of the downsides to fine- grained parallelism is that there may be many synchronization points, 18 Multicore Software Development Techniques
  • 28. for example, the compiler will insert synchronization points after each loop iteration, that may cause additional overhead. Also, many loop iterations would have to be parallelized in order to get decent speedup, but the developer has more control over load balancing the application. Coarse-grained parallelism is where there is a high computation to communication ratio. For example, if we partition an application into several high level tasks that then get allocated to different cores, this would be an example of coarse-grained parallelism. The advantage of this is that there is more parallel code running at any point in time and there are fewer synchronizations required. However, load balancing may not be ideal as the higher level tasks are usually not all equivalent as far as execution time. Lets take one more example. Lets say we want to multiply each element of an array, A by a vector X (Figure 1.17). Lets think about how to decompose this problem into the right level of granularity. The code for something like this would look like: for (i 5 0, N 2 1) for (j 5 0, N 2 1) y [ i] 5 A [ I,j] x [ j]; From this algorithm we can see that each output element of y depends on one row of A and all of x. All tasks are of the same size in terms of number of operations. Application Task B Task A Task C Subtask A.2 Subtask A.1 Subtask A.3 Subtask C.2 Subtask C.1 Subtask C.3 Subtask B.1 Loop B.1.2 Loop B.1.1 Loop B.1.3 Course grained parallelism Fine grained parallelism Figure 1.16 Course-grained and fine-grained parallelism. 19 Principles of Parallel Computing
  • 29. How can we break this into tasks? Course-grained with a smaller number of tasks or fine-grained with a larger number of tasks. Figure 1.18 shows an example of each. 1.4.4 Locality and Parallelism As you may know from your introductory computer architecture courses in college, large memories are slow, fast memories are small A x y 0 1 n * = Figure 1.17 Matrix multiplication with a vector. A (a) (b) x y 0 1 n 0 1 n * = Task 1 Task 2 . . . . . . Task n A x y * = Task 1 Task 2 Figure 1.18 (a) Fine-grained parallelism. (b) Course-grained parallelism. 20 Multicore Software Development Techniques
  • 30. (Figure 1.19). The slow accesses to “remote” data we can generalize as “communication.” In general, storage hierarchies are large and fast. Most multicore processors have large, fast caches. Of course, our multicore algorithms should do most work on local data closer to the core. Lets first discuss how data is accessed. In order to improve perfor- mance in a multicore system (or any system for that matter) we should strive for these two goals: 1. Data reuse: when possible reuse the same or nearby data used multiple times. This approach is mainly Intrinsic in computation 2. Data locality: with this approach the goal is for data to be reused and to be present in “fast memory” like a cache. Take advantage of the same data or the same data transfer Computations that have reuse can achieve locality using appropriate data placement and layout and with intelligent Code reordering and transformations. Some common cache terminology can now be reviewed: • Cache hit: this is an in-cache memory access and from a computation perspective is “cheap” in the sense that the access time is generally only one cycle • Cache miss: this is a noncached memory access and are computa- tionally “expensive” in the sense that multiple cycles are required to Core On chip memory L1 cache L2 cache Main memory Fast Slow Figure 1.19 Memory hierarchies. 21 Principles of Parallel Computing
  • 31. access a noncached memory location, and the CPU must access next, slower level of memory hierarchy • Cache line size: this is defined as the number of bytes loaded together in one entry in the cache. This is usually a few machine words per entry • Capacity: this is the amount of data that can be simultaneously stored in cache at any one time • Associativity; the way in which cache is designed and used. A “direct-mapped” cache has only one address (line) in a given range in cache. An “n-way cache” has n $ 2 lines where different addresses can be stored Lets take the example of a matrix multiply. We will consider a “naïve” version of matrix multiple and a “cache” version. The “naïve” version is the simple, triply-nested implementation we are typically taught in school. The “cache” version is a more efficient implementa- tion that takes the memory hierarchy into account. A typical matrix multiply is shown in Figure 1.20. One consideration with matrix multiplication is that row-major ver- sus column-major storage pattern is language dependent. Languages like C and C11 use a row-major storage pattern for 2-dimensional matrices. In C/C11, the last index in a multidimen- sional array indexes contiguous memory locations. In other words, a[i] [j] and a[i][j 1 1] are adjacent in memory. See Figure 1.21. Row i Column j a11 ai1 ai2 ai3 ain an1 an2 an3 ann a12 c11 ci1 ci2 cn1 cn2 c12 cin cnn c1n cij Entry on row i column j cnj c1j a13 a1n b11 bi1 bi2 bin bn1 bn2 bnn b12 b1n bij bnj b1j Figure 1.20 Matrix multiple algorithm. 22 Multicore Software Development Techniques
  • 32. The stride between adjacent elements in the same row is 1. The stride between adjacent elements in the same column is the row length (10 in the example in Figure 1.21). This is important because memory access patterns can have a noticeable impact on performance, especially on systems with a complicated multilevel memory hierarchy. The code segments in Figure 1.22 access the same elements of an array, but the order of accesses is different. We can see this by looking at code for a “naïve” 512 3 512 matrix multiple shown in Appendix A. This code was run on a 4 core ARM- based multicore system shown in Figure 1.23. The code to perform the matrix-matrix multiply is shown in Appendix A. Notice the structure of the triply-nested loop in the _DoParallelMM function: it’s an ijk loop nest where the innermost loop (k) accesses a different row of B each iteration. The code for a “cache friendly” matrix-matrix multiply is also in Appendix A. Interchange the two innermost loops, yielding an ikj loop nest. The innermost loop (j) should now access a different column of B during each iteration—along the same row. As we discussed above, this exhibits better cache behavior. Access by rows for (i = 0; i 5; i++) for (j = 0; j 10; j++) a[i][j] = ... Access by columns for (j = 0; j 10; j++) for (i = 0; i 5; i++) a[i][j] = ... Figure 1.22 Access by rows and by columns. 1 2 3 4 5 6 7 8 0 10 11 12 13 14 15 16 17 9 18 19 1 2 3 4 5 6 7 8 0 10 11 12 13 14 15 16 17 9 18 19 Figure 1.21 Row major storage ordering for C/C11. 23 Principles of Parallel Computing
  • 33. We can apply additional optimizations, including “blocking.” “Block” in this discussion does not mean “cache block.” Instead, it means a subblock within the matrix we are using in this example. As an example of a “block” we can break our matrix into blocks N 5 8; sub-block size 5 4 Here is the way it works; Instead of the row access model that we just described; / row access method / for (i 5 0; i , N; i 5 i 1 1) for (j 5 0; j , N; j 5 j 1 1) {r 5 0; for (k 5 0; k , N; k 5 k 1 1){ r 5 r 1 y[i][k] z[k][j];}; x[i][j] 5 r; }; With the blocking approach we use two Inner Loops. One loop reads all N 3 N elements of z[]. The other loop will read N elements of 1 row of y[] repeatedly. The final step is to write N elements of 1 row of x[]. Subblocks (i.e., Axy) can be treated just like scalars in this example and we can compute; C11 5 A11B11 1 A12B21 C12 5 A11B12 1 A12B22 ARM 4K L1 cache ARM 4K L1 cache ARM 4K L1 cache ARM 4K L1 cache 2M shared L2 cache Figure 1.23 Four core ARM multicore system with private L1 and shared L2 cache. 24 Multicore Software Development Techniques
  • 34. C21 5 A21B11 1 A22B21 C22 5 A21B12 1 A22B22 Now a “blocked” matrix multiply can be implemented as; for (jj 5 0; jj , n; jj 1 5 bsize) { for (i 5 0; i , n; i11) for (j 5 jj; j , min(jj 1 bsize,n); j11) c[i][j] 5 0.0; for (kk 5 0; kk , n; kk 1 5 bsize) { for (i 5 0; i , n; i11) { for (j 5 jj; j , min(jj 1 bsize,n); j11) { sum 5 0.0 for (k 5 kk; k , min(kk 1 bsize,n); k11) { sum 1 5 a[i][k] b[k][j]; } c[i][j] 1 5 sum; } } } } In this example the loop ordering is bijk. The innermost loop pair multiplies a 1 3 bsize sliver of A by a bsize 3 bsize block of B and sums into 1 3 bsize sliver of C. We then loop over i steps through n row slivers of A C, using the same B (See Figure 1.24). Here is an excellent summary of cache optimizations (see page 6 in particular): http://www.cs.rochester.edu/Bsandhya/csc252/lectures/ lecture-memopt.pdf The results are shown in Figure 1.25 part a. As you can see, row order access is faster than column order access. Of course we can also increase the number of threads to achieve higher performance as shown in Figure 1.25 as well. Since this multicore processor has only has 4 cores, running with more than 4 threads—when threads are compute-bound—only causes the OS to “thrash” as it switches threads across the cores. At some point, you can expect the overhead of too many threads to hurt performance and slow an application down. See the discussion on Amdahl’s Law! The importance of caching for multicore performance cannot be overstated. 25 Principles of Parallel Computing
  • 35. Remember back to my favorite “algorithm”: High-performance 5 parallelism1memory hierarchy2contention You to need to not only expose parallelism, but you also need to take into account the memory hierarchy, and work hard to eliminate/ minimize contention. This becomes increasingly true as the number of cores grows, and the speed of each core. kk jj jj kk i i A B C Row sliver accessed bsize times Block reused n times in succession Update successive elements of sliver Figure 1.24 Blocking optimization for cache. Multicore optimization 18.000 16.000 14.000 12.000 10.000 8.000 6.000 4.000 2.000 0.000 1 2 3 Naïve cache, increasing threads Smart cache, increasing Block size, one thread Smart cache, increasing Block size, 4 threads 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Figure 1.25 (a) Performance of naïve cache with matrix multiply (column order) and increasing threads, (b) row order and blocking optimizations with just one thread, and (c) row access with blocking caches and four threads of execution. 26 Multicore Software Development Techniques
  • 36. 1.4.5 Load Imbalance Load imbalance is the time that processors in the system are idle due to (Figure 1.26): • insufficient parallelism (during that phase) • unequal size tasks Unequal size tasks can include things like tree-structured computa- tions and other fundamentally unstructured problem. The algorithm needs to balance load where possible and the developer should profile the application on the multicore processor to look for load balancing issues. Resources can sit idle when load balancing issues are present (Figure 1.27) 1.4.6 Speedup “Speedup” is essentially the measure of how much faster a computa- tion executes versus the best serial code, or algorithmically: Serial time=parallel time As an example, suppose I am starting a car wash. I estimate it takes 20 min to wash a car. It also takes 10 min to set up the equipment to wash the car, and 15 min to break it down and put the equipment away. I estimate I will wash 150 cars in a weekend. If I hire one person to wash all of the cars, how long will this take? What if I hire 5 people that can all wash cars in parallel? How about 10 in parallel? Figure 1.28 shows the resulting speedup and efficiency improvements. Thread 1 Time Thread 2 Thread 3 Thread 4 Figure 1.26 Load imbalance between threads on a multicore processor. 27 Principles of Parallel Computing
  • 37. Efficiency can be defined as the measure of how effectively the computation resources (e.g., threads) are kept busy, or algorithmically: Speedup=number of threads Usually this is expressed as the average percentage of nonidle time Efficiency is important because it is a measure of how busy the threads are during parallel computations. Low efficiency numbers may prompt the user to run the application on fewer threads/processors and free up resources to run something else (another threaded process, other user’s codes). The degree of concurrency of a task graph is the number of tasks that can be executed in parallel. This may vary over the execution, so we can talk about the maximum or average. The degree of concurrency increases as the decomposition becomes finer in granularity. Figure 1.27 Example load balancing for several applications. Source: Geoffrey Blake, Ronald G. Dreslinski, and Trevor Mudger, University of Michigan. 28 Multicore Software Development Techniques
  • 38. 1.4.7 Directed Graphs A directed path in a task graph represents a sequence of tasks that must be processed one after the other. The critical path is the longest such path. These graphs are normally weighted by the cost of each task (node), and the path lengths are the sum of weights. We say that an instruction x precedes an instruction y, sometimes denoted x , y, if x must complete before y can begin. In a diagram for the dag, x , y means that there is a positive-length path from x to y. If neither x , y nor y , x, we say the instructions are in parallel, denoted x|y. In Figure 1.29, we have, for example, 1 , 2, 3 , 10, and 4|22. When we analyze a DAG as shown in Figure 1.29 we can estimate the total amount of “work” performed at each node (or instruction). “Work” is the total amount of time spent in all the instructions in Figure 1.29. Work Law:Tp $ T1=P where Tp: the fastest possible execution time of the application on P processors T1: execution time on one processor The “Span” of a DAG is essentially the “critical path” or the lon- gest path through the DAG. Similarly, for P processors, the execution time is never less than the execution time on an infinite number of processors. Therefore, the Span Law can be stated as: Span Law:Tp $ TN Figure 1.28 Speedup and efficiency. 29 Principles of Parallel Computing
  • 39. Lets look at a quick example of how to compute “Work,” “Span,” and “Parallelism” but analyzing the DAG in Figure 1.29. T(P) is the execution time of the program on P processors. T(1) is the Work T(N) is the Span Parallelism 5 T(1)/T(N) Work: T(1) 5 30 Span: T(N) 5 10 which corresponds to the path 1 . 2 . 3 . 22. 27 . 28. 29 . 30 . 26. 31 Parallelism: T(1)/T(N) 5 30/10 5 3.0 See the excellent discussion by Charles Leiserson on this topic; http://www.akira.ruc.dk/Bkeld/teaching/IPDC_f10/How_to_Survive_the_ Multicore_Software_Revolution-1.pdf. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Figure 1.29 A directed asyclic graph (DAG). 30 Multicore Software Development Techniques
  • 40. CHAPTER 2 2 Parallelism in All of Its Forms There are many forms of parallelism. We have been moving in this direction for many years, and they take different forms. Some of the key movements toward parallelism include: • Bit-level parallelism • Instruction-level parallelism (ILP) • Simultaneous multithreading • Single instruction, multiple data (SIMD) • Data parallelism • Task parallelism • Accelerators/coprocessors 2.1 BIT-LEVEL PARALLELISM We all know about this. Bit-level parallelism extends the hardware architecture to operate simultaneously on larger data. For example, on an 8-bit core, performing computation on a 16-bit data object requires two instructions. If we extend the word length (the native data length that a core works with) from 8 to 16, the operation can now be executed by a single instruction. You’ve seen this happen. As the computer indus- try has matured, word length has doubled from 4-bit cores through 8-, 16-, 32-, and 64-bit cores. 2.2 INSTRUCTION-LEVEL PARALLELISM (ILP) Instruction-level parallelism (ILP) is a technique for identifying instruc- tions that do not depend on each other, such as working with different variables and executing them at the same time (Figure 2.1). Because pro- grams are typically sequential in structure, this takes effort which is why ILP is commonly implemented in the compiler or in superscalar hardware. Multicore Software Development Techniques. DOI: http://dx.doi.org/10.1016/B978-0-12-800958-1.00002-4 © 2016 Elsevier Inc. All rights reserved.
  • 41. Certain applications, such as signal processing for voice and video, can function efficiently in this manner. Other techniques in this area are speculative and out-of-order execution. 2.3 SIMULTANEOUS MULTITHREADING With simultaneous multithreading (SMT), instructions from multiple threads are issued on same cycle. This approach uses register renaming and dynamic scheduling facilities of multi-issue architecture in the core. So this approach needs more hardware support, such as additional register files, program counters for each thread, and temporary result registers used before commits are performed. There also needs to be hardware support to sort out which threads get results from which instructions. The advantage of this approach is that it maximizes the utilization of the processor execution units. Figure 2.2 shows the distinc- tion between how a superscalar processor architecture utilizes thread execution, versus a multiprocessor approach and the hyperthreading (or SMT) approach. 2.4 SINGLE INSTRUCTION, MULTIPLE DATA (SIMD) Single instruction, multiple data (SIMD) is one of the architectures of Flynn’s taxomony shown in Figure 2.3. This approach has been around for a long time. Since many multimedia operations apply the same set of instructions to multiple narrow data elements, having a computer with multiple processing elements that are able to perform the same operation on multiple data points simultaneously is an advantage. Figure 2.1 Processor pipeline. 32 Multicore Software Development Techniques
  • 42. (a) Superscalar architecture Thread 0 Thread 1 Time (CPU cycles) (b) Multiprocessor architecture (B) Hyper- threading Figure 2.2 SMT requires hardware support but allows for multiple threads of execution per core. Single data stream Multiple data streams Single data stream Single instruction Multiple instruction streams Single instruction Single instruction SISD (Uniprocessor) MISD (Hard to find) MIMD (Shared memory) SIMD (Vector or array processor) Multiple data streams (a) (b) (c) (d) …… …… …….. Figure 2.3 Flynn’s taxonomy. 33 Parallelism in All of Its Forms
  • 43. (Michael) Flynn’s taxonomy is a classification system used for computer architectures and defines four key classifications. • Single instruction, single data stream (SISD); this is sequential computer with no inherent parallelism in the instruction and data streams. A traditional uniprocessor is an example of SISD. • Single instruction, multiple data streams (SIMD); this architecture is designed to allow multiple data streams and a single instruction stream. This architecture performs operations which are paralleliz- able. Array processors and graphics processing units fall into this category. • Multiple instruction, single data stream (MISD); This architecture is designed allowmultiple instructions to operate on a single data stream. This is not too common today but some systems that are designed for fault tolerance may use this approach (like redundant systems on the space shuttle). • Multiple instruction, multiple data streams (MIMD); in this approach multiple autonomous or independent processors simultaneously exe- cute different instructions on different data. The multicore superscalar processors we discussed earlier are examples of MIMD architectures. With that in mind lets discuss one of the more popular architec- tures, SIMD. This type of architecture exploits data level parallelism, but not concurrency. This is because there are simultaneous (or what we are calling parallel) computations, but only a single process (in this case, instruction) at a given cycle (Figure 2.4). X Y X*Y Scalar SIMD X0 X1 X2 X3 Y0 Y1 Y2 Y3 X0*Y0 X1*Y1 X2*Y2 X3*Y3 * * Figure 2.4 Scalar versus SIMD operations. 34 Multicore Software Development Techniques
  • 44. 2.5 DATA PARALLELISM Data parallelism is a parallelism approach where multiple units process data concurrently. Performance improvement depends on many cores being able to work on the data at the same time. When the algorithm is sequential in nature, difficulties arise. For example Crypto protocols, such as 3DES (triple data encryption standard) and AES (advanced encryption standard), are sequential in nature and therefore difficult to parallelize. Matrix operations are easier to parallelize because data is interlinked to a lesser degree (we have an example of this coming up). In general, it is not possible to automate data parallelism in hardware or with a compiler because a reliable, robust algorithm is difficult to assemble to perform this in an automated way. The developer has to own part of this process. Data parallelism represents any kind of parallelism that grows with the data set size. In this model, the more data you give to the algorithm, the more tasks you can have and operations on data may be the same or different. But the key to this approach is its scalability. Figure 2.5 shows the scalable nature of data parallelism. Data Task 1 for (i=m; in; i++) for (i=r; is; i++) for (j=r;js; j++) for (j=m;jn; j++) X[i,j] = sqrt(c * A[i,j]; X[i,j] = sqrt(c * A[i,j]; for (i=u; i; vi++) for (j=u;jv; j++) X[i,j] = sqrt(c * A[i,j]; } } Task 2 Task n … … … … } } … … … … } } … … ........... … … Figure 2.5 Data parallelism is scaleable with the data size. 35 Parallelism in All of Its Forms
  • 45. In the example in Figure 2.6, an image is decomposed into sections or “chunks” and partitioned to multiple cores to process in parallel. The “image in” and “image out” management tasks are usually performed by one of the cores (an upcoming case study will go into this in more detail). 2.6 TASK PARALLELISM Task parallelism distributes different applications, processes, or threads to different units. This can be done either manually or with the help of the operating system. The challenge with task parallelism is how to divide the application into multiple threads. For systems with many small units, such as a computer game, this can be straightforward. However, when there is only one heavy and well-integrated task, the partitioning process can be more difficult and often faces the same pro- blems associated with data parallelism. Figure 2.7 is an example of task parallelism. Instead of partitioning data to different cores, the same data is processed by each core (task), but each task is doing something different on the data. Filter image Filter image Filter image Filter image Receive image Inspect image Image in Image out Figure 2.6 Data parallel approach. Identify words Identify people Identify things Identify place Receive image Classify results Image People Words Things Place Figure 2.7 Task parallel approach. 36 Multicore Software Development Techniques
  • 46. Exploring the Variety of Random Documents with Different Content
  • 47. touch of personal baseness—“am I not something like this?” That is the moral of Jason and countless personages of Euripides: they are so detestable and yet so like ourselves. Jason indeed dupes himself as well as others. He really thinks he is kind and gentle, when he is only surrendering to an emotional atmosphere. His great weakness is the mere perfection of his own egotism; he has no power at all to realize another’s point of view. Throughout the play he simply refuses to believe that Medea feels his desertion as she asserts. For him her complaints are “empty words”.[433] To the very end his self- centred stupidity is almost pathetic: “didst thou in truth determine on their death for the sake of wifely honour?”[434] One of the most deadly things in the play hangs on this blindness. Medea has just asked him, with whatever smile she can summon up, to induce “your wife” to procure pardon for the children. Jason, instead of destroying himself on the spot in self-contempt, replies courteously: “By all means; and I imagine that I shall persuade her, if she is like the rest of women”.[435] Considering all the circumstances, this is perhaps unsurpassed for shameless brutality. Medea, however, with a gleam in her eye which one may imagine, answers with equal urbanity, even with quiet raillery. She has perhaps no reason to complain; it is precisely this portentous insensibility which will secure her success. The minor characters are, in their degree, excellently drawn— Creon above all. His short scene is unforgettable; it is that familiar sight—a weak man encouraging himself to firmness by exaggerating his own severity. His delicious little grumble, “my chivalrous instincts have got me into trouble more often than I like to think of,”[436] stamps him as the peer of Dogberry and Justice Shallow. As a piece of Greek, the Medea is perhaps the finest work of Euripides. The iambics have a simple brilliance and flexible ease which had been unknown hitherto, and which indeed were never rivalled afterwards. Such things as σὺ γὰρ τί μ’ ἠδίκηκας; ἐξέδου κόρην ὅτῳ σε θυμὸς ἦγεν,[437]
  • 48. in Medea’s appeal to Creon, or Jason’s rebuke to her: πᾶν κέρδος ἡγοῦ ζημιουμένη φυγῇ,[438] or the expression of her “melting mood”: ἔτικτον αὐτούς· ζῆν δ’ ὅτ’ ἐξηύχου τέκνα, εἰσῆλθέ μ’ οἶκτος εἰ γενήσεται τάδε,[439] are in their unobtrusive way masterpieces of language. But it is in vain to quote specimens; the whole work is as novel and as great in linguistic skill as in dramatic art. In particular the speeches of the nurse at the opening, of Medea when rebuking and again when conciliating Jason—above all, her fearful soliloquy and address to her children, touch the summit of dramatic eloquence. The lyric passages are on the whole less remarkable, but the mystic loveliness of the ode[440] celebrating the glories of Attica, and the anapæsts[441] which give so haunting an expression to a parent’s yearning over his children, are among the most precious things this tender as well as terrible poet has bequeathed to us. The Heracleidæ [442] (Ἡρακλεῖδαι) or Children of Heracles, is a short[443] play of uncertain date, usually referred to the early years of the Peloponnesian War (431-404) and by some to the date 422 b.c. Nothing is known as to the companion plays, or the success obtained by the tetralogy. The scene is laid before the temple of Zeus at Marathon in Attica. The young sons of Heracles are discovered with the aged Iolaus, their father’s comrade, who explains how, after Heracles departed to Heaven, Eurystheus of Argos has hunted the hero’s family through Greece. They have taken refuge in Attica; Alcmena, mother of Heracles, and the daughters are now within the temple; Hyllus, the eldest son, has gone to seek another refuge in case Athens fails them. Copreus,[444] a herald from Argos, enters and is dragging the suppliants away when the chorus of aged Athenians enter. Copreus
  • 49. disregards their remonstrances, but is confronted by the king, Demophon, and his brother Acamas. He insists that the Heracleidæ are Argive subjects: let not Demophon risk war with Argos. Iolaus appeals for protection, and is granted it; Copreus retires with threats of instant war. After an ode of defiance by the chorus, Demophon returns with news that a noble virgin must be sacrificed to Persephone, and he will not slay an Athenian girl. Iolaus is in despair, when Macaria, one of Heracles’ daughters, comes forth and offers herself. After a proud but melancholy farewell she goes. A serf of Hyllus arrives, bringing, he says, good news. At this Iolaus joyfully summons Alcmena, who imagines that another herald is assaulting him; but he announces that Hyllus has returned with a large host of allies. Iolaus, despite the serf’s rueful gibes, insists on going to the fray and, dressed in ancient arms from the temple, totters off. The chorus proclaim the justice of their cause, invoking Zeus and Athena. The attendant returns with news of complete victory. Iolaus was taken into Hyllus’ chariot and being (by favour of Heracles and Hebe) miraculously restored for a while to his youthful vigour, captured Eurystheus. The chorus celebrate the glory of Athens and acclaim Heracles, who is now proved (despite report) to be dwelling in Heaven. Eurystheus is led in and Alcmena gloats over him, promising him death. The messenger intervenes: Athenians do not kill prisoners. She insists. Then Eurystheus breaks silence: it was Hera who forced him to these persecutions, and if he is now slain in cold blood, a curse will fall on the slayer. The chorus at length accept Alcmena’s evasion that he be killed and his corpse be given to his friends. Eurystheus presents Athens with an oracle which declares that his spirit shall be hostile to the Heracleidæ, when, forgetting this kindness, they invade Attica.[445] Alcmena bids her attendants convey Eurystheus within and destroy him. The chorus[446] briefly express satisfaction at being free from this guilt, and the play ends. The Heracleidæ is one of the least popular[447] among Euripides’ works. It has indeed unmistakable beauties. The heroic daughter of Heracles and her proud insistence on no rivalry in her sacrifice have always moved admiration. The Greek style, moreover, though not
  • 50. equal to that of the Medea, has all the Euripidean limpidity and ease. Such lines as τίς δ’ εἶ σύ; ποῦ σοι συντυχὼν ἀμνημονῶ;[448] in Iolaus’ conversations with Hyllus’ thrall, and the lyric phrase ἁ δ’ ἀρετὰ βαίνει διὰ μόχθων[449] haunt the ear. Moreover, the chivalry with which Demophon and his citizens champion the helpless must have stirred Athenian hearts. But our pleasure is repeatedly checked by incidents grotesque, horrible, or inexplicable. To the first category belongs the absurd scene in which Iolaus totters away amid badinage to do battle with Argos. There is a comic note, again, in the scene where Alcmena for the first time appears and supposes that Hyllus’ messenger is another hostile herald from Argos. As we know who he is, her attack on him shows that painful mixture of the pathetic and the ludicrous which so often marks Euripides’ work; here the comic prevails over the touching. Secondly, the interview in which Eurystheus is presented to Alcmena, who gloats at her ease over him, is horrible, however natural. And finally the inexplicable or at least puzzling features are perhaps the most striking of all. The first difficulty concerns the personality which forms the background of the whole; the apotheosis of Heracles is treated in equivocal fashion throughout. Iolaus[450] alone seems entirely convinced. Alcmena, after news of the victory to which her son has given miraculous aid, utters the candid words:—[451] After long years, O Zeus, my woes have touched thee, Yet take my thanks for all that hath been wrought. My son—though erstwhile I refused belief— I know in truth doth dwell amid the gods.
  • 51. And her faith is echoed in less prosaic language[452] by the chorus, who proclaim the falsehood of the story that Heracles after his passing by fire went down to the abode of Hades; in truth he dwells in Heaven and in the golden court lives as the spouse of Hebe. But these confessions are due to the marvels on the battle-field, marvels upon which the narrator himself takes pains to throw grave doubt. [453] Macaria, though she has every reason[454] to dilate on the glories of her father, speaks of him but briefly and with only the normal filial respect.[455] Of the others, Copreus ignores him; from the man’s character we expect sneers and refutations of the miraculous stories such as are put by our poet in the mouth of Lycus.[456] Eurystheus speaks of him generously, but in terms which imply that he has never heard, much less accepted, the marvellous accounts of his enemy: “I knew thy son was no mere cypher, but in good sooth a man; for even though he was mine enemy, yet will I speak well of him, that man of worth”.[457] Demophon himself, the champion of Heracles’ children, even when he has been reminded (by Iolaus) how the hero rescued Theseus, father of Demophon, from Hades itself, in his reply treats this overwhelming claim ambiguously and with nothing more than politeness.[458] All this seems to show the dramatist’s belief that Heracles was simply a “noble man”—an ἐσθλὸς ἀνήρ—whose divine traits are the offspring of minds like those of Iolaus and Alcmena, whose sagacity throughout the drama is painfully low. Macaria’s fate, also, at first sight causes perplexity. After she leaves the scene, nothing[459] more is heard of her. When and where she dies we are not told; the promise[460] of Iolaus that she shall be honoured by him in death, as in life, above all women, produces no effect—for we are told nothing about her burial; whether the advent of Hyllus’ reinforcements should or does make any difference to the necessity for the sacrifice is not discussed. But there is good reason to suppose that a whole episode, on Macaria’s death, has been lost.
  • 52. The army of Hyllus is the most astonishing feature in the play. All the action and all the pathos depend upon the helplessness which involves the Heracleidæ. Every other city has rejected them; if Athens fails all is lost—so we are told repeatedly.[461] Yet at the last moment Hyllus returns with a positive army. Whence has it come? How can Iolaus have been ignorant that such aid was possible? We are told nothing. The Athenian leaders apparently, Iolaus and Alcmena[462] certainly, receive these incredible tidings with no feeling save placid satisfaction. Finally, if this drama is composed in order to extol the nobility of Athens in espousing the cause of the weak, it is extraordinary that so dubious an example should be selected. The suppliants are ancestors of those very Spartans who, when the drama was produced, were the bitter and dangerous enemies of Athens. Was not her ancient kindness in saving the first generation of these foes a piece of folly? Eurystheus points this moral at the close.[463] Alcmena herself, in her cold ferocity[464] and her quibbling[465] over the dues of piety, is a clear prophecy of what fifth-century Athenians most detested in the Spartan character. Moreover, the plea of Copreus is perfectly just: Argos has a right to punish her own people if condemned; whether they were wrongly so condemned is no concern of Athens. The upshot seems to be that Eurystheus has a bitter quarrel with a powerful noble, so bitter that when his enemy dies the king dares not leave his children at large. Through the sentimental weakness of her ruler Athens is drawn into the dispute, and history shows that she made a frightful mistake. The Hippolytus [466] (Ἱππόλυτος Στεφανίας[467] or Στεφανηφόρος) was produced in 428 b.c. and obtained the first prize. The scene is laid in Trœzen before a house belonging to Theseus, King of Athens. Aphrodite, the goddess of love, speaks the prologue, explaining how Hippolytus, son of Theseus, scorns her and consorts always with Artemis, the virgin huntress-deity. Aphrodite therefore has caused
  • 53. Phædra, the wife of Theseus, to fall in love with her stepson. The king in his wrath shall bring about the death of his son. The prince enters followed by his huntsmen, and turning to the statue of Artemis with a beautiful prayer places garlands upon it, but disregards the image of Aphrodite. After the hunters have entered the palace, the chorus of Trœzenian women come to inquire after the ailing Phædra. She is borne forth, attended by her nurse, who seeks to calm the feverishness of her mistress and her passionate longing for the wild regions of the chase. She gradually learns that the queen is consumed by passion for Hippolytus. Phædra, now quite calm, describes her fight with temptation; when she saw that victory was impossible she chose death, and for this reason has refused food. The nurse offers very different counsel. Why should Phædra strive against her instincts? Even the gods have erred through love; she will cure her mistress. The remedy, she soon hints, is nothing but surrender. At this Phædra is so indignant that the other again takes refuge in ambiguity; she retires to fetch certain charms. The ode which follows proclaims the irresistible sway of love. The queen, in the meantime, has been standing near the palace-door and now recoils in horror—she has heard Hippolytus reviling the nurse; nothing, she cries, is now left to her but speedy death. Hippolytus enters in fury, followed by the nurse. After an altercation in which he threatens to break his oath of secrecy, he breaks forth into a lengthy and bitter tirade against women, but finally promises to keep his oath. When the prince has retired Phædra proclaims her resolve to avoid shame for her family and herself by death, obtaining from the chorus a promise not to divulge what has occurred; at the same time she obscurely threatens Hippolytus. After she has gone, the chorus voice their yearning to be free from this world of sin and woe; surely this trouble is a curse brought by Phædra from her house in Crete, a curse which is even now forcing her neck into the noose. A messenger rushes forth crying out that the queen has hanged herself. Theseus returns home and is speedily apprised of his loss. Suddenly he sees a letter clutched in his dead wife’s hand; on reading it he announces in fury that Hippolytus has violated his connubial rights. He appeals to his
  • 54. father Poseidon, god of the sea, who has promised to grant him any three prayers, to destroy Hippolytus. The prince returns, and Theseus, after a stinging attack on his son’s pretensions, banishes him. Hippolytus is prevented by his oath from defending himself effectually, and sorrowfully turns away. The chorus ponder upon the mysterious ways of Heaven and lament the downfall of the brilliant prince. One of Hippolytus’ attendants returns and informs Theseus that his son is on the point of death. A gigantic bull, sent by Poseidon out of the sea, terrified Hippolytus’ horses, which bolted and mangled their master. Theseus receives these tidings with grim satisfaction, but the goddess Artemis appears and reveals all the facts. Theseus is utterly prostrated. Hippolytus is carried in, lamenting his agony and unmerited fate. Artemis converses with him affectionately and there follows between the two men a few words lamenting the curse fulfilled by Poseidon. Artemis consoles her favourite and disappears. Hippolytus gives his father full forgiveness, and dies in his embrace. The main impression left by a repeated study of this magnificent drama is a sense of the loveliness and delight which the transfusing genius of a poet can throw around the ruin worked by blind instinct and hate, even around a whole world tortured by belief in gods whose supreme intelligence, will, and power, are quick to punish, but never pardon. No poem in the world conveys more pungently the aroma of life’s inextinguishable beauty and preciousness. Life does not become ugly because full of sin or pain. It can only become ugly by growing unintelligible. So long as it can be understood, it remains to man, whose joys are all founded upon perception, a thing that can be loved; this is the one and sufficient reason why tragic drama is beautiful. For the writer of the Hippolytus, then, life is something profoundly sorrowful yet profoundly dear. Hippolytus’ address to Artemis on his return from the chase is compact of that mystic loveliness which fills remote glades with a visible presentment of the beauty of holiness: —
  • 55. For thee, my Queen, this garland have I twined Of blossoms from that meadow virginal, Where neither shepherd dares to graze his flock, Nor hath the scythe made entry: yet the bee Doth haunt the mead, that voyager of spring, ’Mid Nature’s shyest charm of stream and verdure. There may no base man enter; only he, Who, taught by instinct, uninstructed else, Hath taken Virtue for his star of life, May pluck the flow’rets of that pleasance pure. Come, Queen belovèd, for thy shining hair Accept this wreath from hands of innocence! To me alone of all mankind is given Converse to hold and company with thee, Hearing thy voice, although thy face be hid. To the end of life, as now, may I be thine![468] This passion for natural beauty as the background of emotional life recurs throughout. The Trœzenian women as they enter tell of their informant—not “some one talking near the place where men play draughts,” as in the Medea, but a woman in a picture:— Where waters leap, Waters that flow (men say) from the far-off western sea, Down the rock-face, And gush from the steep To a deep place Where pitchers may dip far down—thence hath come a message to me.[469] Phædra in her delirium sees visions of unfettered life “beneath the poplars, amid the deep grass,” she fancies herself cheering on the hunting hounds through the pine-glades, and yearns to feel in her grasp “the iron-pointed shaft”—words to which we come back with deeper pain when in almost the same language Hippolytus, now himself delirious, longs to let out his tortured life with a “two-edged
  • 56. spear”.[470] When she enters the house to seek death, the chorus pour forth their yearning for escape from the sin and sorrow of this life to romantic regions where all is grace and unstained peace:— [471] In yon precipice-face might I hide me from sorrow, And God, in his love, of the air make me free! Ah, to speed with the sea-gulls—alight on the morrow Where Eridanus mingles his waves with the sea! There for ever the sisters of Phaethon languish, For grief of his fate bowing hush’d o’er the stream; Like eyes in the gloaming, the tears of their anguish Up through the dark water as amber-drops gleam. Or far let me wing to the fäery beaches Where the Maids of the Sunset ’neath apple-boughs dance, And the Lord of the Waters his last purple reaches Hath closed to the mariner’s restless advance; Where from Atlas the sky arches down to the streaming Of the sea, and the spring of Eternity flows Where the mansion of Zeus on earth’s bosom is dreaming ’Mid life like a lily and bliss like a rose. Theseus himself expresses this sense of the fragile beauty of life in lines[472] which recall the unearthly charm of Sophocles:— ὄρνις γὰρ ὥς τις ἐκ χερῶν ἄφαντος εἶ, πήδημ’ ἐς Αἵδου κραιπνὸν ὁρμήσασά μοι. Even Artemis the unloving can tell of life’s charm surviving death itself in some wise, an immortality of beautiful remembrance.[473] Throughout, the poet has used all his power to invest the theme with loveliness of phrasing. Elsewhere, skilful as his writing is, he often gives us what is practically prose; the Hippolytus is his nearest approach to the manner of Sophocles.
  • 57. Nor is the likeness confined to verbal expression. The theology is, or claims to be, the theology of Sophocles. The traditional Olympians are accepted as persons, with the powers and purposes which current belief attributed to them. This is the view which Sophocles accepts and expounds. Euripides who certainly did not accept it, here expounds it—in his own way and with deadly results. Many times Euripides questions the very existence of these deities, but now he sees fit to accept them for a moment, and depicts life as lived under such rulers. Men and women can feel and recreate the beauty of this world, but these gods time and again dash all into pitiful fragments. “The world is ruled by stupid fiends, who spend eternity thwarting one another. Do we dwell in a universe or a grinning chaos?” Is this all? Very far from it. Almost all the action of the tragedy could be accounted for—had we not this disconcerting divine explanation—on purely “human” lines, though what “human” means is, as the poet plainly perceives, no less difficult a question than that of theology. But at least the sorrows of Trœzen scarcely need the baneful persons of Olympus. For the three sufferers are, after all, not blameless. They share that casual sinfulness—for we cannot avoid the use of question-begging words—which is the lot of man. Hippolytus errs (in Greek eyes) by his complete aversion from sexual passion; he errs in all eyes by the arrogance with which he proclaims it. His famous speech[474] is too long for a spontaneous burst of resentment; it becomes a frigid piece of self-glorification. It is precisely this arrogance which stings Phædra to the thought of revenge.[475] Theseus, in spite of the pathetic blindness with which he imputes[476] his misery to some ancestor’s sin, is the original cause of it. Hippolytus is the offspring of his youthful incontinence. [477] Then, when he has “settled down,” it is precisely his respectable marriage which brings the consequence of his early amour to fruition; his son and his young wife are of nearly the same age. As for Phædra herself, the passion which she feels need not be attributed to a personal goddess. Lawlessness is in her veins; her
  • 58. mother and sister have both sinned:[478] Crete, “the Isle of Awful Love,”[479] brands its name upon line after line of the play. For this predisposition to unchastity many of Euripides’ contemporaries, as of our own, would have blamed her heartily. The poet himself does not, as his splendidly sympathetic treatment of her shows; but neither does he feel any need to lay the blame upon Aphrodite. Phædra’s offence, her contribution to disaster, lies in her early toying with her passion, when she founded a shrine of the love-goddess in Hippolytus’ name;[480] in her accompanying Theseus (apparently without a struggle) to Trœzen and the society of the prince; in her determination to punish Hippolytus for his bitter pride. To banish “the gods” and attribute sin to “heredity,” is that not merely to substitute one word for another? Yes, but the poet herein has his eye fixed on formal theology. Well aware that the glib invocation of “heredity” or “environment” is no more conclusive than “the will of the gods,” he yet insists that sin is a matter of psychology. We must study human nature if we mean to understand and conquer sin. If we regard Aphrodite or Artemis as persons external to ourselves and of superhuman power we lose all hope of moral improvement in our own hearts. But if we accept these devastating powers as forces in human nature, we may hope by study and self-discipline in some degree to control them. Thus the drama is full of subtly wise psychology: it is an interesting comment on much that has been written about “realist” play-writing that the Hippolytus, which contains some of the most romantic poetry in Greek literature, is also as sincere and profound in characterization as the work of Ibsen himself. Theseus and his son we have already considered; Phædra and her nurse require deeper study. The latter is a masterpiece among the “minor” characters of Euripides. Her tenderness for the young queen and passionate desire at all costs to win her peace; the dignity which life and its contemplation can give even to coarse-fibred[481] natures; her feeling for the deepest pathos of life—these things constitute a great dramatic figure. It is to her that the poet gives his most poignant
  • 59. expression of that mingled pain and beauty which we discussed a moment ago:— But if any far-off state there be, Dearer than life to mortality; The hand of the Dark hath hold thereof, And mist is under and mist above, And so we are sick for life and cling On earth to this nameless and shining thing. For other life is a fountain sealed, And the deeps below us are unrevealed, And we drift on legends for ever![482] She, too, it is who in words[483] of almost equal beauty urges Phædra to yield to her passion:— Thy love—why marvel thereat? ’Tis the tale Of many. Wouldst thou lose thy life for love? Good sooth! A guerdon strange, if lovers now And evermore must meet such penalty! Who shall withstand the Cyprian’s rising flood? Yield to her spell: she comes in gentleness; Make high thy pride and stand on niceties, She flings thee pell-mell into ignominy. Amid the sky she walks, amid the surge Of the sea-billows. All things live from her. The seed is hers and hers the yearning throe Whence spring we all that tread the ways of earth Ask them that con the half-forgotten seers Of elder time, and serve the Muse themselves. They knew how Zeus once pined for Semele, How for love’s sake the Goddess of the Dawn Stooped from her radiant sphere to Cephalus And stole him to the sky. Yet these abide In Heaven, nor shun the converse of the gods, Bowing, belike, to conquering circumstance.
  • 60. And wilt not thou? Nay, if this law thou spurnest, Thy sire, when he begat thee, should have writ Some compact countersigned by gods unknown! The nurse makes moral weakness into a very religion,[484] and Phædra’s heart, one would suppose, is finally broken when, to this appeal that the gods themselves are against her, is added proof that man is utterly unable to understand. “If thy life had not been in such danger,” says the nurse, “and thou hadst happened to be a chaste woman, I should not thus lead thee on,”[485] and again: “Thy duty, to be sure, forbids sin; but, as things are, be advised by me”.[486] This hideous purring is perhaps Phædra’s bitterest shame. No one can understand, except the prince who seems so utterly remote. Hippolytus, after her death, can say[487] Unchaste in passion, chaste in soul was she; Me hath my passionless purity dishonoured. What does Phædra herself say? Is there any reply to the dreadful eloquence of her old attendant? There is only one reply conceivable, and she offers it: “Whatever gods may do, or men think, I must so act as to be able to respect myself”.[488] Euripides insists that the centre of ethics lies in man himself. For Phædra there is no soul on which she can rely but her own; the conflict must be fought out within herself. The great speech[489] in which she tells her spiritual history to the chorus without any reserve or faltering, is the kernel of the tragedy. We realize how empty of all comfort life can be for those who resolutely reject outworn creeds and turn to seek for a better. Here is no thought, no hint, of a saviour; the puny soul must struggle alone with an uncomprehended universe. Æschylus had found a saviour in Zeus;[490] Euripides can see no comfort in gods who are less virtuous than men. In this speech, too, we note for the first time a portrayal of moral temptation and a clear conception of conscience. Sophocles understands well how duty can brace the soul to heroic life or death, but for him the sanction of duty lies in the will
  • 61. of external deities. For Euripides conscience is sufficient as a rule of conduct. Phædra is a masterpiece of characterization. Whatever we are to guess of the earlier[491] picture, she is here a noble and spirited woman, who cannot help her instincts but who can and will dispute their power over her life. She is, of course, not perfect—if she were she would be no fit subject for drama—and the manner in which Euripides has caused the action to hinge precisely upon her weaknesses, without lessening our respect and affection, is one of the most improving studies provided by dramatic art. The little crevices of circumstance by which wrong-doing—the destruction of Hippolytus—creeps into her soul are beautifully indicated. She is wasted by fasting,[492] a state conducive to keener perception and weaker will. She has been brought—without any attempt on her part, so surely she may indulge in the disastrous joy[493]—from Athens to the little town where the prince lives. Her husband, as it chances,[494] is from home and her life is left empty for “long, long thoughts”.[495] When she dwells upon her passion the recollection of her mother’s and her sister’s fate half attracts while it half repels. [496] Her passionate nature insists on revealing some part of her distress to the keen eyes of the nurse, who forthwith joins the claims of old affection[497] to this new secret pain. So it is that she is half- conquered by what she will not do:— Nay, in God’s name, forbear! Thy words are vile But wise withal. Love in my soul too well Hath mined his way. Urge sin thus winningly And passion sweeps my fears into the gulf.[498] But the nurse will not forbear, and the comforting promise of a charm which shall “still this disease,”[499] as Phædra perhaps half- suspects,[500] is an undertaking to win Hippolytus. The dread strain of illness, passion, and shame have turned the woman for a moment
  • 62. into a nervous child.[501] Thus it comes about that without disgrace, without forfeiture of her conscience, Phædra moves towards the dread moment[502] at which she hears the outcry of Hippolytus. Then after all the anguish, she listens to his intolerable endless speech! Such is the situation in which murder is conceived. In this way Hippolytus’ σωφροσύνη has certainly been his undoing.[503] We are told[504] that this play is a second version of the theme, and that it was called The Crowned Hippolytus (from the lovely address to Artemis) to distinguish it from the first, called The Veiled Hippolytus. This version (now lost) is said to have contained “improprieties” which the poet afterwards removed. This refers to the attitude of Phædra, who showed less reserve in her passion than in the later play. She invoked the moon-goddess, perhaps to aid her in winning Hippolytus, and boldly pointed to the infidelities of Theseus as an excuse for her own passion.[505] The reproaches[506] which Aristophanes lays upon Phædra refer perhaps only to this earlier version, but his most famous gibe[507] is upon a line[508] of our text, ἡ γλῶσσ’ ὀμώμοχ’, ἡ δὲ φρὴν ἀνώμοτος, “My tongue hath sworn; my soul abides unsworn.” This seems to give us the measure of the comic poet’s criticism; he blames Euripides for this sentiment, and yet Hippolytus even in his most desperate trouble will not clear himself by breaking his oath. One cannot, however, refrain from pointing out that even if he had broken it, Theseus would not have believed him,[509] and that Hippolytus realizes this.[510] The Hecuba (Ἑκάβη) is the next play in order of date; it was performed about 425 b.c.[511] This tragedy was enormously popular throughout antiquity, as the great volume of the scholia proves. It was one of the three plays—the others were Phœnissæ and Orestes —used as an Euripidean reading-book in the Byzantine schools.
  • 63. The scene is laid in Thrace, where the Greeks are encamped after the fall of Troy; the background is a tent wherein captive Trojan women are quartered. The ghost of Polydorus, Priam’s youngest son, tells how he has been murdered by the Thracian king, Polymestor; he has appeared in a dream to his mother Hecuba. On his departure, Hecuba enters, and soon learns that her daughter Polyxena is to be sacrificed at the tomb of Achilles. Odysseus comes to fetch the maiden, who welcomes death as a relief from slavery. Soon Talthybius enters, summoning Hecuba to bury Polyxena, whose noble death has filled the Greeks with admiration. Hecuba sends a woman to fetch sea-water for the obsequies, and this messenger returns with the body of Polydorus. Hecuba exclaims that the murderer is Polymestor: her dream has told her. Agamemnon enters, and she induces him to connive at her taking vengeance upon the Thracian, his ally. Next she sends for Polymestor and his children, and (after a beautiful ode on the last hours of Troy), they arrive. Polymestor is induced to go with his little sons within the tent, where they are slaughtered and he himself blinded. His cries bring back Agamemnon, who rejects the pleas of Polymestor. The Thracian, in his despair, prophesies the strange end both of Agamemnon and of Hecuba. He is dragged away, and the drama ends with preparations for the voyage to Greece. This tragedy, let it be said plainly, is on the whole poor and uninteresting.[512] It has been frequently noted, for example, that the plot is “episodic,” that it falls into two divisions, the story of Polyxena and the vengeance upon Polymestor, which are really two small dramas with no genuine connexion. To this it has been replied that the spiritual history of Hecuba supplies unity to the whole; that these episodes bring out her development from a victim into a fiend. [513] But this is scarcely satisfactory. For the two parts are developed so completely along their several lines, they have so little dependence upon one another, that they could stand apart; and that is the real test. Further, the poet himself is uneasy. He is anxious to make some sort of connexion, but it is curiously adventitious. His device, that the corpse of Polydorus is discovered by the woman
  • 64. sent for water wherewith to bathe the body of Polyxena, has won too high praise. An attempt to strengthen it, or rather to draw attention to its neatness, is supplied in the conversation between Hecuba and Agamemnon:[514] “How did he die?” “By the hands of his Thracian host.” ... “Who brought his body hither?” ... “This woman. She found it upon the sea-shore.” “Was she looking for it, or busied with some other task?” The last question is absurd; Agamemnon has no reason to ask it. Other little hooks,[515] less obtrusive than this, are provided here and there to connect the two parts. If the play were an unity they would not be needed. Again, the favourite charge against Euripides, that he delights in quasi-judicial disputes, is brought in here also. The accusation is generally unfair. Critics have been so eager to condemn this poet that they forget the trial scene of the Eumenides, the altercation between Œdipus and Creon in the Œdipus at Colonus and various other passages in the earlier tragedians. If a dispute occurs at all, it is in accordance with the genius of Greek tragedy to set it out in formally opposed speeches. One might as well complain of Hamlet’s soliloquies. But in the Hecuba there is more than this. The queen has a gusto not merely for eloquent appeals or invective, but for self-conscious rhetoric, “Filled with lament, not destitute of tears,”[516] is abominable. One is not surprised to learn that the queen is interested in professional teachers of rhetoric,[517] and one remembers that Gorgias, the greatest of them, paid his first visit to Athens a year or two[518] before this play was produced. The whole piece in its tone and method is far below the best of Euripides’ work. Certain things are undoubtedly excellent—the famous chorus[519] already mentioned, and above all the speech[520] of Polyxena and the narrative of her death.[521] The whole work has not enough calibre. The pathos has no subtlety; the characterization is machine-made; the style, though clear and even elegant—one must allow that the first speech[522] of Polymestor, as a piece of conversational Greek, is unobtrusively perfect—has
  • 65. remarkably few of those feats[523] of idiom which delight us elsewhere. Polyxena is charming, but a slight sketch only compared with the Medea and the Phædra who have preceded her. Agamemnon the cautious prince, Odysseus the opportunist, Polymestor the brutally wicked barbarian, are characters whom dozens of Euripides’ contemporaries could have produced with ease. Talthybius the herald, still more shadowy, claims remembrance by his naïve conceit. [524] Hecuba herself is hardly better. True, the poet has shown admirably how she progresses from weakness to frightful strength under the pressure of injustice, but without any very sympathetic psychology we fall short of genuine tragedy and touch only melodrama. And she is more than a little grotesque. Her strange passion for rhetorical studies we have already noted. She has, moreover, a taste for inopportune theorizing,[525] even concerning theology.[526] Her griefs themselves command our respect, and she can in one or two flashes of inspiration speak of them in language[527] not unworthy of Shakespeare himself; but there is too much repetition of merely melancholy adjectives, and though there should be only one emotion in us towards a woman who has lost all her children, we can hardly retain it when she reminds us that they were fifty in number.[528] The apparition of the murdered Polydorus is an interesting element in the action. First, we view the early part of the drama with greater sympathy for the queen, knowing as we do the new horror which awaits her. Secondly, it is necessary that Hecuba should know how Polydorus died. Though but vaguely affected by the vision at first,[529] when parts of it are fulfilled, she remembers and believes definitely in the rest, and knows that Polymestor is the murderer. [530] The Andromache (Ἀνδρομάχη) is perhaps the next[531] extant play in the order of time. It was not originally brought out at Athens.[532]
  • 66. The action takes place before the house of Neoptolemus, prince of Phthia in Thessaly; at one side of the orchestra is the shrine of Thetis. Andromache delivers the prologue. After the fall of Troy she became the prize of Neoptolemus to whom she has borne a son, Molottus. Later the prince married Hermione, daughter of the Spartan king Menelaus. Andromache has hidden the child and herself taken sanctuary in the shrine of Thetis; the boy’s father is from home, having gone to Delphi to ask Apollo’s pardon for demanding reparation for Achilles’ death. Andromache now sends a fellow-slave to ask the aid of Peleus, king of Phthia and her master’s grandfather. Soon she is joined by the chorus, a company of Phthian women who sympathize but urge submission. Hermione enters, and after a spiteful altercation, in which she tries in vain to make the captive leave her sanctuary, departs with threats. Menelaus enters, leading Molottus; he offers Andromache her choice: will she submit to death, or see the boy slain? Andromache gives herself up, whereupon Menelaus announces that, while she must die, Molottus lies at the mercy of Hermione. By this treachery Andromache is goaded into the most bitter invective to be found in Euripides. The chorus dwell upon the folly of domestic irregularities such as those of Neoptolemus. Next Menelaus leads forth Andromache and Molottus for death, when Peleus hurries in and releases them. After a violent quarrel Menelaus throws up his daughter’s cause and departs. Peleus leads the captives away while the chorus sing his youthful exploits. From the palace comes Hermione’s nurse: deserted by her father and dreading her husband’s vengeance the princess is seeking to destroy herself. Next moment Hermione rushes out in distraction and the nurse is attempting to calm her when Orestes enters, explaining that he has called to inquire after his cousin Hermione. She begs him to take her away to Menelaus before her husband returns. Orestes agrees, reminding her that she has in the past been betrothed to him; now Neoptolemus shall pay for his insults by death at Delphi. After their departure the chorus sing of the gods who built but abandoned Troy, and of Orestes’ vengeance upon Clytæmnestra. Peleus returns, having heard of Hermione’s flight. In a moment arrives a messenger who tells how
  • 67. Neoptolemus has been murdered by Delphians at the instigation of Orestes. The body is borne in, and Peleus laments over it until interrupted by the goddess Thetis, his bride of long ago. She comforts him with a promise of immortality. Andromache is to marry Helenus, king of Molossia,[533] and her son is to be ancestor of a dynasty in that land. Certain remarkable difficulties in the plot must be faced. First is the breakdown of Menelaus in the presence of Peleus. The first half of the play has exhibited his unswerving resolve to destroy Andromache and her child. Every conceivable argument save one has been addressed to him in vain. That one argument is physical compulsion, and Peleus certainly does not offer it.[534] After a storm of mutual abuse the Spartan withdraws from the whole situation, muttering an excuse which is scarcely meant to be taken seriously: he is in a hurry to chastise an unfriendly state.[535] He goes just far enough to embitter his enemies to the utmost and not far enough to redeem his threats; and he retires without a word to his daughter after committing her to a deeply dangerous project. Menelaus has faults, but crass stupidity is not one of them; on the contrary he is reviled as the type of base cunning. Why, then, does he act with such utter futility at a crisis which anyone could have foreseen? In the second place, when was Neoptolemus murdered? Orestes declares that the prince will be slain at Delphi, and at once departs with Hermione. After a choric song Peleus comes back, and almost at once receives the news of his grandson’s death. When Orestes utters his prophecy the messenger from Delphi can hardly be more than a mile from the house. Has he already committed the murder as a prelude to an innocent and irrelevant pilgrimage to Dodona? And, if so, why does he reveal, or rather not reveal, the fact? And why has he risked himself in Phthia when the news of his crime may at any moment be revealed?[536] Thirdly, there is a grave difficulty in the structure, independent of Menelaus’ conduct and the dating of Orestes’ crime. The play seems
  • 68. to fall into two halves with but a slight connexion—the plight of Andromache and the woes of Neoptolemus’ house. The late Dr. Verrall’s theory[537] of the play explains all these things together. Menelaus has come to see that it is to his interest that his daughter should be the wife of the Argive rather than of the Phthiote prince. He and Orestes therefore concoct a plan to this end. Two things must be achieved: Neoptolemus must be removed, and Hermione, passionately as she loves her lord, must be induced to accept his assassin. The cunning of Menelaus fastens upon the failings of his son-in-law as the path to success. First, he has offended the Delphians, and thus Orestes finds it easy to compass his death. Second, he has caused bitterness in his own house by his connexion with Andromache. Menelaus, while Orestes is at Delphi, urges Hermione into action which her jealousy approves but which her intellect (when it is allowed to speak) must and does condemn. The Spartan has no intention of killing the captives, but he sees to it that Hermione is, in the eyes of Peleus and his subjects, irretrievably committed to such an intention, which will beyond doubt incense Neoptolemus most bitterly—or would, were he still alive as Hermione supposes. Then, when she has committed herself, he calmly bows to the outburst of Peleus and leaves her ready to snatch at any hope in her hysterical despair. At this moment, carefully awaited by the plotters, Orestes appears. He has already murdered Neoptolemus, and is now ready to take Hermione away. But this is not enough. She must appear to come by her own suggestion, and it must appear that she has known at the moment of her elopement what has happened at Delphi. As she hurries from the scene he utters, apparently in consolation of her (though really she is out of hearing), so that it may lodge in the minds of the chorus, a prophecy of Neoptolemus’ fate. Later, she is to be reminded by her father and her new suitor how completely she is involved in suspicion of complicity. Thus she will be thrown into the arms of Orestes, and whatever blame there is will be laid upon Delphi.[538]
  • 69. This view should in its essentials be adopted. Every dramatist commits faults; but these apparent faults in the Andromache prove too much. They tend to show not that Euripides is here inferior in construction and psychology to Sophocles, but that he is insane. Few readers could compose a speech like that of Andromache beginning ὦ πᾶσιν ἀνθρώποισιν ἔχθιστοι βροτῶν, or like the messenger’s narrative. But we could all manage the exit of Menelaus better. There is one great general objection to Verrall’s theory. Is it not much too subtle? If readers have always missed the point, would not spectators do so even more certainly? Verrall, in answer, points to a passage in the Greek Argument: τὸ δὲ δρᾶμα τῶν δευτέρων, which he takes to mean “this play is one of the sequels”.[539] He believes that the audience had a sufficient knowledge of the earlier part of the story to follow the Andromache with no perplexity. Whether this knowledge was given by an earlier play of Euripides is not of course certain, but may be regarded as likely. We next note a feature of equal importance—the atmosphere. Every reader observes strange anachronisms of sentiment and allusion—Hermione’s outburst[540] against women who destroy the confidence between husband and wife, Peleus’ comments on Lacedæmonian society,[541] and the like, which have no relevance to the “Homeric age” of the Trojan war. But the whole tone of the play is unheroic; even if these special features were removed it would remain quite unlike a Sophoclean drama. Euripides has, in fact, written a play about his own generation with a definite purpose. He takes stories from myths as the foundation of his plays, but his interest is in his own time. In spite of “thy mother Helen” and “the hapless town of the Phrygians,” his work concerns essentially fifth- century Athenians. Hence the almost complete absence of poetic colour, which is only found in the conventional lyrics and the goddess of the epilogue, who is no more in tune with the rest of the piece than a fairy-queen would be at the close of A Doll’s House. His chief concern is the danger to family life involved in the practice of slave- holding. Neoptolemus loses his life, and Hermione consents to the wreck of her own happiness, simply because of Andromache’s
  • 70. position in the home. She is the fulcrum which the astute villains employ; without her Hermione would never have been manageable. In harmony with this realistic spirit is the character-drawing. None of the personages is of heroic stature, but all are amazingly real, however disagreeable. The two conspirators, Menelaus and Orestes, of course, do not reveal their natures plainly. The latter, as far as this incident alone is concerned, might strike one as almost featureless; but there cling to him significant little fragments from the earlier history of Hermione. A sinister faithfulness actuates him. In spite of his repulse he has not forgotten his affection for Hermione, not even her last words of renunciation.[542] Nor has he ceased to brood on the insults of Neoptolemus—perhaps nothing in the play is more effective than the gloomy triumph with which he flings back the hated word: “and the matricide shall teach thee”.... Menelaus, as a study in successful villainy combined with the domestic virtues, is quite perfect in his kind; ces pères de famille sont capables de tout. But it is upon the three victims, Hermione, Andromache, and Peleus, that the poet has lavished his skill most notably. Each has precisely the virtues and the failings which are fit to make them answer with the precision of machinery to each string pulled by the Spartan diplomatist. Peleus may be relied upon to provide Menelaus with an excuse for retiring when he wishes, and to utter wild language which can be used to prove that he is responsible for Hermione’s flight. [543] Andromache, earning and receiving our pity for her past woes and her present anguish, yet alienates us by her arrogance and a certain metallic brutality in repartee and invective which again are invaluable to the men whose puppet she is. That she should not cower before Hermione or her father is natural, but that is not the point; her trampling tactlessness[544] is a positive disease. She is indeed (except in her love for Molottus) as callous as Menelaus. This is a point of absolutely fundamental import. That interview early in the play, which might have been priceless to both women, ends only in the hopeless embitterment of Hermione. The latter is the best- drawn character of all. Swayed by strong primitive impulses, jealousy and fear, without any balance of mind or emotion, curiously liable to
  • 71. accept the domination of a stronger personality, she is fatally suited to the machinations of her father. When she first appears, it is fairly plain that she has come to suggest a compromise to Andromache. [545] What she wishes is not blood, but servility. Spiteful and vulgar, she cannot forgive the captive for the effortless dignity which she has inherited from Trojan kings. Hers is no vision of a murdered rival: how petty yet how horribly natural it is—she wishes to see Andromache scrubbing the floor![546] But vulgar and spiteful as she is, the princess can be wrought upon, as the later part of the action shows, and if only to self-respect Andromache had added tact and sympathy Hermione would have been her passionate friend before thirty lines had been spoken. The pathos of the scene lies above all in the misunderstanding which pits the two women against one another, where they should have combined against the callous craft which was using them both for the ends of politics. The deities whom we find in this play need detain us only a moment. Thetis is no more than sweetening for the popular taste. Soothing and beautiful as are her consolations to the aged sufferer, such a personage has no real concern with a drama so utterly secular. As for Apollo, it is here plainer than usual that his name is nothing but a convenient short term for the great priestly organization at Delphi. That there is a genuine divine person who has aided Orestes and punished Neoptolemus we cannot believe. The only touch of religious awe to be found lies in the messenger’s report. When the assassins are fleeing before their courageous victim, “from the midst of the shrine some one raised an awful voice whereat the hair stood up, and rallied the host again to fight”.[547] It is this same speaker, however, who thus sums up his account of the whole event: “And thus hath he that gives oracles to others, he who for all mankind is the judge of righteousness, thus hath he entreated the son of Achilles who offered him amends. Like a man that is base hath he remembered an ancient grudge. How, then, can he be wise?” To the simple Thessalian confronted for the first time with doubts of Olympian justice, such phrasing is natural. For Euripides the conclusion is that Apollo does not exist at all. “Apollo” does not
  • 72. take vengeance upon the blasphemer at the time of his offence, but waits unaccountably till his second visit, when he comes to make amends and when by an accident, fortunate for the god, a conspiracy of villainous men happens to make his enemy their victim.[548] In keeping with all this is the literary tone of the work. The lyrics are of little interest to a reader, though one[549] of them markedly sums up the situation and forces home the moral. For the rest, the dialogue is utterly unheroic and unpoetical but splendidly vigorous, terse, and idiomatic; in this respect the Andromache is equal to the best work of Euripides. Could anything of its kind be more perfect than the first speech of Hermione[550]—this mixture of pathetic heart-hunger, of childish snobbery and petulance, this terribly familiar instinct to cast in the teeth of the unfortunate precisely those things for which one formerly envied them, these scraps of ludicrously inaccurate slander against “barbarians” picked up from the tattle of gossiping slaves, and the heavy preachments about “the marriage-question” which cry aloud their origin from the lips of Menelaus? In δεῖ σ’ ἀντὶ τῶν πρὶν ὀλβίων φρονημάτων πτῆξαι ταπεινήν, προσπεσεῖν τ’ ἐμὸν γόνυ, σαίρειν τε δῶμα τοὐμόν, ἐκ χρυσηλάτων τεύχεων χερὶ σπείρουσαν Ἀχελῴου δρόσον, γνῶναι θ’ ἵν’ εἶ γῆς,[551] the last phrase is marvellous. The very sound and fall of the words, with the two long monosyllables, can only be described as a verbal box on the ears. Observe too the great speech[552] of Andromache. In the lines νῦν δ’ ἐς γυναῖκα γοργὸς ὁπλίτης φανείς κτείνεις μ’· ἀπόκτειν’, ὡς ἀθώπευτόν γέ σε γλώσσης ἀφήσω τῆς ἐμῆς καὶ παῖδα σήν,
  • 73. one can hear the words gurgling in her throat before they issue in speech; at the end she is positively hissing. Peleus, too, ineffectual as he may be in argument, is a master of pungent rhetoric.[553] For readers who admire exclusively the Sophoclean type of play, the Andromache is a painful experience to be forgotten as soon as possible. For any who find interest in the behaviour of ordinary beings at a great testing moment, this work is an endless delight. The Hercules Furens [554] or Mad Heracles (Ἡρακλῆς Μαινόμενος) is perhaps the next play in order of time. Most critics place it about the year 420 b.c. or a little earlier; the chief reason for this is the celebrated chorus about old age—it is natural supposition that the poet had recently passed beyond the military age, and so would now be just over sixty. The scene is laid before the house of Heracles at Thebes. Amphitryon, reputed father of the hero, explains the situation. Heracles, leaving his wife Megara and his three sons with Amphitryon, has departed to Hades in quest of Cerberus. In his absence one Lycus has seized the throne and intends to murder Heracles’ family. Megara would submit, but Amphitryon still hopes for Heracles’ return. Certain aged Thebans, who form the chorus, arrive, followed by Lycus who, after sneers at Heracles, orders his henchmen to burn his victims in their house. Megara begs of Lycus that they be given time to array themselves for death. He consents, and the sufferers retire. Lycus departs, and soon the sad procession returns. Suddenly Heracles himself enters. He tells that he has brought back Cerberus and released Theseus, King of Athens, from the lower world; he promises to destroy Lycus and goes within. A splendid ode laments the weakness of old age but glorifies the Muses. Lycus returns, enters the house, and is slain; the chorus greet his yells with delight and hail Heracles as now proved the son of Zeus. Suddenly Iris and Frenzy sweep down from the sky, sent by Hera to drive Heracles mad. Frenzy herself is reluctant, but enters the house, and the chorus raise cries of horror, amid which the house totters in ruin. A messenger relates how Heracles, after
  • 74. slaying Lycus, has been seized with madness and destroyed his wife and children. The eccyclema shows the hero sunk in stupor. He awakes and, realizing his situation, meditates suicide, but Theseus arrives and wins him back to courage; after terrible outbursts against Heaven he departs to live with Theseus in Athens. After a cursory reading of this play one’s impressions are doubtful. Many features excite warm admiration, such as the superb lyric[555] on old age, the speeches[556] of Megara about her fatherless boys, Heracles’ replies[557] to Theseus; even the wrangle between Lycus and Amphitryon is full of idiomatic vigour.[558] But to be blunt, what is the play about? It works up to a climax in the deliverance of Amphitryon and his kin, and then begins again. Long before the close we have forgotten Lycus. We feel that the play is structureless, or (which is worse) that it falls so clearly into two dramas that we cannot view it as a single piece of art. But if we seriously seek for unity, we naturally look for it in the fortunes of Heracles himself. This granted, we shall expect to find that the incident which in a bare summary seems to disjoint the whole is specially treated. Looking then at the incursion of Lycus, we find that at every moment the events are considered from the point of view of Heracles, in terms of his actions, and the sentiments which cling to his personality. We are only prevented from seeing this at first by the modern supposition that the culmination of a tragedy is the death of a leading person, not a spiritual crisis. The discussion between Amphitryon and Megara about instant submission is dominated by despair of the hero’s return in the latter’s mind and by hope of it in the former’s. As soon as Lycus arrives, he asks: “What hope, what defence find ye against death? Believe ye that the father of these lads, he who lies in Hades, will return?” Whereupon he proceeds to a long tirade in abuse of the hero, and Amphitryon’s even more garrulous response deals almost solely with his son’s achievements and the gratitude which he merits from Thebes and Greece. As the doomed party go indoors the old man reminds Heaven itself of the help it owes to Heracles, and the following lyrics are an elaborate chronicle of his
  • 75. marvellous exploits. Finally, when at point to die, Megara in a beautifully natural manner turns her farewell to her sons into a painful memory of the plans which their father used to make for them. In this way the danger of his family is considered as a test of Heracles’ powers and greatness. Will he make good the promise of his past glories? Will he return and free them from Lycus? Dr. Verrall[559] follows this line of thought, giving to it far greater precision and colour. He believes that the subject of this play is the miraculous tone investing the traditional stories about Heracles. According to popular belief in the poet’s day, Heracles was a son of Zeus; he performed many exploits which were definitely superhuman, culminating in a descent to Hades and return therefrom. These stories are untrue. The play indicates this simply and directly, giving, however, most attention to the method by which they won credence. In a primitive civilization, when men had not yet attained to clear thinking, remarkable but human feats like those of Heracles were extolled as miraculous by the uncritical. Such are Amphitryon and the chorus, who when challenged by Lycus are capable only of violent reiteration of their belief, but offer, and can offer, no proof that the miracles happened. It is a curious symptom of the former’s vague credulity that while loving and defending Heracles as his own son, he yet claims[560] the help of Zeus on the ground that the god is himself Heracles’ father. The Theban elders join[561] in this irrational belief—as soon as it appears that the divine parentage is established by the return from Hades, which even if true would of course have nothing to do with the question. It is in such minds as this that belief in the miraculous life of Heracles first sprang up. But this belief rests largely upon the accounts of his adventures given by Heracles himself; thus we come to the heart of the tragedy, the mental condition of the hero. Near the end he exclaims against the consolations of Theseus: “Alas! such words as thine are too trivial for my sorrows. I think not that the gods love unlawful unions, and that they put chains upon one another is a belief I never held nor will I ever. God, if he be God,
  • 76. in truth needs naught. These are but poets’ wretched tales.”[562] Plainly, the sober and reasonable speech which begins thus repudiates the highly-coloured but pernicious stories of tradition to which Theseus has just appealed. Heracles believes in one God utterly above human weaknesses. Then what of Zeus’ love of Alcmena, the jealousy of Hera, the whole basis of his suffering as conceived by the orthodox? And what of his own semi-divine nature, the foundation again of his superhuman deeds? They are delusions. Heracles is no demi-god; his exploits, however great and valuable, are in no sense miraculous. This view, moreover, is precisely that which we ought to gain from the early part of the drama. Lycus is no doubt an insolent bully, but would certainly not brave annihilation (whether at the hands of Zeus or of his son) by slaughtering a demi- god’s family. That he acts so proves that he does not believe in the divine parentage of Heracles; and the support so readily given by Thebes to his policy shows as plainly that to the mass of citizens no real proofs of superhuman nature have been offered. In brief, the actions and language of every one in the play except Heracles himself, Amphitryon, and the chorus—of every one, including Theseus and even Megara, imply that in this play Heracles is indeed a person of note, but an “eminent man” of no very startling eminence. But the hero himself long before this repudiation of “poets’ wretched tales” has himself given them authority. He tells his father that in truth he has visited Hades, dragged Cerberus thence, and rescued Theseus. At many places[563] in the drama he refers without misgiving or query to legendary monsters which he has quelled, and to his safe return from Hades. This inconsistency, according to Dr. Verrall, is the root of the drama. Heracles suffers from a growing tendency to madness; in his sane moods he knows that all his story is human, all the nobler for its humanity, but in his dark hours he accepts the vulgar splendours which rumour throws round his adventures, at such times lending nascent myth the support of his own false witness. The tragedy of his life has been this mental distemper, which has finally caused him to destroy his wife and
  • 77. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookfinal.com