Ethereum Mining - GPU Virtualization Testing
GPU Virtualization Testing
I got into virtualization quite awhile ago. I enjoy the hobby as it allows maximizing current hardware while still maintaining daily use. In this article I will be testing the differences between mining on bare hardware and an virtual machine. Using the integrated GPU on the Intel Core i7-3770 as an display for Linux.
Hardware
Software
GPUs
I've had the GPUs since 2013 and they are still going strong. I've mined Litecoins back in the day with these before ASIC came out. When I converted them over to gaming for an time I had to reclock as they were not stable for gaming. The same clocks and voltages there were stable for gaming were not for ethereum. I had to yet again reclock and revolt.
Reclocked
- CPU: 1000MHz
- MEMORY: 1600MHz
- VDDC: 1094
Been stable for both cards for days.
VMs
VMs allow you to problem solve issues easier and revert if an problem arises. When I was first testing these cards I had them in separate VMs. This allow for performance isolation on the same machine. Finding issues becomes an breeze when reclocking cards.
Issues
Isolation of hardware still isn't perfect and is still under development. You will most likely run into weird issues. For example sometimes when an GPU crashes from bad clocking it will crash the VM. When restarting Qemu will complain about an permission issue.
qemu-system-x86_64: -device vfio-pci,host=02:00.0,multifunction=on: vfio error: 0000:02:00.0: failed to setup INTx fd: Operation not permitted
Rebooting should fix the issue. However this can cause another issue that when rebooted the device won't show up using lspci | grep VGA
.
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09)
An proper power down is required for device to be recognized again.
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/8970 OEM / R9 280X]
02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/8970 OEM / R9 280X]
Drivers
Drivers for the GPUs were another issue. I was only able to use the drivers that Windows installs using driver search from Device Manager. I always made an back up of the harddrive image to easily revert the VM back to an working state for driver installs. Installing an other driver from amd/ati resulted in an unbootable system. It could be that my motherboard is an early UEFI model and doesn't implement everything correctly.
Testing
Test Cases
- Windows 8.1
My graphics cards seem only to have non-UEFI bios.
Windows 8.1 UEFI on barebones machine
Cons
- Have to use all resources for windows
Pros
- No virtualization required
Windows 8.1 UEFI OVMF VM
Cons
- Could not install 15.12 or 15.11 drivers
- Bios of GPUs could not be read or written
Pros
- Provision only the resources needed
Windows 8.1 non-UEFI VM
Cons
- Could not install 15.12 or 15.11 drivers
Pros
- Can flash cards
- Provision only the resources needed
Conclusion
- I didn't see performance degradation while mining in an virtual environment
- I would recommend using an non UEFI VM for non UEFI video cards
- UEFI should outperform non UEFI when using UEFI bios video cards
I'm still able to make full use of the computer without bothering the mining side of things. Keeping the everyday usefulness of it and still being able to play occasional games on the i7-3770. If I get an urge to play an game that takes a bit more power I can release one of my GPUs from the mining VM and throw it into an gaming VM. Still mining and gaming at the same time without effecting each other.
Thank you for this insightful post!
Wow man, that is incredibly detailed, I will definitely start looking more into ethereum. Thank you for sharing!
I got GTX960 4Gb and Windows 10 which results in poor hashrate. I tried to install VM via QEMU but failed. Do you have some instructions on how to start a VM with PCI passthrough settings on win10x64 machine?