Commit 430fc3bf authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢

Remove Hardwired module

This was a test to see if specialization does improve the performance.
Unfortunately it didn't, so the test can be removed.
parent bc4e88c5
......@@ -113,8 +113,7 @@ executable copar
main-is: Main.hs
build-depends: base >=4.11 && <4.13
hs-source-dirs: src/main
other-modules: Hardwired
, Stats
other-modules: Stats
default-extensions: ScopedTypeVariables
, TypeApplications
default-language: Haskell2010
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE OverloadedStrings #-}
module Hardwired where
import Stats
import Data.Text(Text)
import qualified Data.Text as T
import Copar.Algorithm
import System.IO
import System.Exit
import Data.Proxy
import Control.Exception
import qualified Copar.Parser as P
import qualified Data.MorphismEncoding as Encoding
import Copar.Functors.Powerset (Powerset(Powerset))
import Text.Megaparsec (parse)
import Text.Megaparsec.Error (errorBundlePretty)
import Copar.FunctorExpression.Sorts
import Copar.FunctorExpression.Desorting (Desorted)
import Copar.FunctorExpression.Type
import Copar.RefinementInterface (Label, F1)
import Copar.Timing
import Copar.Coalgebra.Parser (SymbolTable, morphismsParser)
import qualified Data.Text.IO as TextIO
import Data.Partition (Partition)
import Data.MorphismEncoding (Encoding)
{-# SPECIALIZE refineWithStats :: Proxy (Desorted Powerset) -> Encoding.Encoding (Label (Desorted Powerset)) (F1 (Desorted Powerset)) -> Bool -> IO (Partition, AlgoStatistics) #-}
main :: Stats -> Maybe [Char] -> (Encoding (Sorted ()) (Sorted Bool) -> SymbolTable -> Partition -> IO a) -> Bool -> IO ()
main stats inputFile partitionPrinter enableOptimizations = do
withTimeStat stats "overall-duration" $ do
let myfunctor = (annotateSorts $ Functor () (Powerset Variable))
-- let mp = morphismsParser @(GroupValued EqDouble)
let mp = morphismsParser @(Powerset)
let morphParser = mp myfunctor P.DisableSanityChecks
(symbolTable, encoding) <- withTimeStat stats "parse-duration" $ do
let (filename,getFilecontents) = case inputFile of
Nothing -> ("(stdin)", TextIO.getContents)
Just "-" -> ("(stdin)", TextIO.getContents)
Just f -> (f, TextIO.readFile f)
contents <- getFilecontents
case parse morphParser filename contents of
Left err -> hPutStrLn stderr (errorBundlePretty err) >> exitFailure
Right res -> evaluate res
logStat stats "states" (tshow (Encoding.size encoding))
logStat stats "edges" (tshow (Encoding.numEdges encoding))
(part, algoStats) <- withTimeStat stats "algorithm-duration" $
refineWithStats @(Desorted Powerset) Proxy encoding enableOptimizations
logStat stats
(tshow (initialBlocks algoStats))
logStat stats
(showTimeDiff (initTime algoStats))
logStat stats "split-operation-count" (tshow (splitCount algoStats))
logStat stats
(showTimeDiff (refineTime algoStats))
logStat stats
(tshow (size1Skipped algoStats))
(partitionPrinter encoding symbolTable part)
return ()
finalizeStats stats
tshow :: Show a => a -> Text
tshow = T.pack . show
......@@ -42,7 +42,6 @@ import Copar.RewriteFunctors
import Copar.Timing
import Copar.CoalgebraPrinter
import qualified Hardwired as Hardwired
import Stats
......@@ -55,7 +54,6 @@ newtype Options = Options
data SubCommand
= HelpCommand (Maybe HelpCommand)
| RefineCommand RefineOptions
| RefineHardwiredCommand RefineOptions
| MinimizeCommand MinimizeOptions
| PrettyPrintCommand PrettyPrintOptions
| GraphCommand GraphOptions
......@@ -78,16 +76,6 @@ subcommand =
<> (command
(RefineHardwiredCommand <$> refineOptions)
"Refine coalgebra and output the result as a list of blocks of states. (Experimental & Only for testing & only for hard-wired functors)"
<> footerDoc (Just (toAnsiWlPprint refineHelp))
<> (command
......@@ -516,13 +504,6 @@ main = do
(outputPartition (refineOutputFile r) encoding symbolTable partition)
finalizeStats stats
(RefineHardwiredCommand r) -> do
stats <- initStats (refineStats r) (refineStatsJson r)
(refineInputFile r)
(outputPartition (refineOutputFile r))
(refineEnableOpt r)
(MinimizeCommand r) -> do
(f, (symbolTable, encoding)) <- do
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment