-
Notifications
You must be signed in to change notification settings - Fork 4
refresh code and readme to be more inline with ampere-inferencing-benchmarking repo #4
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
Draft
MarcelWilnicki
wants to merge
8
commits into
main
Choose a base branch
from
marcel/update-readme
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.
Draft
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c6fe64e
first commit, refresh code, add x86 dockerfile, update readme
MarcelWilnicki a6e4b32
wip
MarcelWilnicki 4bf2b53
wip
MarcelWilnicki 8ffab2e
wip
MarcelWilnicki 55831a2
wip
MarcelWilnicki 3b8a0ab
wip
MarcelWilnicki f110e3d
wip
MarcelWilnicki 863c1d4
remove run.sh
MarcelWilnicki 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,32 @@ | ||
# Running benchmark | ||
 | ||
# Wrapper for multi-process / batched benchmark of llama.cpp | ||
|
||
This benchmarking tool runs multi-process, throughput-oriented benchmark of Ampere optimized llama.cpp using arbitrary model(s) provided by the user. | ||
The benchmarking script spawns multiple parallel streams of token generation using llama.cpp and provides user with aggregate metrics of both prompt eval and token generation stages. | ||
Underneath, the _batched-bench_ script from upstream llama.cpp project is being used in an unaltered form. | ||
The script orchestrates the benchmark inside Docker container from the outside environment, **therefore this script should not be run inside Docker container.** | ||
|
||
## Setup | ||
Few dependencies need to be installed first. On Debian-based systems you can use the setup script. | ||
## ARM | ||
Instructions assume you have a debian based OS | ||
```bash | ||
cd benchmarks | ||
sudo bash setup_deb.sh | ||
# vim download_models.sh # uncomment / add models you want to download | ||
bash download_models.sh | ||
# vim run.sh # modify run.sh (provide the name of the docker image, threads, batch sizes etc.) | ||
nohup sudo bash run.sh | ||
``` | ||
|
||
## Downloading models | ||
Any GGUF model is expected to work, if you experience troubles running your network of choice please raise an [issue](https://github.com/AmpereComputingAI/llama.cpp/issues/new/choose). | ||
Benchmarking script expects models to be placed under _**llama.cpp/benchmarks/models**_ dir. | ||
## x86 | ||
Instructions assume you have a debian based OS | ||
```bash | ||
mkdir -p models | ||
huggingface-cli download QuantFactory/Meta-Llama-3-8B-Instruct-GGUF Meta-Llama-3-8B-Instruct.Q8_0.gguf --local-dir models --local-dir-use-symlinks False | ||
``` | ||
cd benchmarks | ||
sudo bash setup_deb.sh | ||
# vim download_models.sh # uncomment / add models you want to download | ||
bash download_models.sh | ||
|
||
## Benchmark | ||
Provide run.py Python script with following arguments: | ||
- -m, filename(s) of model(s) that should be available under _**llama.cpp/benchmarks/models**_ directory, multiple models can be provided | ||
- -t, threadpool(s) per single process, e.g., if there are 20 threads available on the system, if -t 10 is provided, 2 parallel processes will be spawned, each using 10 threads; | ||
multiple threadpools can be provided and they will be treated as separate cases to benchmark | ||
- -b, batch size(s) to benchmark, meaning separate token generation streams handled as a single batch; multiple batch sizes can be provided and they will be treated as separate cases to benchmark | ||
- -p, prompt size(s) to benchmark, size of an input prompt; multiple prompt sizes can be provided and they will be treated as separate cases to benchmark | ||
- -r, thread-range, e.g., on an 80-thread system, it should be input as 0-79, unless user wants to use just a subset of available threads, say 16-63 (48 threads indexed 16<>63) | ||
```bash | ||
python3 run.py -m Meta-Llama-3-8B-Instruct.Q8_0.gguf -t 10 16 32 40 64 80 -b 1 2 4 8 16 32 64 -p 512 -r 0-79 | ||
cd utils | ||
sudo docker build -t llama_x86 . | ||
cd .. | ||
# vim run.sh # modify run.sh (provide the name of the docker image, threads, batch sizes etc.) | ||
nohup sudo bash run.sh | ||
``` | ||
|
||
## Quick run on 80t OCI A1 system | ||
```bash | ||
bash setup_deb.sh # works on Debian-based systems | ||
bash download_models.sh # uncomment preferred models in the file, by default llama3 q8_0 will be downloaded | ||
bash run.sh # modify to adjust number of threads available and other parameters | ||
``` | ||
Benchmarks will take few hours in default setting, going over various combinations of n_proc x n_threads x batch_size x prompt_size x model_size 😵💫 | ||
After they complete you will find .csv files with results in the benchmarks directory of this repo. |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
set -e | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets remove run.sh and instead describe args of run.py for user to set |
||
python3 run.py -m Meta-Llama-3-8B-Instruct.Q8_0.gguf -t 10 16 32 40 64 80 -b 1 2 4 8 16 32 64 -p 512 -r 0-79 | ||
python3 run.py -m Meta-Llama-3-8B-Instruct.Q8_0.gguf -t 8 12 16 24 48 -b 1 2 4 8 16 32 -p 128 -r 0-47 -d amperecomputingai/llama.cpp:latest | ||
rm -f /tmp/log_power |
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,7 @@ | ||
FROM ubuntu:22.04 | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update -y && apt-get install -y build-essential cmake vim wget git numactl libopenblas-dev pkg-config python3 python3-pip libnuma-dev clang | ||
RUN mkdir /workspace | ||
RUN mkdir /llm | ||
RUN cd /workspace && git clone -b b3615 https://github.com/ggerganov/llama.cpp.git && cd llama.cpp && make -j && mv /workspace/llama.cpp/llama-batched-bench /llm/ | ||
RUN rm -R /workspace |
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
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.
I think user has to specify dockerfile with -f arg?
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.
there is only one Dockerfile in the directory, so it will build only that one without -f.