Skip to content
Newer
Older
100644 136 lines (121 sloc) 3.94 KB
8f4080d @ekmett initialized
authored
1 name: speculation
93172c9 @ekmett added code coverage
authored
2 version: 0.8.0
8f4080d @ekmett initialized
authored
3 license: BSD3
4 license-file: LICENSE
5 author: Edward A. Kmett
6 maintainer: Edward A. Kmett <ekmett@gmail.com>
7 stability: experimental
678f128 @ekmett added WrappedFoldable and WithoutSpeculation
authored
8 homepage: http://github.com/ekmett/speculation
8f4080d @ekmett initialized
authored
9 category: Concurrency
93172c9 @ekmett added code coverage
authored
10 copyright: (c) 2010 Edward A. Kmett
11 build-type: Custom
12 cabal-version: >=1.6
13 tested-with: GHC==6.12.1
d33dfed @ekmett hackage release 0.0.0
authored
14 synopsis: A framework for safe, programmable, speculative parallelism
5d14400 @ekmett STM, better docs
authored
15 description:
c482c60 @ekmett documentation cleanup
authored
16 A framework for safe, programmable, speculative parallelism, loosely based on:
4378fc4 @ekmett added specOn and specBy, and separated out Data.Foldable.Speculation
authored
17 .
c482c60 @ekmett documentation cleanup
authored
18 * Prakash Prabhu, G. Ramalingam, and Kapil Vaswani, \"/Safe Programmable Speculative Parallelism/\",
19 In the proceedings of Programming Language Design and Implementation (PLDI) Vol 45, Issue 6 (June 2010) pp 50-61.
20 <http://research.microsoft.com/pubs/118795/pldi026-vaswani.pdf>
21 .
22 This package provides speculative function application and speculative folds. Speculative STM transactions take the place
4378fc4 @ekmett added specOn and specBy, and separated out Data.Foldable.Speculation
authored
23 of the transactional rollback machinery from the paper.
24 .
25 For example:
26 .
7d3283e @ekmett exposed unsafeGetTagBits and unsafeIsEvaluated
authored
27 @'spec' g f a@ evaluates @f g@ while forcing @a@, if @g == a@ then @f g@ is returned, otherwise @f a@ is evaluated and returned. Furthermore, if the argument has already been evaluated, we skip the @f g@ computation entirely. If a good guess at the value of @a@ is available, this is one way to induce parallelism in an otherwise sequential task. However, if the guess isn\'t available more cheaply than the actual answer, then this saves no work and if the guess is wrong, you risk evaluating the function twice.
4378fc4 @ekmett added specOn and specBy, and separated out Data.Foldable.Speculation
authored
28 .
29 The best-case timeline looks like:
30 .
31 > [---- f g ----]
32 > [----- a -----]
33 > [-- spec g f a --]
34 .
35 The worst-case timeline looks like:
36 .
37 > [---- f g ----]
38 > [----- a -----]
39 > [---- f a ----]
40 > [------- spec g f a -----------]
41 .
42 Compare these to the timeline of @f $! a@:
43 .
44 > [---- a -----]
45 > [---- f a ----]
46 .
47 'specSTM' provides a similar time table for STM actions, but also rolls back side-effects.
48 .
93172c9 @ekmett added code coverage
authored
49 /Changes in 0.8.0:/
a3836a4 @ekmett throwSTM SpeculationException
authored
50 .
93172c9 @ekmett added code coverage
authored
51 * Test suite, code coverage, and benchmark suite added
52
53 extra-source-files:
54 README.markdown
55
56 source-repository head
57 type: git
58 location: http://github.com/ekmett/speculation.git
59 branch: master
60
61 flag optimize
62 description: Enable optimizations
63 default: True
30cbe75 @ekmett release: 0.0.2
authored
64
93172c9 @ekmett added code coverage
authored
65 flag tests
66 description: Build the tests
67 default: True
68
69 flag benchmarks
70 description: Build the benchmarks
71 default: False
72
73 flag hpc
74 description: Use HPC for tests
75 default: True
76
77 flag nolib
78 description: Don't build the library. Useful for speeding up the modify-build-test cycle.
79 default: False
8f4080d @ekmett initialized
authored
80
81 library
82 ghc-options: -Wall
83
93172c9 @ekmett added code coverage
authored
84 if flag(optimize)
85 ghc-options: -funbox-strict-fields -O2 -fspec-constr -fdicts-cheap
86
87 if flag(nolib)
88 buildable: False
89
8f4080d @ekmett initialized
authored
90 build-depends:
5d14400 @ekmett STM, better docs
authored
91 base >= 4 && < 6,
92 parallel >= 2.2 && < 2.3,
93 stm >= 2.1 && < 2.2
8f4080d @ekmett initialized
authored
94
95 exposed-modules:
96 Control.Concurrent.Speculation
4378fc4 @ekmett added specOn and specBy, and separated out Data.Foldable.Speculation
authored
97 Data.Foldable.Speculation
93172c9 @ekmett added code coverage
authored
98
99 executable test-speculation
100 main-is: Test.hs
101 if !flag(tests)
102 buildable: False
103 else
104 if flag(hpc)
105 ghc-options: -fhpc
106 ghc-options: -Wall
107 build-depends:
108 base >= 4 && < 6,
109 stm >= 2.1 && < 2.2,
110 containers >= 0.3.0 && < 0.4,
111 test-framework >= 0.2.4 && < 0.3,
112 test-framework-quickcheck >= 0.2.4 && < 0.3,
113 test-framework-hunit >= 0.2.4 && < 0.3,
114 QuickCheck >= 1.2.0.0 && < 1.3,
115 HUnit >= 1.2.2.1 && < 1.3
116 other-modules:
117 Control.Concurrent.Speculation
118 Data.Foldable.Speculation
119
120 executable benchmark-speculation
121 main-is: Benchmark.hs
122 if !flag(benchmarks)
123 buildable: False
124 else
125 ghc-options: -Wall
126 if flag(optimize)
127 ghc-options: -O2 -fspec-constr -funbox-strict-fields -fdicts-cheap
128 build-depends:
129 base >= 4 && < 6,
130 stm >= 2.1 && < 2.2,
131 containers >= 0.3.0 && < 0.4,
132 criterion >= 0.5 && < 0.6
133 other-modules:
134 Control.Concurrent.Speculation
135 Data.Foldable.Speculation
Something went wrong with that request. Please try again.