Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Since some weeks ago, I got the decision to start in the cryptocurrency business (also known as digital currencies). There are many of them, some of them I didn't know they exist. The most popular one is the Bitcoin. Sadly, Bitcoin mining business is now out of scope for the most part of the users (including myself). As time passes, it is more and more difficult to complete a block. You need more and more powerful devices to have the enough hashing power. Today, using ASIC devices with 4 Tera hash/sec are not enough. Because of this reason, Bitcoin is not my selected option.

Ethereum is another crypto-currency that has been getting popularity. The Etherum is more than a cryptocurrency, it is used for digital contracts as well. Anyway, the good think about the Ethereum is that the hashing algorithm (scrypt) is memory hungry, gladly this makes almost impossible the design of ASIC devices which it allows end users to be in the game.

In this article, I am going to describe how to setup the software (not how to use it) using Mageia Linux. You need to know there is a distribution called EthOS (Debian based) which saves you all this time, but it is not for free and you won't learn all the science that it is behind.

Install RPM Dependencies

If you are using Mageia 5, you will need to backport some packages I did publish in Mageia 6.

  • catch-1.2.1-1.mga5.src.rpm
  • libjson-rpc-cpp-0.6.0-1.mga5.src.rpm

You can get them by accessing any Mageia mirror. These are the initial releases, you may find new ones. You will need these additional dependencies by typing:

urpmi x11-driver-video-fglrx boost-devel gmp-devel jsoncpp-devel 'pkgconfig(leveldb)' miniupnpc-devel cpuid curl-devel libmicrohttpd-devel argtable2-devel cmake git cryptopp-devel libMesaGLU-devel

Please enable the non-free Mageia repository as you will need the flgrx RPM's from there.In my setup, I have some AMD Radeon R9 so I will need to install the RPM with the proprietary OpenCL extensions. Because the AMD license does not allow to distribute it, you will need to install the RPM by yourself. Do the following steps:

In my setup, I have two AMD Radeon R9 290 so I will need to install the RPM with the proprietary OpenCL extensions. Because the AMD license does not allow to distribute it, you will need to install the RPM by yourself. Do the following steps:

  1. Go to http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/ and download release 2.9.1
  2. Download the AMD Radeon OpenCL SPEC File from the SPECS for Mageia Github Project
  3. Create the RPM with the rpmbbuild -bs command and the rpmbbuild --rebuild command, after that install them. Please remember you should be familiar with Mageia to do this, you will need to install the rpm-build package (and maybe others) in order to rebuild an SRPM.

If you are not using AMD, and you prefer opensource OpenCL, just write urpmi opencl-devel.

You are all set. Now, let's proceed to get the mining software.

Get the Mining Software

I prefer the C++ version, it has GPU support and it does not use an interpreted language such as python. The project URL is hosted on Github at https://github.com/ethereum/webthree-umbrella/tree/v1.2.9 https://github.com/ethereum/cpp-ethereum and all you need to do is to do a git clone --recursive command with the correct URL (take it from the page, when I was writing this article, the last release was 1.2.9).

I will work later on an RPM, but for now, follow these directions:

  1. type git clone --recursive https://github.com/ethereum/cpp-ethereum
  2. go inside the new directory webthree-umbrella cpp-ethereum
  3. create a new directory called build, type mkdir build
  4. go inside the build directory
  5. type cmake .. -DTESTS=no
  6. if all goes for good, you will see a lot of messages, but not errors. When done, type make and wait.
  7. type aticonfig --adapter=all --initial

The software is ready. I will update this article when the RPM is ready. Optionally, you can install the following RPM's, this will help the mining process:

  • fglrx-opencl
  • fglrx-devel
  • fglrx-control-center

Testing your Ethereum Rig

If the build goes for good, your next step is to review it works. I won't explain here the Etherum thing, I will just show how to know if the GPU is working or not. In the build directory, you should have a directorio named eth, inside it there is an eth binary. Type the following line:

eth --list-devices

and you will get an output similar to this:

[OPENCL]:
Listing OpenCL devices.
FORMAT: [deviceID] deviceName
[0] Hawaii
CL_DEVICE_TYPE: GPU
CL_DEVICE_GLOBAL_MEM_SIZE: 4251223936
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 3006701568
CL_DEVICE_MAX_WORK_GROUP_SIZE: 256
[1] Hawaii
CL_DEVICE_TYPE: GPU
CL_DEVICE_GLOBAL_MEM_SIZE: 4251256704
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 3008913408
CL_DEVICE_MAX_WORK_GROUP_SIZE: 256

