Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions tests/ramble-tests/application.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
from ramble.appkit import *


class Spatter(ExecutableApplication):
name = 'spatter'
maintainers('plavin', 'jyoung3131')
# license_path = ''

# Load from spack
with when("package_manager_family=spack"):
software_spec("spatter_openmp", pkg_spec="spatter@2.1 backend=openmp")

# Executable
executable('spatter_openmp', 'spatter -f {f}', use_mpi=False)


# Workloads
workload("spatter", executable="spatter_openmp")


workload_variable('a', default='', description='Aggregate (default off)', workloads=['spatter'])
workload_variable('b', default='serial', description='Backend', workloads=['spatter'], values = ['serial', 'openmp', 'cuda'])
workload_variable('c', default='', description='Enable compression of pattern indices', workloads=['spatter'])
workload_variable('d', default='8', description='Delta', workloads=['spatter'])
workload_variable('e', default='', description='Set Boundary (limits max value of pattern using modulo)', workloads=['spatter'])
workload_variable('f', default='', description='Pattern Input File', workloads=['spatter'])
workload_variable('g', default='', description='Set Inner Gather Pattern', workloads=['spatter'])
workload_variable('j', default='', description='Set Pattern Size (truncates pattern to pattern-size)', workloads=['spatter'])
workload_variable('k', default='gather', description='Kernel', workloads=['spatter'], values = ['gather', 'scatter', 'gs', 'multigather', 'multiscatter'])
workload_variable('l', default='1024', description='Set Number of Gathers or Scatters to Perform', workloads=['spatter'])
workload_variable('m', default='', description='Set Amount of Dummy Shared Memory to Allocate on GPUs', workloads=['spatter'])
workload_variable('n', default='', description='Specify the Configuration Name', workloads=['spatter'])
workload_variable('p', default='', description='Set Pattern', workloads=['spatter'])
workload_variable('r', default='10', description='Number of Runs', workloads=['spatter'])
workload_variable('s', default='random', description='Set Random Seed', workloads=['spatter'])
workload_variable('t', default='1', description='Number of Threads', workloads=['spatter'])
workload_variable('u', default='', description='Set Inner Scatter Pattern', workloads=['spatter'])
workload_variable('v', default='1', description='Set Verbosity Level', workloads=['spatter'])
workload_variable('w', default='1', description='Set Wrap', workloads=['spatter'])
workload_variable('x', default='8', description='Delta Gather', workloads=['spatter'])
workload_variable('y', default='8', description='Delta Scatter', workloads=['spatter'])
workload_variable('z', default='1024', description='Local Work Size', workloads=['spatter'])

# Figures -- Need improvement

# figure_of_merit_context(
# "size_context",
# regex=r"^\s*(?P<config>\d+)\s+(?P<bytes>\d+)\s+(?P<time_s>[0-9.eE+-]+)\s+(?P<bw_mb_s>[0-9.eE+-]+)",
# output_format="{bytes} bytes"
# )

# figure_of_merit(
# "Config",
# log_file="{experiment_run_dir}/{experiment_name}.out",
# fom_regex=r"^\s*(?P<config>\d+)\s+(?P<bytes>\d+)\s+(?P<time_s>[0-9.eE+-]+)\s+(?P<bw_mb_s>[0-9.eE+-]+)",
# group_name="config",
# contexts=["size_context"]
# )

# figure_of_merit(
# "Bytes",
# log_file="{experiment_run_dir}/{experiment_name}.out",
# fom_regex=r"^\s*(?P<config>\d+)\s+(?P<bytes>\d+)\s+(?P<time_s>[0-9.eE+-]+)\s+(?P<bw_mb_s>[0-9.eE+-]+)",
# group_name="bytes",
# contexts=["size_context"]
# )

# figure_of_merit(
# "Time",
# log_file="{experiment_run_dir}/{experiment_name}.out",
# fom_regex=r"^\s*(?P<config>\d+)\s+(?P<bytes>\d+)\s+(?P<time_s>[0-9.eE+-]+)\s+(?P<bw_mb_s>[0-9.eE+-]+)",
# group_name="s",
# contexts=["size_context"]
# )

# figure_of_merit(
# "Bandwidth",
# log_file="{experiment_run_dir}/{experiment_name}.out",
# fom_regex=r"^\s*(?P<config>\d+)\s+(?P<bytes>\d+)\s+(?P<time_s>[0-9.eE+-]+)\s+(?P<bw_mb_s>[0-9.eE+-]+)",
# group_name="bw_mb_s",
# units="MB/s",
# contexts=["size_context"]
# )
67 changes: 67 additions & 0 deletions tests/ramble-tests/build_ramble_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

