Miner.farm Crypto Currency Community Forum

Browse and post your favorite coin/crypto news, miner.farm and PiMP OS updates and announcements, mining guides, overclocking tips, and more...

Quick Links


hugepages script for cpu mining with xmr-stak (do not use with xmrig)


  • Staff

    can be run from startup.sh
    Probably still good for xmr-stak miners, but if used with xmrig it will cause problems.

    xmrig handles this function on it's own so long as the miner is ran as root.

    #!/bin/bash
    round() {
        echo $(printf %.$2f $(echo "scale=$2;(((10^$2)*$1)+0.5)/(10^$2)" | bc))
    }
    if [ $(free -m | grep Mem | awk '{ print $2 }') -gt 3000 ] && [ $(cat /proc/sys/vm/nr_hugepages) -eq 0 ]; then
        MEM_FREE=$(awk '/Hugepagesize:/{p=$2}/ 0 /{next}/ kB$/{v[sprintf("%9d GB %-s",int($2/1024/1024),$0)]=$0;next}{h[$0]=$2}END{for(k in v) print k;for (k in h) print sprintf("%9d GB %-s",p*h[k]/1024/1024,k)}' \
            /proc/meminfo|sort -nr|grep --color=auto -E "^|.(Huge._[TF]|Mem).*:|" |grep MemFree | awk '{ print $4 }')
        PAGE_SIZE=$(awk '/Hugepagesize:/{p=$2}/ 0 /{next}/ kB$/{v[sprintf("%9d GB %-s",int($2/1024/1024),$0)]=$0;next}{h[$0]=$2}END{for(k in v) print k;for (k in h) print sprintf("%9d GB %-s",p*h[k]/1024/1024,k)}' \
            /proc/meminfo|sort -nr|grep --color=auto -E "^|.(Huge._[TF]|Mem).*:|" |grep Hugepagesize | awk '{ print $4 }')
        # Reserve hugepages based on free memory
        HPGS=$(echo $(round ${MEM_FREE}/${PAGE_SIZE} 0))
        RES_HPGS=$(echo $(round ${HPGS}*25/100 0))
        echo "${RES_HPGS}" > /proc/sys/vm/nr_hugepages
    else
        echo  "Not enough free memory to apply hugepages!"
    fi
    

 



Want 10% more hash from your rigs?



We promise to keep your email safe and never spam you.



© 2014-2020 Miner.farm | By Miners, For Miners | Portable Instant Mining Platform, LLC