Permalink
Browse files

modifications to make the cuda experiment work again

preliminary data showing that cuda context flags make no difference on mergesort?
  • Loading branch information...
1 parent 0fac50a commit fb301e0ce31a394fc367ad02c756608879e96222 @acfoltzer acfoltzer committed Jun 12, 2012
@@ -29,8 +29,8 @@ endif
all: mergesort cilkWrap
mergesort: mergesort.hs cilksort-nomain.o
- $(GHC) /nobackup/afoltzer/NVIDIA_GPU_Computing_SDK/C/src/mergeSort/obj/x86_64/release/mergeSort.cu.o -i../.. --make -O2 -rtsopts -threaded $^ $(LDFLAGS) -D$(CPU_SORT) -o $@
-
+ $(GHC) -i../.. --make -O2 -rtsopts -threaded $^ $(LDFLAGS) -D$(CPU_SORT) -o $@
+# /nobackup/afoltzer/NVIDIA_GPU_Computing_SDK/C/src/mergeSort/obj/x86_64/release/mergeSort.cu.o
cilksort: cilksort.o
$(CC) $(CFLAGS) $^ -o $@
@@ -0,0 +1,9 @@
+cuda-0.4.1.0
+dynamic w/blocking, N=1, REALTIME 2.099722 2.215135 2.280407
+dynamic w/yield, N=1, REALTIME 2.083144 2.224708 2.267604
+dynamic w/auto, N=1, REALTIME 2.196699 2.24794 2.263477
+
+cuda-0.4.1.1 @ 93c621b28a00e90cd46218f567019add063a238d w/unsafe->safe on sync call
+dynamic w/blocking, N=1, REALTIME 2.11977 2.207413 2.261914
+dynamic w/yield, N=1, REALTIME 2.085718 2.205506 2.252961
+dynamic w/auto, N=1, REALTIME 2.210271 2.235203 2.255668
@@ -40,7 +40,7 @@ import Control.Monad.Par.Meta.SMPMergeSort
#ifdef GPU_ENABLED
import Foreign.CUDA.Driver (initialise)
-import Foreign.CUDA.Runtime.Device (reset)
+import Foreign.CUDA.Runtime.Device (reset, setFlags, DeviceFlag(..))
#endif
import Foreign.Ptr
@@ -448,6 +448,9 @@ main = do args <- getArgs
initialise [] -- CUDA initialize.
reset
+-- setFlags [BlockingSync] -- set sync behavior to wait on OS primitive
+-- setFlags [ScheduleYield] -- set sync behavior to yield periodically
+
#endif
-- g <- getStdGen
@@ -141,7 +141,7 @@ defaultStartup = St st
initialise []
mtid <- readHotVar daemonTid
when (mtid == Nothing)
- $ writeHotVar daemonTid . Just =<< forkIO gpuDaemon
+ $ writeHotVar daemonTid . Just =<< forkOS gpuDaemon
#define GPU_BACKSTEALING
#ifdef GPU_BACKSTEALING
@@ -22,6 +22,7 @@ Cabal-version: >=1.8
Library
Exposed-modules:
Control.Monad.Par.Meta.Resources.CUDAMergeSort
+ , Control.Monad.Par.Meta.SMPMergeSort
, Data.Vector.Algorithms.CUDA.Merge
Build-depends:
base >= 4 && < 5
@@ -1,30 +0,0 @@
-{-# OPTIONS_GHC -Wall #-}
-
-module Control.Monad.Par.Meta.SMPMergeSort (
- runPar
- , runParIO
- , Merge.blockingGPUMergeSort
- , Merge.spawnGPUMergeSort
- , Merge.spawnCPUGPUMergeSort
- , module Control.Monad.Par.Meta
-) where
-
-import Data.Monoid
-
-import Control.Monad.Par.Meta
-import qualified Control.Monad.Par.Meta.Resources.CUDAMergeSort as Merge
-import qualified Control.Monad.Par.Meta.Resources.SharedMemory as SharedMemory
-import qualified Control.Monad.Par.Meta.Resources.Backoff as Bkoff
-
-tries :: Int
-tries = 20
-
-resource = mconcat [ SharedMemory.mkResource tries
- , Merge.mkResource
- , Bkoff.mkResource 1000 (100*1000)
- ]
-
-runPar :: Par a -> a
-runParIO :: Par a -> IO a
-runPar = runMetaPar resource
-runParIO = runMetaParIO resource

0 comments on commit fb301e0

Please sign in to comment.