update the readme to reflect the scripts existence
This commit is contained in:
parent
861d87c864
commit
17c1e23bed
2 changed files with 30 additions and 16 deletions
|
@ -1,24 +1,41 @@
|
||||||
# How to run & debug a specific test without anything else to keep the feedback loop short?
|
# How to run & debug a specific test without anything else to keep the feedback loop short?
|
||||||
Borrowing from the CI scripts to make something workflow specific, we have the following.
|
There is a script called debug-test.sh in the scripts folder that takes a REGEX as its only parameter. For example, running the following command will output an interactive list from which you can select a test. It will then build & run in the debugger for you.
|
||||||
```bash
|
```bash
|
||||||
|
./scripts/debug-test.sh test-tokenizer
|
||||||
|
|
||||||
|
# Once in the debugger, i.e. at the chevrons prompt, setting a breakpoint could be as follows:
|
||||||
|
>>> b main
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# How does the script work?
|
||||||
|
If you want to be able to use the concepts contained in the script separately, the important ones are briefly outlined below.
|
||||||
|
```bash
|
||||||
|
# Step 1: Prepare the Build Environment
|
||||||
rm -rf build-ci-debug && mkdir build-ci-debug && cd build-ci-debug
|
rm -rf build-ci-debug && mkdir build-ci-debug && cd build-ci-debug
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug -DLLAMA_CUDA=1 -DLLAMA_FATAL_WARNINGS=ON .. && cd ..
|
cmake -DCMAKE_BUILD_TYPE=Debug -DLLAMA_CUDA=1 -DLLAMA_FATAL_WARNINGS=ON .. && cd ..
|
||||||
# runs faster
|
|
||||||
|
# Step 2: Build the Project
|
||||||
make -j
|
make -j
|
||||||
# if you see the "you don't have "cache" installed warning, install it to save immense amounts of time!"
|
|
||||||
|
# Step 3: Navigate to Test Directory
|
||||||
|
# Tip: If you see a warning about missing "cache" during installation. Then install it to save immense amounts of time!
|
||||||
cd tests
|
cd tests
|
||||||
|
|
||||||
|
# Step 4: Identify Test Command for Debugging
|
||||||
# The output of this command will give you the command & arguments needed to run GDB.
|
# The output of this command will give you the command & arguments needed to run GDB.
|
||||||
# -R test-tokenizer -> looks for all the test files named test-tokenizer* (R=Regex)
|
# -R test-tokenizer : looks for all the test files named test-tokenizer* (R=Regex)
|
||||||
# -N -> "show-only" disables test execution & shows test commands that you can feed to GDB.
|
# -N : "show-only" disables test execution & shows test commands that you can feed to GDB.
|
||||||
ctest -R test-tokenizer-0 -V -N
|
# -V : Verbose Mode
|
||||||
# OUPUT:
|
ctest -R ${test_suite} -V -N
|
||||||
# 1: Test command: /home/ubuntu/workspace/llama.cpp/bin/test-tokenizer-0 "/home/ubuntu/workspace/llama.cpp/tests/../models/ggml-vocab-llama-spm.gguf"
|
|
||||||
# 1: Working Directory: .
|
|
||||||
# Labels: main
|
|
||||||
# Test #1: test-tokenizer-0-llama-spm
|
|
||||||
|
|
||||||
# Now that we have the command & arguments needed to run a test, we can debug it with GDB.
|
# Step 5: Debug the Test
|
||||||
# I copied the command from the above output, your scenario will be different.
|
gdb --args ${test_path} ${test_args}
|
||||||
gdb --args /home/ubuntu/workspace/llama.cpp/bin/test-tokenizer-0 "/home/ubuntu/workspace/llama.cpp/tests/../models/ggml-vocab-llama-spm.gguf"
|
gdb --args /home/ubuntu/workspace/llama.cpp/bin/test-tokenizer-0 "/home/ubuntu/workspace/llama.cpp/tests/../models/ggml-vocab-llama-spm.gguf"
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Step 1: Prepare the Build Environment
|
# Step 1: Prepare the Build Environment
|
||||||
pushd $(git rev-parse --show-toplevel)
|
pushd $(git rev-parse --show-toplevel)
|
||||||
rm -rf build-ci-debug && mkdir build-ci-debug && pushd build-ci-debug
|
rm -rf build-ci-debug && mkdir build-ci-debug && pushd build-ci-debug
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue