Commit 5625bbba authored by Valentin Reis's avatar Valentin Reis

adding openmc.

parent 03157f9f
Pipeline #5208 passed with stage
in 29 seconds
......@@ -21,6 +21,7 @@ data StackArgs = StackArgs
, workingDirectory :: WorkingDirectory
, shareDir :: ShareDir
, manifestName :: ManifestName
, preludeCommand :: PreludeCommand
, daemon :: ProcessBehavior
, cmdrun :: ProcessBehavior
, cmdlisten :: ProcessBehavior
......@@ -39,6 +40,7 @@ newtype AppName = AppName Text deriving (IsString, Show, Read)
newtype ContainerName = ContainerName Text deriving (IsString, Show, Read)
newtype ShareDir = ShareDir FilePath deriving (IsString, Show)
newtype ManifestName = ManifestName FilePath deriving (IsString, Show)
newtype PreludeCommand = PreludeCommand Text deriving (IsString, Show, Read)
data ProcessBehavior =
Test TestText StdOutLog StdErrLog
| JustRun StdOutLog StdErrLog
......@@ -67,6 +69,7 @@ instance Default StackArgs where
, workingDirectory = WorkingDirectory "_output"
, shareDir = ShareDir "/tmp"
, manifestName = ManifestName "basic.json"
, preludeCommand = PreludeCommand ""
, daemon = DontRun
, cmdrun = DontRun
, cmdlisten = DontRun
......@@ -117,6 +120,13 @@ parseExtendStackArgs sa = do
<> showDefault
<> value (manifestName sa)
)
preludeCommand <- strOption
( long "prelude_command"
<> metavar "COMMAND"
<> help "Command to run before executing the stack (after stack setup)"
<> showDefault
<> value (preludeCommand sa)
)
daemon <- behaviorOption
( long "daemon"
<> metavar "BEHAVIOR"
......
......@@ -7,6 +7,7 @@
module Argo.Stack where
import Argo.Args
import Data.Coerce ( coerce )
import Turtle
import Turtle.Shell
import Prelude hiding ( FilePath )
......@@ -54,13 +55,16 @@ prepareDaemon out stdErr test = do
printInfo $ format ("Copied the configurator to " % fp) confPath'
printInfo $ format "Trying to sudo chown and chmod argo_nodeos_config"
sudoPath <- liftIO $ pack <$> getEnv "SUDO"
verboseShell (format (s%" chown root:root " % fp) sudoPath confPath') empty >>= \case
ExitSuccess -> printInfo "Chowned argo_nodeos_config to root:root."
ExitFailure n ->
die ("Failed to set argo_nodeos_config permissions " <> repr n)
verboseShell (format (s%" chmod u+sw " % fp) sudoPath confPath') empty >>= \case
ExitSuccess -> printInfo "Set the suid bit."
ExitFailure n -> die ("Setting suid bit failed with exit code " <> repr n)
verboseShell (format (s % " chown root:root " % fp) sudoPath confPath') empty
>>= \case
ExitSuccess -> printInfo "Chowned argo_nodeos_config to root:root."
ExitFailure n ->
die ("Failed to set argo_nodeos_config permissions " <> repr n)
verboseShell (format (s % " chmod u+sw " % fp) sudoPath confPath') empty
>>= \case
ExitSuccess -> printInfo "Set the suid bit."
ExitFailure n ->
die ("Setting suid bit failed with exit code " <> repr n)
cleanContainers confPath' 1 2
export "ARGO_NODEOS_CONFIG" (format fp confPath')
return $ Instrumentation (P.proc "daemon" []) out stdErr test
......@@ -122,7 +126,12 @@ cmdRunI (AppName app) args (ContainerName cn) (ShareDir md) (ManifestName mn) pb
= Just (Run, )
<*> processBehaviorToI
( P.proc "cmd"
$ ["run", "-u", T.unpack cn, encodeString $ md <> "manifests" </> mn, T.unpack app]
$ [ "run"
, "-u"
, T.unpack cn
, encodeString $ md <> "manifests" </> mn
, T.unpack app
]
++ fmap (T.unpack . argToText) args
)
pb
......@@ -210,6 +219,8 @@ runStack sa@StackArgs {..} = do
]
ilist = catMaybes milist
_ <- inshell ((coerce preludeCommand) :: Text) empty
if verbosity == Verbose
then do
printInfo "Starting the following processes:"
......
......@@ -51,6 +51,7 @@ data TestType =
| TestSTREAM
| RunAMG
| RunQMCPack
| RunOpenMC
| RunSTREAM
| RunLAMMPS deriving (Enum,Bounded,Show)
......@@ -194,6 +195,31 @@ configureTest = \case
|]
, isTest = IsTest
}
RunOpenMC ->
TestSpec
{ stackArgsUpdate = \sa -> sa
{ app = AppName "mpiexec"
, preludeCommand = PreludeCommand "cp $OPENMC_PWD/* ."
, args =
let tc = coerce (hwThreadCount sa):: Int
in
[ AppArg "mpiexec"
, AppArg "-n"
, AppArg $ repr tc
, AppArg "openmc"
]
, manifestName = "parallel.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = JustRun (StdOutLog "performance.csv")
(StdErrLog "performance.log")
, cmdlistenpower = JustRun (StdOutLog "power.csv") (StdErrLog "power.log")
, cmdlistenprogress = JustRun (StdOutLog "progress.csv")
(StdErrLog "progress.log")
}
, description = "Run QMCPACK in the argo stack."
, isTest = NotTest
}
RunQMCPack ->
TestSpec
{ stackArgsUpdate = \sa -> sa
......
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