没有合适的资源?快使用搜索试试~ 我知道了~
Parallel and Concurrent Programming in Haskell.pdf
需积分: 15 42 下载量 106 浏览量
2017-09-27
17:19:36
上传
评论 2
收藏 18.22MB PDF 举报
温馨提示
试读
321页
Parallel and Concurrent Programming in Haskell.pdf Parallel and Concurrent Programming in Haskell.pdf
资源推荐
资源详情
资源评论
oreilly.com
O 'REILLY®
Twitter: @oreillymedia
facebook.com/oreilly
-Simon Peyton-Jones
one ottne designers ot Haskell
"This is thefirst book to
offer a thorough)
internally consistent
tutorial inparallel and
concurrent functional
programming aimed
atpractitioners rather
than researchers.
Simon Marlow knows
exactly what he is
talking about: he built
GHC'sparallel runtime
system and remains its
master. Bravo!"
911~ [It
I
I)II~IIIJIJIJ~ 111[11
Iii~I
illillilil
ISBN:
978-1-449-33594-6
CAN$41.99US $39.99
SimonMarlow,a software engineer at Facebook, is a leading figure
in the Haskellcommunity.He chaired the Haskell 2010committee
and served as editor of the Haskell language 2010report. Simon is
also one of the lead developers of the widelyused Glasgow
Haskell Compiler(GHC).
• Expressparallelism in Haskell with the Eval monad and
Evaluation Strategies
• Parallelize ordinary Haskell code with the Parmonad
• Build parallel array-based computations, using the Repa
library
• Usethe Accelerate library to run computations directly on
the GPU
• Work with basic interfaces for writing concurrent code
• Build trees of threads for larger and more complex programs
• Learn how to build high-speed concurrent network servers
• Write distributed programs that run on multiple machines in
a network
If
you have a working knowledge of Haskell,this hands-on book
showsyou how to use the language's many APls and frameworks
for writing both parallel and concurrent programs. You'lllearn
how parallelismexploits multicore processors to speed up
computation-heavy programs, and howconcurrency enables you
to write programs with threads for multiple interactions.
Author SimonMarlowwalks you through the process with lots of
code examples thatyou can run, experiment with, and extend.
Divided intoseparate sections on Parallel and Concurrent Haskell,
this book also includes exercises to help you become familiarwith
the concepts presented:
Parallel and Concurrent Programming in Haskell
Functional Programming/Haskell
www.allitebooks.com
Parallel and Concurrent Programming in Haskell
by Simon Marlow
Copyright © 2013 Simon Marlow. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editors: Andy Oram and Maria Gulick
Production Editor: Melanie Yarbrough
Copyeditor: Gillian McGarvey
Proofreader: Julie Van Keuren
Indexer: WordCo Indexing Services
Cover Designer: Randy Comer
Interior Designer: David Futato
Illustrator: Rebecca Demarest
July 2013:
First Edition
Revision History for the First Edition:
2013-07-10: First release
See http://oreilly.com/catalog/errata.csp?isbn=9781449335946 for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Parallel and Concurrent Programming in Haskell, the image of a scrawled butterflyfish, and
related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-33594-6
[LSI]
www.allitebooks.com
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1.
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Terminology: Parallelism and Concurrency 2
Tools and Resources 3
Sample Code 4
Part I. Parallel Haskell
2.
Basic Parallelism: The Eval Monad. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Lazy Evaluation and Weak Head Normal Form 9
The Eval Monad, rpar, and rseq 15
Example: Parallelizing a Sudoku Solver 19
Deepseq 29
3.
Evaluation Strategies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Parameterized Strategies 32
A Strategy for Evaluating a List in Parallel 34
Example: The K-Means Problem 35
Parallelizing K-Means 40
Performance and Analysis 42
Visualizing Spark Activity 46
Granularity 47
GC’d Sparks and Speculative Parallelism 48
Parallelizing Lazy Streams with parBuffer 51
Chunking Strategies 54
The Identity Property 55
4. Dataflow Parallelism: The Par Monad. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
iii
www.allitebooks.com
剩余320页未读,继续阅读
资源评论
wchpjx
- 粉丝: 4
- 资源: 49
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功