# Exit on error, undefined variables, and pipe failures
set -euo pipefail
IFS=$'\n\t'

# Variables for easy adjustments
WORKSPACE_DIR="spatter_tests"
APP_NAME="spatter"
TESTS_DIR="tests/basic_tests"
REPO_URL="https://raw.githubusercontent.com/hpcgarage/spatter/refs/heads/main"

main() {
echo "--- Initializing Ramble Application ---"

# Create and enter working directory
mkdir -p "$WORKSPACE_DIR"
cd "$WORKSPACE_DIR"

# Initialize Ramble repo
# Using || true in case the repo already exists in some environments
ramble repo create "$APP_NAME" || echo "Repo already exists, skipping create..."
ramble repo add "$APP_NAME" || echo "Repo already added, skipping add..."

# Setup application directory and fetch python script
mkdir -p "$APP_NAME/applications/$APP_NAME"
echo "Downloading application.py..."
curl -fsSL -o "$APP_NAME/applications/$APP_NAME/application.py" \
"$REPO_URL/tests/ramble-tests/application.py"

echo "--- Creating Experiment Workspace ---"
ramble workspace create -d tests -a

# Download test files
mkdir -p "$TESTS_DIR"

echo "Downloading test JSON files..."
curl -fsSL -o "$TESTS_DIR/cpu-ustride.json" "$REPO_URL/standard-suite/basic-tests/cpu-ustride.json"
curl -fsSL -o "$TESTS_DIR/cpu-stream.json" "$REPO_URL/standard-suite/basic-tests/cpu-stream.json"

echo "--- Defining Experiments ---"
# Note: Using $PWD ensures Ramble gets the full absolute path to the JSON files
ramble workspace manage experiments "$APP_NAME" --overwrite \
-e UniformStride \
-v f="$PWD/$TESTS_DIR/cpu-ustride.json" \

ramble workspace manage experiments "$APP_NAME" --overwrite \
-e Stream \
-v f="$PWD/$TESTS_DIR/cpu-stream.json"

echo "--- Setting up and Concretizing ---"
ramble workspace setup
ramble workspace concretize

echo "--------------------------------------------------------"
echo "Setup Complete."
echo "Output will be generated in: experiments/$APP_NAME/$APP_NAME/{experiment name}/{experiment name}.out"
echo "--------------------------------------------------------"
}

# Dependency Check
if ! command -v ramble &> /dev/null; then
echo "Error: 'ramble' command not found. Please ensure Ramble is in your PATH." >&2
exit 1
fi

main "$@"
44 changes: 44 additions & 0 deletions tests/ramble-tests/spatter-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Ramble Spatter Tests

This document outlines how to create a Ramble spatter application and to perform a basic uniform stride and stream test on a CPU. Install Ramble (including python requirements) via https://ramble.readthedocs.io/en/latest/getting_started.html. A shell script is available to automate and run this test.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize when using in a sentence and lower case when using in code.


## Create Ramble Application
```
$ mkdir spatter_tests2
$ cd spatter_tests2

$ ramble repo create spatter
$ ramble repo add spatter

$ mkdir -p spatter/applications/spatter
$ curl -O spatter/applications/spatter/application.py https://raw.githubusercontent.com/hpcgarage/spatter/refs/heads/main/tests/ramble-tests/application.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the need for the curl commands in this file is that the Spack package is not installing them anywhere - is that correct? We should probably install them in <prefix>/share/spatter so that they are available for this and for Spatter's tests to work properly as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake can do this for us - so I don't think we need to edit the Spack package.py file. While we are at it we should make sure the spatter executable gets installed at <prefix>/bin as well.

```


## Create Experiment Workspace

```
$ ramble workspace create -d tests -a

```

Download test files
```
$ mkdir tests/basic_tests

$ curl -o tests/basic_tests/cpu-ustride.json https://raw.githubusercontent.com/hpcgarage/spatter/refs/heads/main/standard-suite/basic-tests/cpu-ustride.json

$curl -o tests/basic_tests/cpu-stream.json https://raw.githubusercontent.com/hpcgarage/spatter/refs/heads/main/standard-suite/basic-tests/cpu-stream.json
```

## Define Experiments
```
$ ramble workspace manage experiments spatter --overwrite -e UniformStride -v f=$PWD/tests/basic_tests/cpu-ustride.json -v a

$ ramble workspace manage experiments spatter --overwrite -e Stream -v f=$PWD/tests/basic_tests/cpu-stream.json

$ ramble workspace setup
$ ramble workspace concretize
```

Output is generated in `experiments/spatter/spatter/{experiment name}/{experiment name}.out`