If you see something like this, you are almost done. Next step is to do a benchmark, the first time you execute the eth -M -G it will create a DAG file, and it will report 0. You will need to re-execute. You should get an output like this:

◇ 15:25:41.395|eth #00004000…
Benchmarking on platform: { "platform": "AMD Accelerated Parallel Processing", "device": "Hawaii", "version": "OpenCL 2.0 AMD-APP (1912.5)" }
Preparing DAG...
Warming up...
ℹ 15:25:41.395|gpuminer0 workLoop 0 #00000000… #00000000…
ℹ 15:25:41.395|gpuminer0 Initialising miner...
[OPENCL]:Using platform: AMD Accelerated Parallel Processing
[OPENCL]:Using device: Hawaii(OpenCL 2.0 AMD-APP (1912.5))
[OPENCL]:Printing program log
[OPENCL]:
[OPENCL]:Creating one big buffer for the DAG
[OPENCL]:Loading single big chunk kernels
[OPENCL]:Mapping one big chunk.
[OPENCL]:Creating buffer for header.
[OPENCL]:Creating mining buffer 0
[OPENCL]:Creating mining buffer 1
Trial 1... 24204629
Trial 2... 24379392
Trial 3... 24379392
Trial 4... 24379392
Trial 5... 24292010
min/mean/max: 24204629/24326963/24379392 H/s
inner mean: 16223800 H/s
Phoning home to find world ranking...

You are done. I will write in other articles how I am building my mining cluster.Good luck mining!

MSI cores dump?

First of all, I am using an ASUS M5 A99FX PRO R2.0 motherboard. For a strange reason, I think Mageia has an issue detecting the hardware. If you get this error:

kernel BUG at drivers/pci/msi.c:313

