experimenter 0.1.0.6 → 0.1.0.8
raw patch · 3 files changed
+14/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +2/−2
- experimenter.cabal +2/−2
- src/Experimenter/Run.hs +10/−8
ChangeLog.md view
@@ -1,7 +1,7 @@ # Changelog for experimenter -Release 0.1.0.6 on 15.03.2021:- - Using withMVar instead of modifyMVar_+Release 0.1.0.8 on 15.03.2021:+ - Using IORef instead of MVar due to deadlocks Release 0.1.0.3 on 31.12.2020: - Using username for LaTeX output
experimenter.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 2b9823aaa76e5b2c3460c6368bb8bacca57bd553f4e26daa4181b268f1fcf1bb+-- hash: 8de71882b65f310783aca9c07080c06611417b25a44cfef1855e8c28eb146e51 name: experimenter-version: 0.1.0.6+version: 0.1.0.8 synopsis: Perform scientific experiments stored in a DB, and generate reports. description: Please see the README on GitHub at <https://github.com/schnecki/experimenter#readme> category: Experiment
src/Experimenter/Run.hs view
@@ -26,7 +26,6 @@ import Control.Arrow (first, (&&&), (***)) import Control.Arrow (second)-import Control.Concurrent.MVar import Control.DeepSeq import Control.Lens import Control.Monad.IO.Class@@ -749,18 +748,21 @@ foldM' f acc' xs -splitSizeMVar :: MVar Int-splitSizeMVar = unsafePerformIO $ newMVar 2000-{-# NOINLINE splitSizeMVar #-}+splitSizeRef :: IORef Int+splitSizeRef = unsafePerformIO $ newIORef 2000+{-# NOINLINE splitSizeRef #-} increaseSplitSize :: IO ()-increaseSplitSize = liftIO $ void $ withMVar splitSizeMVar (return . min 128000 . (*2))+increaseSplitSize = liftIO $ void $ atomicModifyIORef' splitSizeRef ((\x -> (x, x)) . min 128000 . (*2))+{-# NOINLINE increaseSplitSize #-} decreaseSplitSize :: IO ()-decreaseSplitSize = liftIO $ void $ withMVar splitSizeMVar (return . max 500 . (`div` 2))+decreaseSplitSize = liftIO $ void $ atomicModifyIORef' splitSizeRef ((\x -> (x, x)) . max 500 . (`div` 2))+{-# NOINLINE decreaseSplitSize #-} getSplitSize :: IO Int-getSplitSize = liftIO $ fromMaybe 5000 <$> tryReadMVar splitSizeMVar+getSplitSize = liftIO $ atomicModifyIORef' splitSizeRef (\x -> (x, x))+{-# NOINLINE getSplitSize #-} data RunData a =@@ -827,10 +829,10 @@ eTime' <- liftIO getCurrentTime let runTime = diffUTCTime (fromJust eTime) sTime saveTime = diffUTCTime eTime' sTime'+ when printInfo $ $(logInfo) $ "Done and saved. Computation Time of " <> tshow (length periodsToRun) <> ": " <> tshow runTime <> ". Saving Time: " <> tshow saveTime when (isNothing maxSteps && nrOfPeriodsToRun == splitPeriods) $ liftIO $ do when (runTime < 60 * max 5 saveTime) increaseSplitSize when (runTime > 120 * max 5 saveTime) decreaseSplitSize- when printInfo $ $(logInfo) $ "Done and saved. Computation Time of " <> tshow (length periodsToRun) <> ": " <> tshow runTime <> ". Saving Time: " <> tshow saveTime if len - curLen - length periodsToRun > 0 then return (False, True, force resData') -- runResultData expId maxSteps len repResType (force resData') else return $! (True, True, set endState mkEndStateAvailableOnDemand $ set startState mkStartStateAvailableOnDemand resData')