Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: iu-parfunc/array-dsl-benchmarks
base: 7277dce243
...
head fork: iu-parfunc/array-dsl-benchmarks
compare: b2211ad14d
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
View
0  accelerate/localsearch/gen_variants.sh → accelerate/common/gen_variants.sh
File renamed without changes
View
88 accelerate/nbody_plusplus/makefile_based/Main.hs
@@ -17,7 +17,8 @@ import qualified ACCBACKEND as Bkend
-- import qualified Data.Array.Accelerate.CUDA as Bkend
#endif
import qualified Data.Array.Accelerate.Interpreter as I
-import Data.Array.Accelerate.BackendClass (runTimed, AccTiming(..))
+import Data.Array.Accelerate.BackendClass
+import Data.Array.Accelerate.BackendKit.CompilerPipeline (phase0, phase1)
-- system
import Control.Exception (evaluate)
@@ -39,6 +40,12 @@ import Data.Maybe (fromJust)
import Debug.Trace
import Common.Util (plusV)
+
+-- Temp hack:
+#ifdef EXTRAINITCUDA
+import Foreign.CUDA.Driver (initialise)
+#endif
+
--------------------------------------------------------------------------------
-- Settings
--------------------------------------------------------------------------------
@@ -51,6 +58,7 @@ type Accel = (R, R, R)
defaultInputFile = "./uniform.3dpts"
outputFile = "./nbody_out.3dpts"
+-- How many rounds of NBody to run.
iters = 4
fromDouble :: Fractional a => Double -> a
@@ -142,24 +150,38 @@ main = do
putStrLn$ " Input prefix(4) "++ show(P.take 3$ U.elems raw)
evaluate input0
#endif
+
+#ifdef EXTRAINITCUDA
+ initialise []
+ putStrLn$"CUDA initialized - this is a hack to work around an apparent accelerate-cuda bug."
+#endif
+
performGC
tEnd <- getCurrentTime
putStrLn$ "Input in CPU memory and did GC (took "++show (diffUTCTime tEnd tBegin)++"), starting benchmark..."
tBegin <- getCurrentTime
--- (times,output) <- runTimed Bkend.defaultBackend Nothing Bkend.defaultTrafoConfig (calcAccels input)
- (times,output) <- runTimed Bkend.defaultBackend Nothing Bkend.defaultTrafoConfig (outerLoop input velo iters)
+ let fullacc = outerLoop input velo iters
+ let simpl = phase1 $ phase0 fullacc
+#ifndef NOSIMPLE
+ (times,output) <- runTimedSimple Bkend.defaultBackend Nothing Bkend.defaultTrafoConfig simpl
+ tEnd <- getCurrentTime
+ putStrLn$ "Finished executing through SimpleBackend. "
+#else
+ (times,output) <- runTimed Bkend.defaultBackend Nothing Bkend.defaultTrafoConfig (calcAccels input)
tEnd <- getCurrentTime
- let AccTiming{compileTime,runTime,copyTime} = times
putStrLn$ " Result prefix(4): "++ show(P.take 3$ A.toList output)
putStrLn$ " Result shape "++ show(A.arrayShape output)
+#endif
+ let AccTiming{compileTime,runTime,copyTime} = times
putStrLn$ " All timing: "++ show times
putStrLn$ " Total time for runTimed "++ show (diffUTCTime tEnd tBegin)
putStrLn$ "JITTIME: "++ show compileTime
putStrLn$ "SELFTIMED: "++ show (runTime + copyTime)
+#ifdef NOSIMPLE
putStrLn$ "Writing output file to: "++ outputFile
writeGeomFile outputFile output
-
+#endif
----------------------------------------------------------------------------------------------------
-- The actual benchmark code:
@@ -212,59 +234,3 @@ accel body1 body2
aabs = (m1 * m2) / rsqr
r = sqrt rsqr
-
-
-
---------------------------------------------------------------------------------
--- OLD Main
---------------------------------------------------------------------------------
-
--- import Data.Label
--- import System.Random.MWC ( uniformR )
--- import Criterion ( bench, whnf, runBenchmark )
--- import Criterion.Monad ( withConfig )
--- import Criterion.Analysis ( analyseMean )
--- import Criterion.Environment ( measureEnvironment )
-
--- main :: IO ()
--- main
--- = do (conf, cconf, nops) <- parseArgs =<< getArgs
-
--- let solver = case get configSolver conf of
--- Naive -> Naive.calcAccels
--- BarnsHut -> BarnsHut.calcAccels
-
--- n = get configBodyCount conf
--- epsilon = get configEpsilon conf
-
--- -- Generate random particle positions in a disc layout centred at
--- -- the origin. Start the system rotating with particle speed
--- -- proportional to distance from the origin
--- --
--- positions = randomArrayOf (disc (0,0) (get configStartDiscSize conf)) (Z :. n)
--- masses = randomArrayOf (\_ -> uniformR (1, get configBodyMass conf)) (Z :. n)
-
--- bodies = run conf
--- $ A.map (setStartVelOfBody . constant $ get configStartSpeed conf)
--- $ A.zipWith setMassOfBody (A.use masses)
--- $ A.map (A.uncurry unitBody)
--- $ A.use positions
-
--- -- The initial simulation state
--- --
--- world = World { worldBodies = bodies
--- , worldSteps = 0
--- , worldTime = 0 }
-
--- -- Advancing the simulation
--- --
--- advance = advanceWorld step
--- step = P.curry
--- $ run1 conf
--- $ A.uncurry
--- $ advanceBodies (solver $ constant epsilon)
-
--- -- Forward unto dawn
--- --
--- mean <- withConfig cconf $ measureEnvironment >>= flip runBenchmark (whnf (advance 0.1) world) >>= flip analyseMean 100
--- putStrLn $ "SELFTIMED: " ++ show mean

No commit comments for this range

Something went wrong with that request. Please try again.