-
Notifications
You must be signed in to change notification settings - Fork 40
Developer's Corner
SWARM is capable of working in any *nix OS. Here are the fine points to work in integration:
Free Space
Depending on how many miners/device groups users may specify, you may require up to 1GB of extra space to run SWARM.
Dependencies:
Swarm requires Powershell 6.1.0 to run. To get the version of powershell I use in HiveOS, I use the following:
wget https://github.com/PowerShell/PowerShell/releases/download/v6.1.0/powershell-6.1.0-linux-x64.tar.gz -O /tmp/powershell.tar.gz
sudo mkdir -p /opt/microsoft/powershell/6.1.0
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/6.1.0
sudo chmod +x /opt/microsoft/powershell/6.1.0/pwsh
sudo ln -s /opt/microsoft/powershell/6.1.0/pwsh /usr/bin/pwsh
sudo rm -rf /tmp/powershell.tar.gz
SWARM will query GPU drivers for items like power, and what gpu's are available to mine (to build stat arrays based on user arguments). Doing this requires swarm to have access to:
rocm-smi
nvidia-smi
There are miners that require the following libraries to work:
libc-ares2
libuv1
SWARM will compile CPU miners for optimal performance. See any cpuminer on the needed dependencies required for compiling them.
On top of the normal libraries required for HiveOS.
SWARM uses:
wget
to install miners and:
tar
command to extract them in unix environment
SWARM is meant to run in:
screen
This is done, so that OS's can run SWARM from terminal. You can detach and attach screens as necessary to switch between them. To view information.
SWARM has small mini bash scripts, which are placed in the /usr/bin directory. This is what allows users to run commands like stats
and active
, no matter what directory they are in, and it will start the correct mini-script. To see the full list of commands that needs to be installed: One simply needs to view:
.\install.ps1
Which is the Ubuntu script which shows everything needed to set SWARM up, including making the required symlinks needed for .\build\export folder, so they can be exported in when SWARM starts a new miner. Swarm handles the problem of adding needed libraries to run miners. The libraries currently in swarm can be found in:
.\build\export
And can be changed as necessary.
background miner launch
(Note: This is going to soon change, as I'm creating a new way to launch so users can remotely add their own prestart commands. Also, all the startup.sh files will be done with just one file.)
.\build\bash\startupamd.sh
.\build\bash\startupnvidia.sh
.\build\bash\startupcpu.sh
Are the three bash launch scripts which are executed when a new miner starts. If you need to add/edit to load anything further prior to launching the miner- You would add it here. Some OS's may require further exports. I suggest following the same methodology, and adding a small delay with each start. This is because I have found that errors occur if you do not slow the process down, as it may skip over a screen command before miner starts, especially with USB.
STATS
SWARM gather all the stats from the rig, based on what users specified in their arguments. This is done through the background screen process called:
background
Once it has queried all API's, and received all stats: It writes these stats to file, which is in a format for a developer to easily parse, and is similar to the same format as ccminer telnet. It writes to this file in an interval between 10-30 seconds depending on how many miners are running (10 seconds for each platform).
The location of the file is:
".\build\bash\hivestats.sh"
A sample output of the file:
GPU=3563.56 GPU=1408.61 GPU=3607.08 GPU=1455.21 GPU=3559.43 GPU=1434.85 GPU=1434.18 GPU=1460.22 GPU=1423.47 GPU=3635.79 GPU=3512.94 GPU=1435.95 GPU=3672.89 KHS=31574.37 ACC=35 REJ=0 ALGO=lyra2z FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 FAN=80 TEMP=66 TEMP=68 TEMP=74 TEMP=58 TEMP=64 TEMP=61 TEMP=66 TEMP=60 TEMP=60 TEMP=71 TEMP=68 TEMP=63 TEMP=59 UPTIME=144 HSU=khs
HSU is the type of hash that each GPU is displaying. If user is specifying multiple groups: Whatever group one is (AMD1,NVIDIA1) will be the HSU.
Note: Some miners do not stat the temps/fans. In order to attain those stats- I run rocm-smi or nvidia-smi to query drivers directly. This may occasionally timeout, it is beyond my control as the driver is busy.
Debug
.\build\txt
As SWARM runs, critical information is written to these small .txt files, each labeled according to what they are gathering. It is a useful addition to help you troubleshoot why SWARM may not be working on your OS.
logs
.\logs
SWARM creates its own transcript, as well a .log for each device group. It has its own log rollover system.
config
(NOTE: Next version this is going to change a lot, to incorporate a better update system, along with other features).
.\config
Everything except the arguments themselves (however this is in development right now) is formatted into .json. This allows you to pull said file remotely, and create commands to modify them remotely. I am working on right now integrating commands to do this via SWARM now.