Sep 01 17:10:08 salma.okay.com.mx kernel: ------------[ cut here ]------------
Sep 01 17:10:08 salma.okay.com.mx kernel: WARNING: CPU: 0 PID: 1526 at drivers/pci/msi.c:1051 pci_enable_msi_range+0x36a/0x3a0()
Sep 01 17:10:08 salma.okay.com.mx kernel: Modules linked in: af_packet msr nls_utf8 nls_cp437 kvm_amd vfat fat kvm irqbypass fglrx(PO) crct10dif_pclmul crc32_pclmul crc32c_intel aesni_intel snd_hda_codec_hdmi aes_x86_64 snd_hda_intel snd_hda_codec eeepc_wmi asus_wmi sparse_keymap joydev rfkill video lrw gf128mul glue_helper input_leds snd_hda_core ablk_helper mxm_wmi cryptd snd_hwdep edac_core k10temp psmouse serio_raw fam15h_power snd_pcm snd_timer snd soundcore r8169 mii 8250_fintek sp5100_tco i2c_piix4 wmi shpchp fjes tpm_infineon button acpi_cpufreq tpm_tis tpm processor evdev sch_fq_codel ipv6 autofs4 hid_logitech_hidpp hid_logitech_dj usbhid hid ohci_pci xhci_pci xhci_hcd ehci_pci ehci_hcd ohci_hcd usbcore usb_common amdkfd amd_iommu_v2 radeon i2c_algo_bit drm_kms_helper ttm drm
Sep 01 17:10:08 salma.okay.com.mx kernel: CPU: 0 PID: 1526 Comm: eth Tainted: P O 4.4.16-server-1.mga5 #1
Sep 01 17:10:08 salma.okay.com.mx kernel: Hardware name: To be filled by O.E.M. To be filled by O.E.M./M5A99FX PRO R2.0, BIOS 2501 04/07/2014
Sep 01 17:10:08 salma.okay.com.mx kernel: 0000000000000000 ffff88009677f980 ffffffff813d56fe 0000000000000000
Sep 01 17:10:08 salma.okay.com.mx kernel: ffffffff81ac384e ffff88009677f9b8 ffffffff810748f6 0000000000000001
Sep 01 17:10:08 salma.okay.com.mx kernel: ffff88009677fa90 0000000000000001 ffff880254cdc000 0000000000000000
Sep 01 17:10:08 salma.okay.com.mx kernel: Call Trace:
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff813d56fe>] dump_stack+0x63/0x85
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff810748f6>] warn_slowpath_common+0x86/0xc0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff810749ea>] warn_slowpath_null+0x1a/0x20
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff8143a4ba>] pci_enable_msi_range+0x36a/0x3a0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05e3588>] KCL_RequestMSI+0x18/0x30 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0606c9c>] IRQMGR_initialize+0x2bc/0x410 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0606987>] ? IRQMGR_alloc_context+0xb7/0x110 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc06051c7>] ? irqmgr_wrap_initialize+0x27/0x140 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05e7442>] ? KCL_DEBUG_Print_Trace+0x22/0xd0 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0606785>] ? firegl_irqmgr_init+0x55/0x100 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0617ad1>] ? hal_init_gpu+0x221/0x4e0 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05f0f3e>] ? firegl_open+0x2de/0x310 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05df1a7>] ? ip_firegl_open+0x17/0x20 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05e0938>] ? firegl_stub_open+0x98/0x100 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d06f7>] ? chrdev_open+0xa7/0x180
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811c9e8f>] ? do_dentry_open+0x1cf/0x2f0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d0650>] ? cdev_put+0x30/0x30
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811cb137>] ? vfs_open+0x57/0x80
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d6c77>] ? may_open+0x57/0xe0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d94b4>] ? path_openat+0x544/0x12a0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc061c1fa>] ? firegl_trace+0x2a/0xf0 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811db9fe>] ? do_filp_open+0x7e/0xe0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811ae861>] ? kmem_cache_alloc+0x1a1/0x1f0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811dabe7>] ? getname_flags+0x37/0x1a0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811e85ef>] ? __alloc_fd+0x3f/0x170
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811cb4cc>] ? do_sys_open+0x12c/0x210
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811cb5ce>] ? SyS_open+0x1e/0x20
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff816df4b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
Sep 01 17:10:08 salma.okay.com.mx kernel: ---[ end trace 1a745be895f43b90 ]---
Sep 01 17:10:08 salma.okay.com.mx kernel: ------------[ cut here ]------------
Sep 01 17:10:08 salma.okay.com.mx kernel: kernel BUG at drivers/pci/msi.c:366!
Sep 01 17:10:08 salma.okay.com.mx kernel: invalid opcode: 0000 [#1] SMP
Sep 01 17:10:08 salma.okay.com.mx kernel: Modules linked in: af_packet msr nls_utf8 nls_cp437 kvm_amd vfat fat kvm irqbypass fglrx(PO) crct10dif_pclmul crc32_pclmul crc32c_intel aesni_intel snd_hda_codec_hdmi aes_x86_64 snd_hda_intel snd_hda_codec eeepc_wmi asus_wmi sparse_keymap joydev rfkill video lrw gf128mul glue_helper input_leds snd_hda_core ablk_helper mxm_wmi cryptd snd_hwdep edac_core k10temp psmouse serio_raw fam15h_power snd_pcm snd_timer snd soundcore r8169 mii 8250_fintek sp5100_tco i2c_piix4 wmi shpchp fjes tpm_infineon button acpi_cpufreq tpm_tis tpm processor evdev sch_fq_codel ipv6 autofs4 hid_logitech_hidpp hid_logitech_dj usbhid hid ohci_pci xhci_pci xhci_hcd ehci_pci ehci_hcd ohci_hcd usbcore usb_common amdkfd amd_iommu_v2 radeon i2c_algo_bit drm_kms_helper ttm drm
Sep 01 17:10:08 salma.okay.com.mx kernel: CPU: 0 PID: 1526 Comm: eth Tainted: P W O 4.4.16-server-1.mga5 #1
Sep 01 17:10:08 salma.okay.com.mx kernel: Hardware name: To be filled by O.E.M. To be filled by O.E.M./M5A99FX PRO R2.0, BIOS 2501 04/07/2014
Sep 01 17:10:08 salma.okay.com.mx kernel: task: ffff880253400000 ti: ffff88009677c000 task.ti: ffff88009677c000
Sep 01 17:10:08 salma.okay.com.mx kernel: RIP: 0010:[<ffffffff81439ab6>] [<ffffffff81439ab6>] free_msi_irqs+0x56/0x1a0
Sep 01 17:10:08 salma.okay.com.mx kernel: RSP: 0018:ffff88009677f9a8 EFLAGS: 00010286
Sep 01 17:10:08 salma.okay.com.mx kernel: RAX: ffff8802539c4a00 RBX: 0000000000000000 RCX: 00000000fffffffa
Sep 01 17:10:08 salma.okay.com.mx kernel: RDX: 0000000000000000 RSI: 000000000000001c RDI: ffff880255c00100
Sep 01 17:10:08 salma.okay.com.mx kernel: RBP: ffff88009677f9c8 R08: 0000000000000000 R09: ffff880255c00000
Sep 01 17:10:08 salma.okay.com.mx kernel: R10: ffff880255c00108 R11: 0000000000000000 R12: ffff880254cdc298
Sep 01 17:10:08 salma.okay.com.mx kernel: R13: ffff880254cdc000 R14: ffff8802536e4420 R15: ffff880254cdc000
Sep 01 17:10:08 salma.okay.com.mx kernel: FS: 00007f606821f780(0000) GS:ffff88025ec00000(0000) knlGS:0000000000000000
Sep 01 17:10:08 salma.okay.com.mx kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Sep 01 17:10:08 salma.okay.com.mx kernel: CR2: 00007f60683e0000 CR3: 0000000037d49000 CR4: 00000000000406f0
Sep 01 17:10:08 salma.okay.com.mx kernel: Stack:
Sep 01 17:10:08 salma.okay.com.mx kernel: 0000000000000001 0000000000000001 00000000ffffffff ffff8802523b25a0
Sep 01 17:10:08 salma.okay.com.mx kernel: ffff88009677fa20 ffffffff8143a426 00000001ffffffe4 ffff880254cdc298
Sep 01 17:10:08 salma.okay.com.mx kernel: ffff880254cdc098 0080000000000001 0000000000001002 ffff88009677fa90
Sep 01 17:10:08 salma.okay.com.mx kernel: Call Trace:
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff8143a426>] pci_enable_msi_range+0x2d6/0x3a0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05e3588>] KCL_RequestMSI+0x18/0x30 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0606c9c>] IRQMGR_initialize+0x2bc/0x410 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0606987>] ? IRQMGR_alloc_context+0xb7/0x110 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc06051c7>] ? irqmgr_wrap_initialize+0x27/0x140 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05e7442>] ? KCL_DEBUG_Print_Trace+0x22/0xd0 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0606785>] ? firegl_irqmgr_init+0x55/0x100 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc0617ad1>] ? hal_init_gpu+0x221/0x4e0 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05f0f3e>] ? firegl_open+0x2de/0x310 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05df1a7>] ? ip_firegl_open+0x17/0x20 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc05e0938>] ? firegl_stub_open+0x98/0x100 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d06f7>] ? chrdev_open+0xa7/0x180
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811c9e8f>] ? do_dentry_open+0x1cf/0x2f0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d0650>] ? cdev_put+0x30/0x30
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811cb137>] ? vfs_open+0x57/0x80
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d6c77>] ? may_open+0x57/0xe0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811d94b4>] ? path_openat+0x544/0x12a0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffffc061c1fa>] ? firegl_trace+0x2a/0xf0 [fglrx]
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811db9fe>] ? do_filp_open+0x7e/0xe0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811ae861>] ? kmem_cache_alloc+0x1a1/0x1f0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811dabe7>] ? getname_flags+0x37/0x1a0
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811e85ef>] ? __alloc_fd+0x3f/0x170
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811cb4cc>] ? do_sys_open+0x12c/0x210
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff811cb5ce>] ? SyS_open+0x1e/0x20
Sep 01 17:10:08 salma.okay.com.mx kernel: [<ffffffff816df4b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
Sep 01 17:10:08 salma.okay.com.mx kernel: Code: c0 74 2a 41 8b 56 14 85 d2 74 22 31 db eb 0d 83 c3 01 41 3b 5e 14 73 15 41 8b 46 10 8d 3c 18 e8 41 ca c8 ff 48 83 78 70 00 74 e4 <0f> 0b 4d 8b 36 4d 39 f4 75 c6 49 8b bd 88 02 00 00 48 85 ff 0f
Sep 01 17:10:08 salma.okay.com.mx kernel: RIP [<ffffffff81439ab6>] free_msi_irqs+0x56/0x1a0
Sep 01 17:10:08 salma.okay.com.mx kernel: RSP <ffff88009677f9a8>
Sep 01 17:10:08 salma.okay.com.mx kernel: ---[ end trace 1a745be895f43b91 ]---

In my very specific case, it was the open source Radeon module. Remember that there is a init ram disk, you need to blacklist the Radeon module and recreate the image with Dracut. After that, you just reboot and check the loaded modules, you shouldn't see listed the Radeon.

Good luck mining!

blog comments powered by Disqus