Permalink
Browse files

a bit of extra docs on profiling mode. ChaseLev: Minor refactor.

  • Loading branch information...
1 parent 5bdb7af commit c35ca08d9bf0140b0678d2e44acdebf342b68ba5 @rrnewton committed Mar 8, 2012
Showing with 34 additions and 9 deletions.
  1. +12 −9 ChaseLev/Data/Concurrent/Deque/ChaseLev.hs
  2. +22 −0 README.md
@@ -2,7 +2,10 @@
-- | Chase-Lev work stealing Deques
--
--- This implementation derives directly from the pseudocode in the 2005 SPAA paper.
+-- This implementation derives directly from the pseudocode in the 2005 SPAA paper:
+--
+-- http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.170.1097&rep=rep1&type=pdf
+--
module Data.Concurrent.Deque.ChaseLev
(
-- The convention here is to directly provide the concrete
@@ -15,7 +18,7 @@ import Data.IORef
import qualified Data.Concurrent.Deque.Class as PC
import Data.CAS (casIORef)
-import Data.Vector.Mutable as V
+import qualified Data.Vector.Mutable as MV
-- import Data.Vector.Unboxed.Mutable as V
-- import Data.Vector
@@ -37,7 +40,7 @@ instance PC.PopL ChaseLevDeque where
data ChaseLevDeque a = CLD {
top :: {-# UNPACK #-} !(IORef Int)
, bottom :: {-# UNPACK #-} !(IORef Int)
- , activeArr :: {-# UNPACK #-} !(IORef (IOVector a))
+ , activeArr :: {-# UNPACK #-} !(IORef (MV.IOVector a))
}
--------------------------------------------------------------------------------
@@ -49,11 +52,11 @@ data ChaseLevDeque a = CLD {
#if 0
gro = unsafeGrow
wr = unsafeWrite
-rd = V.unsafeRead
+rd = MV.unsafeRead
#else
-gro = V.grow
-wr = V.write
-rd = V.read
+gro = MV.grow
+wr = MV.write
+rd = MV.read
#endif
--------------------------------------------------------------------------------
@@ -62,7 +65,7 @@ rd = V.read
-- logInitialSize
newQ :: IO (ChaseLevDeque elt)
newQ = do
- v <- V.new 32
+ v <- MV.new 32
r1 <- newIORef 0
r2 <- newIORef 0
r3 <- newIORef v
@@ -82,7 +85,7 @@ pushL CLD{top,bottom,activeArr} obj = do
b <- readIORef bottom
t <- readIORef top
arr <- readIORef activeArr
- let len = V.length arr
+ let len = MV.length arr
size = b - t
arr' <- if (size >= len - 1) then do
arr' <- gro arr (len + len)
View
@@ -63,6 +63,28 @@ can build them manually with GHC using a command like the following:
cd MichaelScott/
ghc-7.4.1 -O2 -threaded -rtsopts Test.hs -o Test.exe
+Building with Profiling for debugging:
+----------------------------------------
+
+
+ ghc-7.4.1 -prof -osuf=o_p -O2 -threaded -rtsopts Test.hs -o Test.exe
+
+You might have to reinstall some of the dependencies with profiling
+enabled:
+
+ cabal install -p hostname xml regex-base regex-posix ansi-terminal ansi-wl-pprint test-framework test-framework-hunit --reinstall
+
+Reinstalling with profiling can be REALLY annoying once the libraries
+are already installed. For example, if you forget a dependency above
+it will complete most of the compile, giving you the "profiling
+version not available" error only later on, resulting in a quadratic
+compilation process as you reinstall, add one more dep, reinstall,
+repeat.
+
+
+
+
+
KNOWN PROBLEMS
================================================================================

0 comments on commit c35ca08

Please sign in to comment.