aivika-experiment 0.2.2 → 0.3
raw patch · 3 files changed
+17/−8 lines, 3 filesdep ~aivikaPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aivika
API changes (from Hackage documentation)
+ Simulation.Aivika.Experiment: experimentNumCapabilities :: Experiment -> IO Int
- Simulation.Aivika.Experiment: Experiment :: Specs -> Int -> DirectoryName -> String -> String -> Bool -> [Generator] -> (Experiment -> [Reporter] -> FilePath -> IO ()) -> Experiment
+ Simulation.Aivika.Experiment: Experiment :: Specs -> Int -> DirectoryName -> String -> String -> Bool -> [Generator] -> (Experiment -> [Reporter] -> FilePath -> IO ()) -> IO Int -> Experiment
Files
- LICENSE +1/−1
- Simulation/Aivika/Experiment.hs +14/−5
- aivika-experiment.cabal +2/−2
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2012 David Sorokin <david.sorokin@gmail.com>+Copyright (c) 2012-2013 David Sorokin <david.sorokin@gmail.com> All rights reserved.
Simulation/Aivika/Experiment.hs view
@@ -87,9 +87,12 @@ -- ^ Whether the process of generating the results is verbose. experimentGenerators :: [Generator], -- ^ The experiment generators.- experimentIndexHtml :: Experiment -> [Reporter] -> FilePath -> IO ()+ experimentIndexHtml :: Experiment -> [Reporter] -> FilePath -> IO (), -- ^ Create the @index.html@ file after the simulation is finished- -- in the specified directory. + -- in the specified directory.+ experimentNumCapabilities :: IO Int+ -- ^ The number of threads used for the Monte-Carlo simulation+ -- if the executable was compiled with the support of multi-threading. } -- | The default experiment.@@ -102,7 +105,8 @@ experimentDescription = "", experimentVerbose = True, experimentGenerators = [], - experimentIndexHtml = createIndexHtml }+ experimentIndexHtml = createIndexHtml,+ experimentNumCapabilities = getNumCapabilities } -- | This is a generator of the reporter. data Generator = @@ -278,10 +282,15 @@ -- or you won't get any parallelism. Generally, the mentioned -- @N@ parameter should correspond to the number of cores for -- your processor.+--+-- In case of need you might want to specify the number of+-- threads directly with help of 'experimentNumCapabilities',+-- although the real number of parallel threads can depend on many+-- factors. runExperimentParallel :: Experiment -> Simulation ExperimentData -> IO ()-runExperimentParallel = runExperimentWithExecutor executor +runExperimentParallel e = runExperimentWithExecutor executor e where executor tasks =- do n <- getNumCapabilities+ do n <- experimentNumCapabilities e withPool n $ \pool -> parallel_ pool tasks
aivika-experiment.cabal view
@@ -1,5 +1,5 @@ name: aivika-experiment-version: 0.2.2+version: 0.3 synopsis: Simulation experiments for the Aivika library description: This package allows defining simulation experiments for the Aivika@@ -50,7 +50,7 @@ split >= 0.2.2, network >= 2.3.0.13, parallel-io >= 0.3.2.1,- aivika >= 0.5.4+ aivika >= 0.6 extensions: FlexibleInstances