An Introdction to RandomX, Benchmarking tool and pool/solo mining

If you have come here from the RandomX GitHub please post questions and issues in this thread not the GitHub - I am more than willing to help.

If you are new here and found this place via RandomX, welcome to zcash. We too are a privacy centred coin. Take a look around and I hope you enjoy your stay.


This assumes you are running from windows environment and want to build a clean(ish) Ubuntu setup on a bootable USB stick to test RandomX. (usb 2.0 is fine, just a bit slow. does not impact the benchmark at all.)

A lot of this info is taken from different posts and the readme on the RandomX github
This post will be specifically dealing with desktop hardware. Light hardware, GPU, Server and FPGA to follow. (in that order probably)

The main point is to get a standard test environment set up and run some basic tests for desktops. There will be further detail in the ryzen post.

First we need to create a bootable, ubuntu install with persistence. This lets you play with overclocking and other stuff. It will keep files across reboots.

Download ubuntu desktop 18.04 from:
https://ubuntu.com/download/desktop

(19.04 will work too.)

Download Yumi 2.0.6.7

  • Grab a USB drive (minimum 8gb) usb 3 highly recommended but not required. It runs fine from usb 2.0
  • Format to NTFS
  • Launch YUMI
  • MAKE SURE YOU ARE WRITING TO THE CORRECT DRIVE

Configure like in the image - note set the persistent to be 8 - 16gb.

click to see image

Hit Create.
Wait quite a bit. (creating the persistence file can take a little bit of time.)
Now reboot to the usb drive.

Note I have had to manually add “persistent” when booting from UEFI but never when booting from the BIOS. YMMV - follow the instructions below.

Booting via the bios method is the recommended method. UEFI and persistence may not work on some motherboards.

How to boot via the bios

booting from the bios

You can press the key to interrupt the boot and let you select a boot device (normally F11 or F12)

Alternatively if you do not get time to see that screen due to fast boot then:
Press the windows key then type

change advanced startup options

Select restart now.
This will bring up an options screen, select boot from the first listed usb device on the left hand side. NOT usb UEFI on the right hand side.

Which boot options to pick. It will timeout on the default hdd if one is connected after 30 seconds.

Boot splash screens and options

Select the bottom option on this screen, Linux Distributions.

Make sure you select Ubuntu-18.0.4.2-desktop from the next screen.

Then press enter on the first choice of the next screen.

ubuntu should now boot fine and have more than enough space for testing.

How to boot from UEFI

Boot to USB from UEFI

If you are using UEFI you will probably have to use the windows reboot feature.
Press the windows key then type

change advanced startup options

Select restart now.
This will bring up an options screen, select boot from the new Ubuntu usb install.
If this doesn’t work follow the bios instructions above.
[/code]

Once you have launched the persistent USB install, we need to get everything up to date otherwise all sorts of strangeness happens. it is relatively easy. and takes 10 - 15 minutes with a decent network connection.

You get a much greater hashrate with the latest updates, and they are needed for RandomX to function properly.
Because this is the desktop version there is a lot of stuff that gets updated that we dont need. but might as well do it.

bring up a terminal prompt

ctrl+alt+t

Apply some updates and a few tools.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake git build-essential

Now we have a working ubuntu install we need to get RandomX and its dependices setup.

This next bit is taken straight from the github. is taken straight from the github readme. you do not need to be familiar with compiling code for this to work. it works as is.

This is also slightly easier and less reliant on someone else making binaries for you. Binaries are available on the release page. I am going to deal with compiling from source. (it really is easier)

git clone https://github.com/tevador/RandomX.git
cd RandomX
mkdir build && cd build
cmake -DARCH=native ..
make

This will produce a bunch of output. (cut from post, due to length) You should not get any error messages. If you do post a message below.

We should move the complied benchmarking tool somewhere else for easier testing.

mkdir ~/rdx
mv ./randomx-benchmark ~/rdx/

Might as well run the tests while we are here and then clean up the build process.(If you move the usb stick to a new pc, with different hardware, you might as well compile it again.)

./randomx-tests
make clean

If any of those tests from running ./randomx-tests fail then please post the output below.

Now back to testing, and make sure everything is working.

cd ~/rdx/ and a quick check that the miner is working. This will be slow, and this will not be representative of your actual hashrate, there are a few more tweaks to do after.

./randomx-benchmark --mine --jit

This will just run 1 thread and 1 core so it will take a while. We are not using largePages either, we will set that in a bit.

results of basic test
RandomX benchmark v1.0.4
 - full memory mode (2080 MiB)
 - JIT compiled mode
 - hardware AES mode
 - small pages mode
Initializing (1 thread) ...
Memory initialized in 24.825 s
Initializing 1 virtual machine(s) ...
Running benchmark (1000 nonces) ...
Calculated result: 38d47ea494480bff8d621189e8e92747288bb1da6c75dc401f2ab4b6807b6010
Reference result:  38d47ea494480bff8d621189e8e92747288bb1da6c75dc401f2ab4b6807b6010
Performance: 395.119 hashes per second

Post the error message below if you get one.

Check that the result it says you should get matches what you do get, if it doesnt something is very wrong. reduce overclock. post below.

Nice, now it is time to configure it. The requirements are:

per mining thread.

to get this info, as well as rough guesses for the --init and --threads value we can use dmidecode - this will produce a page or two of output. the real relevant parts I have posted below. you can scroll up through the terminal window to check all the values.

sudo dmidecode -t processor
The most relevant bits are:
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0053, DMI type 4, 42 bytes
Processor Information
	Socket Designation: SOCKET 0
	Signature: Type 0, Family 6, Model 58, Stepping 9
	Version: Intel(R) Core(TM) i7-3540M CPU @ 3.00GHz

	Core Count: 2
	Core Enabled: 2
	Thread Count: 4

Now we look for the amount of L1,2 and 3 the CPU supports.

sudo dmidecode -t cache
cache values
Socket Designation: CPU Internal L2
	Configuration: Enabled, Not Socketed, Level 2
	Operational Mode: Write Through
	Location: Internal
	Installed Size: 512 kB
	Maximum Size: 512 kB


Socket Designation: CPU Internal L1
	Configuration: Enabled, Not Socketed, Level 1
	Operational Mode: Write Through
	Location: Internal
	Installed Size: 128 kB
	Maximum Size: 128 kB

Socket Designation: CPU Internal L3
	Configuration: Enabled, Not Socketed, Level 3
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 4096 kB
	Maximum Size: 4096 kB

So, this cpu has

  • 2 Cores (probably maximum threads)
  • 4 Threads (quicker init time)
  • 128kb L1 (no limit)
  • 512kb L2 (limits to two mining threads)
  • 4MB L3 (limits to two mining threads)

So it should fit perfectly with

–threads 2 --init 4

Lets try.

First enable largePages

sudo sysctl -w vm.nr_hugepages=1250

Now try the benchmark (note 50000 nonces takes roughly 1 minute on this cpu, it will be different on yours, adjust so the benchmark takes 1 minute.)

./randomx-benchmark --mine --jit --largePages --threads 2 --init 4 --nonces 50000

So there isnt much point doing ram testing on this hardware, this is cpu limited.

There is not much point in doing overclocking on this laptop, but we should give it a go, This post is long enough so that will be tomorrow.

Now there is a consistent stable test environment I will do the Ryzen testing in this format, but with more ram timings and overclocking. To try to confirm the speculation in the first post.

I have a template already, but im tired. I will continue this later.

I will also re organise this thread to make it easier to read.

1 Like