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