experimenter 0.1.0.8 → 0.1.0.10
raw patch · 4 files changed
+12/−28 lines, 4 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/Eval/Ops.hs +0/−14
- src/Experimenter/Run.hs +8/−10
ChangeLog.md view
@@ -1,7 +1,7 @@ # Changelog for experimenter -Release 0.1.0.8 on 15.03.2021:- - Using IORef instead of MVar due to deadlocks+Release 0.1.0.10 on 15.03.2021:+ - Tried IORef instead of MVar due to deadlocks. Using MVar. 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: 8de71882b65f310783aca9c07080c06611417b25a44cfef1855e8c28eb146e51+-- hash: 6ee709c122976d31201211f9328205c21118d5b57800b507d99c7cab43066d74 name: experimenter-version: 0.1.0.8+version: 0.1.0.10 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/Eval/Ops.hs view
@@ -169,20 +169,6 @@ ResultDataRep{} -> RepMeasureWhere $ \_ resStep -> E.where_ (resStep E.^. RepResultStepName E.==. E.val (E.decodeUtf8 name)) --- cacheMVar :: MVar (M.Map (Of a, ResultDataKey) (EvalResults a))--- cacheMVar = unsafePerformIO $ newMVar mempty--- {-# NOINLINE cacheMVar #-}---- emptyCache :: IO ()--- emptyCache = liftIO $ modifyMVar_ cacheMVar (const mempty)---- addCache :: (Of a, ResultDataKey) -> EvalResults a -> IO ()--- addCache k v = liftIO $ modifyMVar_ cacheMVar (return . M.insert k v)---- lookupCache :: (Of a, ResultDataKey) -> IO (Maybe (EvalResults a))--- lookupCache k = liftIO $ (M.lookup k =<<) <$> tryReadMVar cacheMVar-- evalOf :: (ExperimentDef a) => Experiment a -> Of a -> ResultData a -> DB (ExpM a) (EvalResults a) evalOf exp eval resData = case eval of
src/Experimenter/Run.hs view
@@ -26,6 +26,7 @@ import Control.Arrow (first, (&&&), (***)) import Control.Arrow (second)+import Control.Concurrent.MVar import Control.DeepSeq import Control.Lens import Control.Monad.IO.Class@@ -748,21 +749,18 @@ foldM' f acc' xs -splitSizeRef :: IORef Int-splitSizeRef = unsafePerformIO $ newIORef 2000-{-# NOINLINE splitSizeRef #-}+splitSizeMVar :: MVar Int+splitSizeMVar = unsafePerformIO $ newMVar 2000+{-# NOINLINE splitSizeMVar #-} increaseSplitSize :: IO ()-increaseSplitSize = liftIO $ void $ atomicModifyIORef' splitSizeRef ((\x -> (x, x)) . min 128000 . (*2))-{-# NOINLINE increaseSplitSize #-}+increaseSplitSize = liftIO $ modifyMVar_ splitSizeMVar (return . min 128000 . (*2)) decreaseSplitSize :: IO ()-decreaseSplitSize = liftIO $ void $ atomicModifyIORef' splitSizeRef ((\x -> (x, x)) . max 500 . (`div` 2))-{-# NOINLINE decreaseSplitSize #-}+decreaseSplitSize = liftIO $ modifyMVar_ splitSizeMVar (return . max 500 . (`div` 2)) getSplitSize :: IO Int-getSplitSize = liftIO $ atomicModifyIORef' splitSizeRef (\x -> (x, x))-{-# NOINLINE getSplitSize #-}+getSplitSize = liftIO $ fromMaybe 5000 <$> tryReadMVar splitSizeMVar data RunData a =@@ -829,10 +827,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')