-
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
wolfamdctrl
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.
An important thing to note is SWARM creates its only launch scripts on demand, in order to add/remove background miner prestarts. This requires SWARM having the ability to use chmod +x
to make the executable on demand, the same goes for miner executables. Some developers tend to forget permissions, and SWARM chmod +x
all exectuables before launches to ensure they have access to do so. This may require SWARM having special permissions to do this.
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
.\build\bash\startup.sh
Is the background script that is made on demand, and launches background miners. The great thing about this, is that since it is made on demand, users can add further commands to the script for each miner. These commands can be changed for each miner within the "prestart" section of the miner.json files located in .\config\miners
folder. If your application of SWARM requires further addition to the launch of the background miners, you would simply add it to the 'prestart' section of the miner in question.
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.
If you require help parsing the stats- SWARM already does it for HiveOS, in a bash script format:
.\h-stats.sh
Is the bash script to parse the hivestats.sh file, and covert it to Json for HiveOS stats.
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
Most configuration details are changed/formatted into .json within the config folder. This allows you to pull said file remotely, and create commands to modify them remotely. -Update Yes
works by copying the previous .json files over to the new version, allowing users to update without having to modify their settings/user configurations.