Testing the LLR application outside of Boinc
Update from post
#44: Now based on LLR2.
Preface
Results which I posted early in this thread came from running many random WUs (a sufficient number for each configuration to be tested), adding their run times and credits, and thus arriving at PPD of a given configuration. Benefits of this method are that you get credit for all CPU hours expended, might even find primes, and may do this testing even during a PrimeGrid challenge. The downsides are imprecision due to variability between WUs, and lack of repeatability.
Alternatively, the LLR application can be run stand-alone without boinc and PrimeGrid's llr_wrapper. That way, you can feed the very same WU to LLR over and over, thus eliminate variability between WUs, and can directly compare results from a single run on each configuration to be tested. (In turn, the downside of this method is that your CPUs don't earn any boinc credit on the side while testing.)
How the offline test works in principle
I didn't go ask how to run LLR stand-alone; I merely watched how boinc-client + llr_wrapper run it and replicated that. Hence my recipe may contain some bits of cargo cult. File names and scripts are shown for Linux here, but the method can be replicated on Windows as well.
- Use boinc-client to run a single WU of the PrimeGrid LLR-based subproject that you want to test for. Watch which program binary it runs, and which input file it fed into the LLR application.
- Optionally: Later, when PrimeGrid validated the WU, make a note of the credit that was given for the WU.
- Create a working directory for testing. Copy the following files into this directory, and create a test script within the directory as shown below.
- Choose combinations of the number of concurrent tasks and the number of threads per task which interest you, and edit the end section of the script accordingly.
- Start the script and wait for the tests to complete.
- Look through the log which the script wrote and make sense of the run times which are reported in it.
A note on steps 1 and 2: Instead of taking the input data from a real workunit, you can also directly specify a candidate number of your choice. E.g., look up which parameters a given PrimeGrid subproject is currently working on (
Suproject status) and pick a
k and
n combination from there. However, you won't know the credits for this workunit then.
Required files
First, make a subdirectory in which the tests shall be executed.
Bash:
mkdir ~/PrimeGrid_Tests
cd ~/PrimeGrid_Tests
Get the LLR2 program. At the time of this writing, sllr2_1.1.0_linux64_201114 was current on x86-64 Linux. You may have it already in your boinc data directory:
Bash:
cp -p /var/lib/boinc/projects/www.primegrid.com/sllr2_1.1.0_linux64_201114 .
If boinc does not have this file yet, download it:
Bash:
wget https://www.primegrid.com/download/sllr2_1.1.0_linux64_201114.gz
gunzip sllr2_1.1.0_linux64_201114.gz
chmod +x sllr2_1.1.0_linux64_201114
Copy the input file as noted in the previous subsection from the PrimeGrid project directory within boinc's data directory. Such files have names like "llrDIV_694839913". — This is not required if you enter the formula with the
k and
n to test directly into the following script.
Create the script file.
Bash:
cat >_run_llr2.sh <<'EOF'
#!/bin/bash
# (Don't edit, unless PrimeGrid updates this.)
# The LLR2 program, copied from boinc's projects/www.primegrid.com/ subdirectory,
# or downloaded from https://www.primegrid.com/download/sllr2_1.1.0_linux64_201114.gz
# and then gunzip'ed.
LLREXE="sllr2_1.1.0_linux64_201114"
# (Don't edit, unless PrimeGrid updates this.)
LLROPTIONS=\
"-oGerbicz=1 -oProofName=proof -oProofCount=64 -oProductName=prod "\
"-oPietrzak=1 -oCachePoints=1 -pSavePoints -d -oDiskWriteTime=10"
# Edit this:
# The input can be given either as a filename,
# or as an expression in the form of "k*b^n+c" or "b^n-b^m+c".
LLRINPUT="11*2^7811487+1" # llrDIV, FFT length 480K (FFT data size = 3.75 MB), 1,534.49 cobblestones
# Edit this:
# Choose a file name of the log.
LOGFILE="$(hostname)_llrDIV_480K_${LLRINPUT}_protocol.txt"
# Edit this:
# Set to 1 if boinc-client shall be suspended and resumed before/ after the tests.
SUSPEND_RESUME_BOINC=0
# (Don't edit.)
TIMEFORMAT=$'\nreal\t%1lR\t(%0R s)\nuser\t%1lU\t(%0U s)\nsys\t%1lS\t(%0S s)'
# (Don't edit.)
# run_one - run a single LLR process, and show timing information when finished
#
# argument 1, mandatory: slot number, i.e. unique name of the instance
# argument 2, mandatory: thread count of the process
# argument 3, optional: completion percentage at which to terminate a test
#
run_one () {
SLOT="slot_$1"
rm -rf ${SLOT}
for ((;;))
do
mkdir ${SLOT} || break
ln ${LLREXE} ${SLOT}/llr.exe || break
cd ${SLOT} || break
[ -f ../${LLRINPUT} ] && i=../${LLRINPUT} || i="-q${LLRINPUT}"
echo "---- slot $1 ----" > stdout
if [ -z "$3" ]
then
time ./llr.exe ${LLROPTIONS} -t$2 $i >> stdout 2> stderr
else
./llr.exe ${LLROPTIONS} -t$2 $i >> stdout 2> stderr &
LLRPID=$!
while sleep 5
do
tail -1 stdout | grep -e "[[]$3[.]" > /dev/null && break
done
kill ${LLRPID}
wait ${LLRPID} 2> /dev/null
fi
cat stdout stderr
cd ..
break
done
rm -rf ${SLOT}
}
# (Don't edit.)
# run_series - run one or more LLR processes in parallel, and log everything
#
# argument 1, mandatory: number of processes to run at once
# argument 2, mandatory: thread count of each process
# argument 3, optional: completion percentage at which to terminate a test
#
# stdout and stderr are appended into ${LOGFILE}.
#
run_series () {
{
echo "======== $(date) ======== starting $1 process(es) with $2 thread(s) ========"
time {
for (( s=1; s<=$1; s++ ))
do
run_one $s $2 $3 &
done
wait
}
echo "======== $(date) ======= done with $1 process(es) with $2 thread(s) ========"
echo
} 2>&1 | tee -a "${LOGFILE}"
}
# Edit the passwd part if necessary.
((SUSPEND_RESUME_BOINC)) && boinccmd --passwd "$(< /var/lib/boinc/gui_rpc_auth.cfg)" --set_run_mode never
# Edit this:
# Choose your set of tests here.
# SMT on but not used
run_series 4 1 10
run_series 2 2 10
run_series 1 4 10
# SMT used
run_series 8 1 10
run_series 4 2 10
run_series 2 4 10
run_series 1 8 10
# Edit the passwd part if necessary.
((SUSPEND_RESUME_BOINC)) && boinccmd --passwd "$(< /var/lib/boinc/gui_rpc_auth.cfg)" --set_run_mode auto
EOF
chmod +x _run_llr2.sh
Edit this script file in your favorite text editor, as desired for the particular tests which you plan to run.
Optionally: Create another script which can later be used to see to which percentage a currently running test has advanced. This script needs to be run in a separate terminal.
Bash:
cat >_show_progress.sh <<'EOF'
#!/bin/bash
SLOTS=$(echo slot_*)
if [ "${SLOTS}" = 'slot_*' ]
then
echo "No processes found."
else
for s in ${SLOTS}
do
echo "---- ${s} ----"
tail -1 ${s}/stdout
echo
done
fi
EOF
chmod +x _show_progress.sh
When done, start the launcher script:
./_run_llr2.sh
The optional script to show the point of progress is started like this in another terminal:
cd ~/PrimeGrid_Tests
./_show_progress.sh
Summary
Get hold of the LLR2 executable, and copy the _run_llr2.sh script from above. Edit the script as advised for a specific test. And off you go.