Skip to content

Commit

Permalink
add back kripke
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Sep 20, 2023
1 parent d79ecbc commit 412217a
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
#["app-nekbone", "ghcr.io/converged-computing/metric-nekbone:latest", 120],
# ["app-ldms", "ghcr.io/converged-computing/metric-ovis-hpc:latest", 120],
["app-amg", "ghcr.io/converged-computing/metric-amg:latest", 120],
#["app-kripke", "ghcr.io/converged-computing/metric-kripke:latest", 120],
["app-kripke", "ghcr.io/converged-computing/metric-kripke:latest", 120],
#["app-pennant", "ghcr.io/converged-computing/metric-pennant:latest", 120],
["app-bdas", "ghcr.io/converged-computing/metric-bdas:latest", 120]]
#["app-quicksilver", "ghcr.io/converged-computing/metric-quicksilver:latest", 120],
Expand Down
8 changes: 8 additions & 0 deletions docs/_static/data/metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
"image": "ghcr.io/converged-computing/metric-hpl-spack:latest",
"url": "https://www.netlib.org/benchmark/hpl/"
},
{
"name": "app-kripke",
"description": "parallel algebraic multigrid solver for linear systems arising from problems on unstructured grids",
"family": "solver",
"type": "",
"image": "ghcr.io/converged-computing/metric-kripke:latest",
"url": "https://github.com/LLNL/Kripke"
},
{
"name": "app-lammps",
"description": "LAMMPS molecular dynamic simulation",
Expand Down
139 changes: 139 additions & 0 deletions pkg/metrics/app/kripke.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
Copyright 2023 Lawrence Livermore National Security, LLC
(c.f. AUTHORS, NOTICE.LLNS, COPYING)
SPDX-License-Identifier: MIT
*/

package application

import (
"fmt"

api "github.com/converged-computing/metrics-operator/api/v1alpha1"
"k8s.io/apimachinery/pkg/util/intstr"

"github.com/converged-computing/metrics-operator/pkg/metadata"
metrics "github.com/converged-computing/metrics-operator/pkg/metrics"
"github.com/converged-computing/metrics-operator/pkg/specs"
)

type Kripke struct {
metrics.LauncherWorker

// Options
command string
prefix string
}

func (m Kripke) Url() string {
return "https://github.com/LLNL/Kripke"
}

// I think this is a simulation?
func (m Kripke) Family() string {
return metrics.SolverFamily
}

// Set custom options / attributes for the metric
func (m *Kripke) SetOptions(metric *api.Metric) {
m.ResourceSpec = &metric.Resources
m.AttributeSpec = &metric.Attributes

// Set user defined values or fall back to defaults
m.prefix = "mpirun --hostfile ./hostlist.txt"
m.command = "kripke"
m.Workdir = "/opt/kripke"

// This could be improved :)
command, ok := metric.Options["command"]
if ok {
m.command = command.StrVal
}
workdir, ok := metric.Options["workdir"]
if ok {
m.Workdir = workdir.StrVal
}
mpirun, ok := metric.Options["mpirun"]
if ok {
m.prefix = mpirun.StrVal
}
}

// Validate that we can run Kripke
func (n Kripke) Validate(spec *api.MetricSet) bool {
return spec.Spec.Pods >= 2
}

// Exported options and list options
func (m Kripke) Options() map[string]intstr.IntOrString {
return map[string]intstr.IntOrString{
"command": intstr.FromString(m.command),
"mpirun": intstr.FromString(m.prefix),
"workdir": intstr.FromString(m.Workdir),
}
}
func (n Kripke) ListOptions() map[string][]intstr.IntOrString {
return map[string][]intstr.IntOrString{}
}

func (m Kripke) PrepareContainers(
spec *api.MetricSet,
metric *metrics.Metric,
) []*specs.ContainerSpec {

// Metadata to add to beginning of run
meta := metrics.Metadata(spec, metric)
hosts := m.GetHostlist(spec)
prefix := m.GetCommonPrefix(meta, m.command, hosts)

preBlock := `
echo "%s"
`

postBlock := `
echo "%s"
%s
`
command := fmt.Sprintf("%s ./problem.sh", m.prefix)
interactive := metadata.Interactive(spec.Spec.Logging.Interactive)
preBlock = prefix + fmt.Sprintf(preBlock, metadata.Separator)
postBlock = fmt.Sprintf(postBlock, metadata.CollectionEnd, interactive)

// Entrypoint for the launcher
launcherEntrypoint := specs.EntrypointScript{
Name: specs.DeriveScriptKey(m.LauncherScript),
Path: m.LauncherScript,
Pre: preBlock,
Command: command,
Post: postBlock,
}

// Entrypoint for the worker
workerEntrypoint := specs.EntrypointScript{
Name: specs.DeriveScriptKey(m.WorkerScript),
Path: m.WorkerScript,
Pre: prefix,
Command: "sleep infinity",
}

// Container spec for the launcher
launcherContainer := m.GetLauncherContainerSpec(launcherEntrypoint)
workerContainer := m.GetWorkerContainerSpec(workerEntrypoint)

// Return the script templates for each of launcher and worker
return []*specs.ContainerSpec{&launcherContainer, &workerContainer}

}

func init() {
launcher := metrics.LauncherWorker{
Identifier: "app-kripke",
Summary: "parallel algebraic multigrid solver for linear systems arising from problems on unstructured grids",
Container: "ghcr.io/converged-computing/metric-kripke:latest",
WorkerScript: "/metrics_operator/kripke-worker.sh",
LauncherScript: "/metrics_operator/kripke-launcher.sh",
}
kripke := Kripke{LauncherWorker: launcher}
metrics.Register(&kripke)
}

0 comments on commit 412217a

Please sign in to comment.