changeset 16:72cc49b616cd

print in rpar
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Wed, 22 Jan 2014 15:23:36 +0900
parents 3337ccc824a4
children 7360fbfc7e62
files test/ParWrite.hs
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/test/ParWrite.hs	Wed Jan 22 15:13:10 2014 +0900
+++ b/test/ParWrite.hs	Wed Jan 22 15:23:36 2014 +0900
@@ -46,21 +46,20 @@
   printTimeSince t0
 
   sequence_ $ runEval $ dualWrite jungle
-  tree1 <- getRootNode jungle treeId
-  tree2 <- getRootNode jungle treeId2
-
-  print $ fromJust (getAttributes tree1 lastPos (show (writeCount-1)))
-  print $ fromJust (getAttributes tree2 lastPos (show (writeCount-1)))
 
   printTimeSince t0
 
 -- parallel write for two trees by singleWrite
 dualWrite jungle = do
-    x <- rpar (updateRootNodeWith (writeFunctions writeCount) jungle treeId)
-    y <- rseq (updateRootNodeWith (writeFunctions writeCount) jungle treeId2)
-    rseq x
+    x <- rpar (test jungle treeId)
+    y <- rpar (test jungle treeId2)
     return [x, y]
 
+test jungle id = do
+    updateRootNodeWith (writeFunctions writeCount) jungle id
+    tree <- getRootNode jungle id
+    print $ fromJust (getAttributes tree lastPos (show (writeCount-1)))
+
 -- generate functions to node update
 writeFunctions :: Int -> Node -> Node
 writeFunctions writeCount node = foldl' apply node [0..writeCount]