futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | None
Language | GHC2021

Futhark.Bench

Description

Facilities for handling Futhark benchmark results. A Futhark benchmark program is just like a Futhark test program.

Synopsis

- newtype RunResult = RunResult {
  - runMicroseconds :: Int
  }
- data DataResult = DataResult Text (Either Text Result)
- data BenchResult = BenchResult {
  - benchResultProg :: FilePath
  - benchResultResults :: [DataResult]
  }
- data Result = Result {
  - runResults :: [RunResult]
  - memoryMap :: Map Text Int
  - stdErr :: Maybe Text
  - report :: Maybe ProfilingReport
  }
- encodeBenchResults :: [BenchResult] -> ByteString
- decodeBenchResults :: ByteString -> Either String [BenchResult]
- binaryName :: FilePath -> FilePath
- benchmarkDataset :: Server -> RunOptions -> FutharkExe -> FilePath -> Text -> Values -> Maybe Success -> FilePath -> IO (Either Text ([RunResult], Text, ProfilingReport))
- data RunOptions = RunOptions {
  - runMinRuns :: Int
  - runMinTime :: NominalDiffTime
  - runTimeout :: Int
  - runVerbose :: Int
  - runConvergencePhase :: Bool
  - runConvergenceMaxTime :: NominalDiffTime
  - runResultAction :: (Int, Maybe Double) -> IO ()
  - runProfile :: Bool
  }
- prepareBenchmarkProgram :: MonadIO m => Maybe Int -> CompileOptions -> FilePath -> [InputOutputs] -> m (Either (String, Maybe ByteString) ())
- data CompileOptions = CompileOptions {
  - compFuthark :: String
  - compBackend :: String
  - compOptions :: [String]
  }
- module Futhark.Profile

# Documentation

newtype RunResult Source #

The runtime of a single succesful run.

Constructors

RunResult |

Fields

- runMicroseconds :: Int

#### Instances

Instances details

FromJSON RunResult Source # |
Instance details Defined in Futhark.Bench Methods parseJSON :: Value -> Parser RunResult Source # parseJSONList :: Value -> Parser [RunResult] Source # omittedField :: Maybe RunResult Source #
ToJSON RunResult Source # |
Instance details Defined in Futhark.Bench Methods toJSON :: RunResult -> Value Source # toEncoding :: RunResult -> Encoding Source # toJSONList :: [RunResult] -> Value Source # toEncodingList :: [RunResult] -> Encoding Source # omitField :: RunResult -> Bool Source #
Show RunResult Source # |
Instance details Defined in Futhark.Bench Methods showsPrec :: Int -> RunResult -> ShowS Source # show :: RunResult -> String Source # showList :: [RunResult] -> ShowS Source #
Eq RunResult Source # |
Instance details Defined in Futhark.Bench Methods (==) :: RunResult -> RunResult -> Bool Source # (/=) :: RunResult -> RunResult -> Bool Source #

data DataResult Source #

The results for a single named dataset is either an error message, or a result.

Constructors

DataResult Text (Either Text Result) |

#### Instances

Instances details

Show DataResult Source # |
Instance details Defined in Futhark.Bench Methods showsPrec :: Int -> DataResult -> ShowS Source # show :: DataResult -> String Source # showList :: [DataResult] -> ShowS Source #
Eq DataResult Source # |
Instance details Defined in Futhark.Bench Methods (==) :: DataResult -> DataResult -> Bool Source # (/=) :: DataResult -> DataResult -> Bool Source #

data BenchResult Source #

The results for all datasets for some benchmark program.

Constructors

BenchResult |

Fields

- benchResultProg :: FilePath
- benchResultResults :: [DataResult]

#### Instances

Instances details

Show BenchResult Source # |
Instance details Defined in Futhark.Bench Methods showsPrec :: Int -> BenchResult -> ShowS Source # show :: BenchResult -> String Source # showList :: [BenchResult] -> ShowS Source #
Eq BenchResult Source # |
Instance details Defined in Futhark.Bench Methods (==) :: BenchResult -> BenchResult -> Bool Source # (/=) :: BenchResult -> BenchResult -> Bool Source #

data Result Source #

The measurements resulting from various successful runs of a benchmark (same dataset).

Constructors

Result |

Fields

- runResults :: [RunResult]

  Runtime of every run.

- memoryMap :: Map Text Int

  Memory usage.

- stdErr :: Maybe Text

  The error output produced during execution. Often `Nothing` for space reasons, and otherwise only the output from the last run.

- report :: Maybe ProfilingReport

  Profiling report. This will have been measured based on the last run.

#### Instances

Instances details

FromJSON Result Source # |
Instance details Defined in Futhark.Bench Methods parseJSON :: Value -> Parser Result Source # parseJSONList :: Value -> Parser [Result] Source # omittedField :: Maybe Result Source #
ToJSON Result Source # |
Instance details Defined in Futhark.Bench Methods toJSON :: Result -> Value Source # toEncoding :: Result -> Encoding Source # toJSONList :: [Result] -> Value Source # toEncodingList :: [Result] -> Encoding Source # omitField :: Result -> Bool Source #
Show Result Source # |
Instance details Defined in Futhark.Bench Methods showsPrec :: Int -> Result -> ShowS Source # show :: Result -> String Source # showList :: [Result] -> ShowS Source #
Eq Result Source # |
Instance details Defined in Futhark.Bench Methods (==) :: Result -> Result -> Bool Source # (/=) :: Result -> Result -> Bool Source #

encodeBenchResults :: [BenchResult] -> ByteString Source #

Transform benchmark results to a JSON bytestring.

decodeBenchResults :: ByteString -> Either String [BenchResult] Source #

Decode benchmark results from a JSON bytestring.

binaryName :: FilePath -> FilePath Source #

The name we use for compiled programs.

benchmarkDataset :: Server -> RunOptions -> FutharkExe -> FilePath -> Text -> Values -> Maybe Success -> FilePath -> IO (Either Text ([RunResult], Text, ProfilingReport)) Source #

Run the benchmark program on the indicated dataset.

data RunOptions Source #

How to run a benchmark.

Constructors

RunOptions |

Fields

- runMinRuns :: Int

  Applies both to initial and convergence phase.

- runMinTime :: NominalDiffTime
- runTimeout :: Int
- runVerbose :: Int
- runConvergencePhase :: Bool

  If true, run the convergence phase.

- runConvergenceMaxTime :: NominalDiffTime

  Stop convergence once this much time has passed.

- runResultAction :: (Int, Maybe Double) -> IO ()

  Invoked for every runtime measured during the run. Can be used to provide a progress bar.

- runProfile :: Bool

  Perform a final run at the end with profiling information enabled.

prepareBenchmarkProgram :: MonadIO m => Maybe Int -> CompileOptions -> FilePath -> [InputOutputs] -> m (Either (String, Maybe ByteString) ()) Source #

Compile and produce reference datasets.

data CompileOptions Source #

How to compile a benchmark.

Constructors

CompileOptions |

Fields

- compFuthark :: String
- compBackend :: String
- compOptions :: [String]

module Futhark.Profile