Benchmark RandomX on L5

Hello

Can you compile and benchmark RandomX speed on L5 https://github.com/xmrig/xmrig ?

This file with functions should help:
    https://paste.debian.net/plainh/acdb96f9

High level workflow is the following:
    1. open terminal
    2. download that file to L5
        wget https://paste.debian.net/plainh/acdb96f9 -O bench.sh
    3. compile XMRig
        source bench.sh
        step_build
    4. connect L5 to some WiFi network common with your PC
    4. setup ssh on L5 for remote access without GUI
        source bench.sh
        step_ssh
    5. use printed commands to reach L5 from your PC
        e.g.
            TRY these commands to reach this device via SSH
            ssh purism@10.0.2.15
    6. start benchmark via ssh
        source bench.sh
        step_bench
    7. revert everything on your L5
        source bench.sh
        step_revert

So you’re telling people to download random stuff from the internet and run it??

If this is an important or worthwhile benchmark then I myself would rather that it goes into an official repository.

1 Like

@kieran,
The benchmark itself is https://github.com/xmrig/xmrig.

The content of this link can’t be changed by me https://paste.debian.net/plainh/acdb96f9.

bench.sh
step_build(){
  [[ ! -f ./xmrig/build/xmrig ]] && {
    sudo sysctl vm/nr_hugepages=0
    sudo apt-get install -y git build-essential ninja-build cmake libuv1-dev libssl-dev libhwloc-dev
    git clone https://github.com/xmrig/xmrig.git --depth=1 --branch=dev
    (
      cd xmrig
      b=release
      B=build;
      declare -a cmake_options=(
        -DWITH_CUDA=0
        -DWITH_DEBUG_LOG=0
        -DWITH_HTTP=1
        -DWITH_HWLOC=1
        -DWITH_MSR=0
        -DWITH_OPENCL=0
        -DWITH_PROFILING=0
        -DWITH_TLS=1
        -DWITH_BENCHMARK=0
        -DWITH_RANDOMX=1
        -DWITH_ARGON2=0
        -DWITH_KAWPOW=0
        -DWITH_ASTROBWT=0
        -DWITH_CN_HEAVY=0
        -DWITH_CN_LITE=0
        -DWITH_CN_PICO=0
        -DWITH_BENCHMARK=1
        -GNinja
      )
      S=$(realpath .)
      mkdir -p $B
      (cd $B; cmake "${cmake_options[@]}" $S; ninja)
    )
  }
}

step_ssh(){
  sudo apt-get -y install openssh-server
  sudo systemctl start sshd
  python3 <<'EOF'
import subprocess
import json
j_eth = json.loads(subprocess.getoutput('ip -j addr'))
text_id = subprocess.getoutput('whoami')
cmds = '\n'.join(['ssh {}@{}'.format(text_id, e) for e in sum([[a['local'] for a in e['addr_info'] if a['family'] == 'inet'] for e in j_eth if 'UP' in e['flags'] and 'lo' != e['ifname']], [])])
print('\nTRY these commands to reach this device via SSH\n')
print(cmds)
EOF
}

step_bench(){
  (
    on_exit(){
      pkill -9 -f 'xmrig'
      sudo renice -n 0 $$
      pkill -9 -f 'bash -c A=track_temperature'
      sudo sysctl vm/nr_hugepages=0
      sudo systemctl start phosh
    }
    trap on_exit EXIT
    sudo systemctl stop phosh
    while [[ $(sysctl vm/nr_hugepages) != "vm.nr_hugepages = 1176" ]]; do sudo sysctl vm/nr_hugepages=1176; sleep 1; sysctl vm/nr_hugepages; done;
    bash -c 'A=track_temperature; while true; do sleep 5; sensors; done;' &
    sudo renice -n -20 $$
    ./xmrig/build/xmrig --benchmark 1M -a rx/0 --cpu-no-yield --threads 5 --print-time 15 --submit
  )
}

step_revert(){
  sudo sysctl vm/nr_hugepages=0
  sudo systemctl start phosh
  sudo systemctl stop sshd
  sudo apt-get -y remove openssh-server
  rm -fr ./xmrig
  sudo apt-get -y remove git build-essential ninja-build cmake libuv1-dev libssl-dev libhwloc-dev
}

These are just shell help functions adopted for Librem 5 to automate all steps during benchmark.

There are some official docs:
compilation step https://xmrig.com/docs/miner/build/ubuntu
benchmark step https://xmrig.com/docs/miner/benchmark
ssh setup step https://developer.puri.sm/Librem5/Development_Environment/Phone/Development_Tools.html

I personally prefer automated shell code instead of reading a lot of text, therefore i’ve created that shell help functions.

Related