-
Notifications
You must be signed in to change notification settings - Fork 48
[feat] simple storage support ssd offload #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xupinjie
wants to merge
1
commit into
Ascend:main
Choose a base branch
from
xupinjie:pinjie/simple_storage_offload_ssd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| RESULTS_DIR="${SCRIPT_DIR}/results" | ||
| PERFTEST_PY="${SCRIPT_DIR}/perftest.py" | ||
| CONFIG_YAML="${SCRIPT_DIR}/perftest_config.yaml" | ||
|
|
||
| mkdir -p "${RESULTS_DIR}" | ||
|
|
||
| # ========== User Configuration ========== | ||
| HEAD_NODE_IP="${HEAD_NODE_IP:-127.0.0.1}" | ||
| WORKER_NODE_IP="${WORKER_NODE_IP:-127.0.0.1}" | ||
| DEVICE="${DEVICE:-cpu}" | ||
| NUM_TEST_ITERATIONS="${NUM_TEST_ITERATIONS:-4}" | ||
| USE_COMPLEX_CASE="${USE_COMPLEX_CASE:-false}" | ||
| SSD_OFFLOAD_PATH="${SSD_OFFLOAD_PATH:-}" | ||
| # ======================================== | ||
|
|
||
| if [[ -z "${SSD_OFFLOAD_PATH}" ]]; then | ||
| echo "SSD_OFFLOAD_PATH must point to an existing local SSD directory." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ! -d "${SSD_OFFLOAD_PATH}" ]]; then | ||
| echo "SSD_OFFLOAD_PATH does not exist or is not a directory: ${SSD_OFFLOAD_PATH}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Extension points for additional SSD-capable backends and workload sizes. | ||
| # Currently, SSD offload is a SimpleStorage feature. Workload names describe | ||
| # the per-field sample size that controls memory-versus-SSD routing. | ||
| BACKENDS=("SimpleStorage") | ||
| declare -a SETTINGS=( | ||
| # batch_size, field_num, seq_len, name | ||
| "512,8,262144,Sample1MiB" | ||
| "512,8,524288,Sample2MiB" | ||
| "512,8,1048576,Sample4MiB" | ||
| ) | ||
|
|
||
| COMPLEX_ARGS=() | ||
| if [[ "${USE_COMPLEX_CASE}" == "true" ]]; then | ||
| COMPLEX_ARGS=(--use_complex_case) | ||
| fi | ||
|
|
||
| for backend in "${BACKENDS[@]}"; do | ||
| echo "==========================================" | ||
| echo "Testing SSD offload comparison: ${backend}" | ||
| echo "SSD path: ${SSD_OFFLOAD_PATH}" | ||
| echo "==========================================" | ||
|
|
||
| for setting in "${SETTINGS[@]}"; do | ||
| IFS=',' read -r batch_size field_num seq_len name <<< "${setting}" | ||
| ssd_output_csv="${RESULTS_DIR}/${backend,,}_ssd_${name,,}.csv" | ||
| memory_output_csv="${RESULTS_DIR}/${backend,,}_${name,,}.csv" | ||
|
|
||
| echo " SSD offload: ${name} (batch=${batch_size}, fields=${field_num}, seq=${seq_len})" | ||
| python "${PERFTEST_PY}" --backend_config="${CONFIG_YAML}" --backend="${backend}" \ | ||
| --device="${DEVICE}" \ | ||
| --global_batch_size="${batch_size}" --field_num="${field_num}" --seq_len="${seq_len}" \ | ||
| --num_test_iterations="${NUM_TEST_ITERATIONS}" \ | ||
| --head_node_ip="${HEAD_NODE_IP}" --worker_node_ip="${WORKER_NODE_IP}" \ | ||
| --output_csv="${ssd_output_csv}" --ssd_offload --ssd_path="${SSD_OFFLOAD_PATH}" \ | ||
| "${COMPLEX_ARGS[@]}" | ||
|
|
||
| sleep 10 | ||
|
|
||
| echo " Host memory: ${name} (batch=${batch_size}, fields=${field_num}, seq=${seq_len})" | ||
| python "${PERFTEST_PY}" --backend_config="${CONFIG_YAML}" --backend="${backend}" \ | ||
| --device="${DEVICE}" \ | ||
| --global_batch_size="${batch_size}" --field_num="${field_num}" --seq_len="${seq_len}" \ | ||
| --num_test_iterations="${NUM_TEST_ITERATIONS}" \ | ||
| --head_node_ip="${HEAD_NODE_IP}" --worker_node_ip="${WORKER_NODE_IP}" \ | ||
| --output_csv="${memory_output_csv}" \ | ||
| "${COMPLEX_ARGS[@]}" | ||
|
|
||
| sleep 10 | ||
| done | ||
| done | ||
|
|
||
| echo "" | ||
| echo "All SSD offload comparison tests completed!" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we integrate the SSD test in existing test shell scripts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation uses a 1 MB threshold per sample, but the data sizes in the existing benchmark scripts are too small to trigger the offloading mechanism.