diff --git a/docs/conjure-help.html b/docs/conjure-help.html index a6f0c2967..e07ea2b48 100644 --- a/docs/conjure-help.html +++ b/docs/conjure-help.html @@ -136,6 +136,7 @@  --use-existing-models=FILEFile names of Essence' models generated beforehand.
If given, Conjure skips the modelling phase and uses the existing models for solving.
The models should be inside the output directory (See -o). runsolver:  --runsolver-cpu-time-limit=INTUse runsolver to limit total CPU time (in seconds) + --runsolver-wall-time-limit=INTUse runsolver to limit total elapsed time (in seconds)  --runsolver-memory-limit=INTUse runsolver to limit total memory usage (Maximum RSS - in megabytes). Options for other tools:  --savilerow-options=ITEMOptions passed to Savile Row. diff --git a/docs/conjure-help.txt b/docs/conjure-help.txt index fad98d45b..655caff4b 100644 --- a/docs/conjure-help.txt +++ b/docs/conjure-help.txt @@ -263,6 +263,7 @@ The models should be inside the output directory (See -o). runsolver: --runsolver-cpu-time-limit=INT Use runsolver to limit total CPU time (in seconds) + --runsolver-wall-time-limit=INT Use runsolver to limit total elapsed time (in seconds) --runsolver-memory-limit=INT Use runsolver to limit total memory usage (Maximum RSS - in megabytes). Options for other tools: --savilerow-options=ITEM Options passed to Savile Row. diff --git a/src/Conjure/Process/Enumerate.hs b/src/Conjure/Process/Enumerate.hs index 5160fec4f..604efb8a7 100644 --- a/src/Conjure/Process/Enumerate.hs +++ b/src/Conjure/Process/Enumerate.hs @@ -144,6 +144,7 @@ enumerateDomain d = liftIO' $ withSystemTempDirectory ("conjure-enumerateDomain- , copySolutions = False , solutionsInOneFile = False , runsolverCPUTimeLimit = Nothing + , runsolverWallTimeLimit = Nothing , runsolverMemoryLimit = Nothing , logLevel = LogNone -- default values for the rest diff --git a/src/Conjure/UI.hs b/src/Conjure/UI.hs index a596eeab0..b17a89afb 100644 --- a/src/Conjure/UI.hs +++ b/src/Conjure/UI.hs @@ -100,6 +100,7 @@ data UI , responsesRepresentation :: String , solutionsInOneFile :: Bool , runsolverCPUTimeLimit :: Maybe Int + , runsolverWallTimeLimit :: Maybe Int , runsolverMemoryLimit :: Maybe Int -- flags related to logging , logLevel :: LogLevel @@ -747,6 +748,12 @@ ui = modes &= groupname "runsolver" &= explicit &= help "Use runsolver to limit total CPU time (in seconds)" + , runsolverWallTimeLimit + = def + &= name "runsolver-wall-time-limit" + &= groupname "runsolver" + &= explicit + &= help "Use runsolver to limit total elapsed time (in seconds)" , runsolverMemoryLimit = def &= name "runsolver-memory-limit" diff --git a/src/Conjure/UI/MainHelper.hs b/src/Conjure/UI/MainHelper.hs index 9056e5a9e..1609cf1f9 100644 --- a/src/Conjure/UI/MainHelper.hs +++ b/src/Conjure/UI/MainHelper.hs @@ -804,11 +804,12 @@ savileRowNoParam ui@Solve{..} (modelPath, eprimeModel) = sh $ errExit False $ do (outBase, modelPath, "", ui) tr (1::Int) let runsolverArgs = maybe [] (\ limit -> ["-C", show limit]) runsolverCPUTimeLimit ++ - maybe [] (\ limit -> ["-R", show limit]) runsolverMemoryLimit ++ + maybe [] (\ limit -> ["-W", show limit]) runsolverWallTimeLimit ++ + maybe [] (\ limit -> ["-R", show limit]) runsolverMemoryLimit ++ ["--quiet", "-v", outputDirectory outBase ++ ".runsolver-info"] (stdoutSR, solutions) <- partitionEithers <$> - case (runsolverCPUTimeLimit, runsolverMemoryLimit) of - (Nothing, Nothing) -> runHandle savilerowScriptName srArgs handler + case (runsolverCPUTimeLimit, runsolverWallTimeLimit, runsolverMemoryLimit) of + (Nothing, Nothing, Nothing) -> runHandle savilerowScriptName srArgs handler _ -> if os /= "linux" then return [Left "runsolver is only supported on linux"] @@ -854,11 +855,12 @@ savileRowWithParams ui@Solve{..} (modelPath, eprimeModel) (paramPath, essencePar (outBase, modelPath, paramPath, ui) tr (1::Int) let runsolverArgs = maybe [] (\ limit -> ["-C", show limit]) runsolverCPUTimeLimit ++ - maybe [] (\ limit -> ["-V", show limit]) runsolverMemoryLimit ++ - ["--quiet", "-v", outputDirectory outBase ++ ".runsolver-info"] + maybe [] (\ limit -> ["-W", show limit]) runsolverWallTimeLimit ++ + maybe [] (\ limit -> ["-R", show limit]) runsolverMemoryLimit ++ + ["--quiet", "-v", outputDirectory outBase ++ ".runsolver-info"] (stdoutSR, solutions) <- partitionEithers <$> - case (runsolverCPUTimeLimit, runsolverMemoryLimit) of - (Nothing, Nothing) -> runHandle savilerowScriptName srArgs handler + case (runsolverCPUTimeLimit, runsolverWallTimeLimit, runsolverMemoryLimit) of + (Nothing, Nothing, Nothing) -> runHandle savilerowScriptName srArgs handler _ -> if os /= "linux" then return [Left "runsolver is only supported on linux"]