Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Try to upstream the Genoil CUDA ethminer changes #315

Closed
bobsummerwill opened this issue Mar 5, 2016 · 22 comments
Closed

Try to upstream the Genoil CUDA ethminer changes #315

bobsummerwill opened this issue Mar 5, 2016 · 22 comments
Milestone

Comments

@bobsummerwill
Copy link
Contributor

From https://github.com/Genoil/cpp-ethereum/, which appears to be a fork from 0.9.41, and to be what many of the miners use.

If our version of the code has essentially stood still since 0.9.41 then this might be as simple as "accept theirs" conceptually. Slightly messier details perhaps, but maybe not a horror to merge.

We should be collaborating with miners, not ignoring them. Even with Proof of Stake upcoming, no doubt many of the same individuals will want to be engaged for years to come. We'll have to transition people from PoW to PoS, so having them in the "big tent" rather than outside would be beneficial.

@bobsummerwill bobsummerwill changed the title Try to upstream the Genoil CUDA miner changes Try to upstream the Genoil CUDA ethminer changes Mar 5, 2016
@bobsummerwill
Copy link
Contributor Author

Hey @Genoil - see above!

Not sure if any of the C++ development team has ever been in contact with you before? They should have been.

Anyway - I've added this to the backlog.

As you may have already seen, I've been focusing on architecture for a while, first at http://doublethink.co and now at the Foundation, so we're looking like this for Homestead:

http://doublethinkco.github.io/webthree-umbrella-cross/images/dependency_graph.svg

Aiming for something like this in the near future as we re-consolidate the repos:

http://doublethinkco.github.io/webthree-umbrella-cross/images/target_dependency_graph.svg

See #251). I am already working to rationalize the names for Homestead (#250).

I think the re-org might be a good time to look at ethminer, and getting that decoupled from the rest of the code, so that forked code isn't required. So maybe we pull ethminer out into its own http://github.com/ethereum/ethminer repo, and then look at upstreaming all of your changes into that version, if that is easy enough? If you aware of other forks which have "good stuff" in them, and which we should look at, please let me know.

It looks as though nothing of any real note has happened in the "official ethminer" since last Sep/Oct:

https://github.com/ethereum/libethereum/commits/6b6525907453adfdee1fd42557072e545b215d16/ethminer

Good stuff on your CUDA miner!

@Genoil
Copy link
Contributor

Genoil commented Mar 8, 2016

Yes I was in touch with @gavofyork and @LefterisJP during the last year. I did try to get CUDA support merged into the official miner, but it was pushed back to Homestead. At that point, which was just before the change to webthree-umbrella I decided to stop spending time trying to keep up with the many drastic changes the codebase underwent at the time.

The reason most miners use some build or fork of 0.9.41 is because that's still on the cpp-ethereum repo (the last version, maybe?) and people who knew how to build binaries just didn't bother moving over to the umbrella structure. And you're right, sine there are no performance improvements, miners don't care :)

Personally I'm not interested in merging the CUDA miner into webthree-umbrella. Professionally, perhaps. But of course you are welcome to pick anything you need from it.

@LefterisJP
Copy link
Collaborator

yeah we wanted to do that back then ... no time from our side either.

If you have any time to work on it @bobsummerwill feel free :)

@bobsummerwill
Copy link
Contributor Author

Thanks for the info, Genoil.

Well, the plan is to re-merge the repos, so it might "fit" again after that :-)

I will look at this again after the re-org. If nothing else, I think we should be able get you a nicer cpp-ethereum to build on top of. Then you could have a separate repo for your ethminer, and not have to carry all the other forked junk around with you, @Genoil :-)

@smartbitcoin
Copy link

Miner suppose to be a standalone project. I even suggest move the opencl miner our of the kernel. Integrate the miner into web-three umbrella just make these repo too heavy and make the miner have too many dependencies which is unnecessary.

@bobsummerwill
Copy link
Contributor Author

Hey, @smartbitcoin!

We would end up with:
ethminer -> cpp-ethereum

So the ethminer could be developed/released independently of cpp-ethereum. Right now the CUDA miner is dragging around a corpse with it :-) That hasn't been a practical issue because there hasn't been any relevant movement in the "official" ethminer, or in the parts of cpp-ethereum which it depends on in the last few months.

But it's a bit silly.

@bobsummerwill
Copy link
Contributor Author

Hey, @Genoil!

So I just looked at the diffs between your fork point and your HEAD, and they really aren't so scary, so I think that I am very likely to attempt to upstream them :-)

@Genoil
Copy link
Contributor

Genoil commented Apr 6, 2016

You're welcome! Can you also improve stability of the stratum client while you're at it? ;)

@bobsummerwill
Copy link
Contributor Author

Sure, here you go!

magic wand

@int03h
Copy link

int03h commented Jun 3, 2016

Hmmm ... seems your magic wand is defective. Nothing happened. ;) .. anyway.. just wondering if the CUDA support is going to be undertaken or not at all . I am trying to decide if I need to wait .. or take the machine to Windows so I can run Genoil's miner - would give me an excellent excuse to by some Oculusesses .. ;) (and get them sometime before the Sun goes SuperNova ;) ) ..

Thanks all for all the great work on this project.

EDIT: undertaken = upstreamed

@bobsummerwill
Copy link
Contributor Author

Hey @int03h,

So I am still planning to attempt the @Genoil upstreaming, after the repository reorg (#250), which I know has been a long time coming, but is getting very close now.

@int03h
Copy link

int03h commented Jun 3, 2016

Either as a sidenote .. or a diversion of efforts .. or whatever you want to call it .. I have been fiddling with hashcat too .. ( the primary stated purpose of my gear ) .. in case you have not been following along, v3.0 is now being actively developed and he is dropping CUDA in favor of going with Kronos ..

Here is an extract of his build process :

git clone https://github.com/hashcat/oclHashcat
cd /src/hashcat/oclHashcat
mkdir -p /src/hashcat/oclHashcat/deps/OpenCL-Headers
git clone https://github.com/KhronosGroup/OpenCL-Headers deps/OpenCL-Headers/CL

From the discussions I have seen, the performance without CUDA is not as good, but the belief is that it can be done thus making the need for CUDA defunct. I also gathered that the intent was to support a wider variety of HW while simplifying the code requirements. ( I am not pitching .. just digesting what I understood from the threads I read ).

@Genoil
Copy link
Contributor

Genoil commented Jun 4, 2016

@int03h you can run my fork on Linux too. Runs even better on many cards

@int03h
Copy link

int03h commented Jun 4, 2016

@Genoil @bobsummerwill Yessir ! I do and i am a fan !

A few things to note though - in no particular order and not assigning blame or trying to be a dick, I want to keep this constructive, please take my comments as positive encouragement rather than criticisms:

  1. Love the Stratum support - this should be upstreamed ! Magic WAND ENGAGE !! :) The eth-proxy is terribad and painful.
  2. It's not good when a fork of something is better than the reference version, sorry Bob. I know you have other priorities and are getting there, when you get to it,you will get to it, that's cool!
  3. The Genoil miner does not compile CUDA on Linux, I say this with a great deal of confidence since I have tried it, lots of different ways with lots of different distros and it WILL NOT complile with CUDA (cmake -DBUNDLE=cudaminer .. see my issue on your https://github.com/Genoil/cpp-ethereum/issues/00049 ) Cuda Hashcat works and your cmake finds it - so I know that I am doing it right.
  4. Solo mining on CUDA is not possible as it stands.
  5. Pulling the C++ miner into the larger project (in my view) was a mistake .. long term it might make things better - but right now - its horribly confusing. To me it's not clear why it had to be done - maybe I didn't read all the right "marketing" material to be convinced. I just feel the pain ;) and it hurts.
  6. I am also not clear why the relevant changes from webthree couldn't be pushed down to genoils miner and that be made the reference miner ? I am a little new to all of this - so I don't want to dive head first into the politics of what is going on with the re-organisation and what is happening and why, and when etc etc . Either way .. building/compiling the(any) GPU miner is NOT a trivial task.
  7. Dynamic DAG Generation - Winning!

@Genoil
Copy link
Contributor

Genoil commented Jun 5, 2016

Re 3/4). I totally agree something is not right with it because I get many feedback on the exact same issue. But it does compile fine on Ubuntu 14.04 (AWS GPU instance with CUDA 6.5), which I use as my reference platform for checking Linux builds. There are plenty of miners using my fork with CUDA on Linux.

Check this guy 6 * GTX1080, 135MH @ 540W https://ip.bitcointalk.org/?u=http%3A%2F%2Fi.imgur.com%2FvR4DuPO.jpg&t=565&c=Z_-NqGltas92pQ (he actually had to move to Linux because the Windows driver completely destroyed performance, which I have found to be a common issue with Nvidia cards)

@Genoil
Copy link
Contributor

Genoil commented Jun 5, 2016

@int03h as for making the OpenCL code as fast; it can certainly be done, but you'll have to do the warp shuffles in PTX assembly. May even be easier than merging the CUDA miner in.

@int03h
Copy link

int03h commented Jun 5, 2016

HI ..

Likewise - I moved to Linux because the performance on windows 10 was TERRIBLE with CUDA.

I did have it running on Windows 7 for a little while and it works great, but I HATE using Teamview to manage it .. I know my hardware is good and I have a baseline performance # with CUDA (on my NVIDIA Miner). Linux is losing me about 10% using open CL - but I refuse to go back to windows 7/8. ;) ( Stratum is also ANOTHER PITA I just don't want to deal with). Either way .. what I am saying is that I have decided to stick with Genminer and Linux and I want to try and get to the point where I can have CUDA+STRATUM+LINUX. ;) Sorry if that is going to make me a pain in your ass, no good deed goes unpunished.

Looking at that screenshot - I honestly don't know what vodo he used to make it work on 14.04 .. I tried compiling it a bunch of times - specifically on 14.04 !! . It throws the exact same error on 14.04 as it does on 15.10 and on Debian Jessie/Wily/Strectch/Testing and SID.

BTW from my research - I saw that NVCC can be very bitchy about how it is invoked.. Like it will break if duplicate arg's are passed it will just fail with random unexplained errors. I saw this by accident looking for the nvcc error I wanted to reference to show what a POS NVCC is .. anyway : https://github.com/kokkos/nvcc_wrapper - maybe this will help ?

Haha .. that dude with the 1080s is going to cry into his coffee when he sees this :
https://onedrive.live.com/redir?resid=89F6FA20217ACE02!54733&authkey=!ABa0-gdItdyDpVA&v=3&ithint=photo%2cpng - AMD + OpenCL FTW.

EDIT: OK his power numbers look pretty nice .. ( but he paid at least $600 a card - and I paid $300 ) - that's a lot of juice to make up in ROI.

@Genoil
Copy link
Contributor

Genoil commented Jun 5, 2016

I always test my builds on this AWS AMI: ami-86fef9ec (us east 1) with a G2.2 instance. It's based off an ami I found with nvidia drivers and cuda 6.5 pre-installed, because I generally suck at Linux system administration. You will have to cmake -DCOMPUTE=30 -DBUNDLE=cudaminer. And git pull + switch the 110 branch to make it start much faster.

No comments on that dude with the 1080's. It's not me btw ;-)

@int03h
Copy link

int03h commented Jun 5, 2016

OHOK ! Funnily enough, I tried to get AWS to give me a G2 instance and they told me to politely go “f$@#@ myself” .. ;) I have getting my limit lifted on my list ... anyway .. I hear your predicament. As a matter of interest .. is their pricing competitive/compelling? I want to actually owning the stuff at the end (since I want the GPU’s for hashcat and Oculus), but I do like the idea of warming up their datacenter instead of my house and not paying for electricity. Just interested in your experience – if you care to share.

After our last exchange you gave me an idea to manually hack the make file .. It is definitely the x11 flag that is throwing the error (where is that coming from ?? and how we suppress it by default ?? ANYWAY!!! While I was at it – I manually dropped all the other stuff on that line and kept compute_52 (since I know we need that ) ..

The line ends up looking like this :
set(CUDA_NVCC_FLAGS --disable-warnings;--ptxas-options=-v;-use_fast_math;-lineinfo;-gencode;arch=compute_52,code=sm_52;;; ) # list

IT WORKS!  yay yay yay!!!

For reference

eth@eth:~$ uname -r
4.5.0-2-amd64

eth@eth:~$ dpkg -l | grep cuda
rc cuda-repo-ubuntu1404 7.5-18 amd64 CUDA repo configuration files.
ii libcuda1:amd64 352.79-7 amd64 NVIDIA CUDA Driver Library
ii libcudart7.5:amd64 7.5.18-2 amd64 NVIDIA CUDA Runtime Library
ii nvidia-cuda-dev 7.5.18-2 amd64 NVIDIA CUDA development files
ii nvidia-cuda-doc 7.5.18-2 all NVIDIA CUDA and OpenCL documentation
ii nvidia-cuda-gdb 7.5.18-2 amd64 NVIDIA CUDA Debugger (GDB)
ii nvidia-cuda-toolkit 7.5.18-2 amd64 NVIDIA CUDA development toolkit

eth@eth:~$ dpkg -l | grep nvidia
ii glx-alternative-nvidia 0.7.2 amd64 allows the selection of NVIDIA as GLX provider
ii libegl1-nvidia:amd64 352.79-7 amd64 NVIDIA binary EGL libraries
ii libgl1-nvidia-glx:amd64 352.79-7 amd64 NVIDIA binary OpenGL libraries
ii libgles1-nvidia:amd64 352.79-7 amd64 NVIDIA binary OpenGL|ES 1.x libraries
ii libgles2-nvidia:amd64 352.79-7 amd64 NVIDIA binary OpenGL|ES 2.x libraries
ii libnvidia-compiler:amd64 352.79-7 amd64 NVIDIA runtime compiler library
ii libnvidia-eglcore:amd64 352.79-7 amd64 NVIDIA binary EGL core libraries
ii libnvidia-ml1:amd64 352.79-7 amd64 NVIDIA Management Library (NVML) runtime library
ii nvidia-alternative 352.79-7 amd64 allows the selection of NVIDIA as GLX provider
ii nvidia-cuda-dev 7.5.18-2 amd64 NVIDIA CUDA development files
ii nvidia-cuda-doc 7.5.18-2 all NVIDIA CUDA and OpenCL documentation
ii nvidia-cuda-gdb 7.5.18-2 amd64 NVIDIA CUDA Debugger (GDB)
ii nvidia-cuda-toolkit 7.5.18-2 amd64 NVIDIA CUDA development toolkit
ii nvidia-detect 352.79-7 amd64 NVIDIA GPU detection utility
ii nvidia-driver 352.79-7 amd64 NVIDIA metapackage
ii nvidia-driver-bin 352.79-7 amd64 NVIDIA driver support binaries
ii nvidia-installer-cleanup 20151021+4 amd64 cleanup after driver installation with the nvidia-installer
ii nvidia-kernel-common 20151021+4 amd64 NVIDIA binary kernel module support files
ii nvidia-kernel-dkms 352.79-7 amd64 NVIDIA binary kernel module DKMS source
ii nvidia-kernel-support 352.79-7 amd64 NVIDIA binary kernel module support files
ii nvidia-legacy-check 352.79-7 amd64 check for NVIDIA GPUs requiring a legacy driver
ii nvidia-modprobe 367.18-1 amd64 utility to load NVIDIA kernel modules and create device nodes
ii nvidia-opencl-common 352.79-7 amd64 NVIDIA OpenCL driver
ii nvidia-opencl-icd:amd64 352.79-7 amd64 NVIDIA OpenCL installable client driver (ICD)
ii nvidia-persistenced 367.18-1 amd64 daemon to maintain persistent software state in the NVIDIA driver
ii nvidia-profiler 7.5.18-2 amd64 NVIDIA Profiler for CUDA and OpenCL
ii nvidia-settings 340.93-1 amd64 tool for configuring the NVIDIA graphics driver
ii nvidia-smi 352.79-7 amd64 NVIDIA System Management Interface
ii nvidia-support 20151021+4 amd64 NVIDIA binary graphics driver support files
ii nvidia-vdpau-driver:amd64 352.79-7 amd64 Video Decode and Presentation API for Unix - NVIDIA driver
ii nvidia-visual-profiler 7.5.18-2 amd64 NVIDIA Visual Profiler for CUDA and OpenCL
ii xserver-xorg-video-nvidia 352.79-7 amd64 NVIDIA binary Xorg driver

eth@eth:~/bin$ ./genminer --list-devices -U

Genoil's ethminer 0.9.41-genoil-1.1.3

Forked from github.com/ethereum/cpp-ethereum
CUDA kernel ported from Tim Hughes' OpenCL kernel
With contributions from nerdralph, RoBiK, tpruvot and sp_

Please consider a donation to:
ETH: 0xeb9310b185455f863f526dab3d245809f6854b4d

[CUDA]:
Listing CUDA devices.
FORMAT: [deviceID] deviceName
[0] GeForce GTX 970
Compute version: 5.2
cudaDeviceProp::totalGlobalMem: 4294246400
[1] GeForce GTX 970
Compute version: 5.2
cudaDeviceProp::totalGlobalMem: 4294770688

@eth100tx
Copy link

Concerning "The Genoil miner does not compile CUDA on Linux"

Looks like you have it working, but here are some my notes. I last compiled about a week or so ago.
+ Cuda 7.5
+ branch 110

changes
sed -i 's/--std=c++11;//' libethash-cuda/CMakeLists.txt
add to cmake: -DCUDA_NVCC_FLAGS='-std=c++11'
re-add cl.hpp which is on the master branch.

Note, I'm sure if both were needed on the last round as I've build multiple versions over the last few months.. That computer is in pieces as I'm playing with windows at the moment, but I can write up from a clean state if helps.

branch 110 builds supports Compute 2.0 which I can confirm works on Linux and enables M2090s in CUDA mode. (hash rates improve to around 10MHs verse 6-7MHs on OpenCL).

@int03h
Copy link

int03h commented Jun 11, 2016

The last few days, I was actually trying to upstream the stratum support into the webthree repo .. ( well a version that Bob is workon at the moment ... see: https://github.com/int03h/cpp-ethereum/tree/merge_repos .. ) I am super stuck and WAAAYY out of my depth. .. instead .. I was thinking of doing what Genoil did by cloning the current webthree, and then running the "recreate-c++" script. Hopefully that will be easier to work with so I can then put back the stratum, realtime dag creation and CUDA support.

bobsummerwill referenced this issue in ethereum/libethereum Jul 19, 2016
This fix doesn't just revert to the previous code, which was causing warnings on FreeBSD.    Instead, it removes the unused 'i' variable, as Enrique's changes did, and also clarifies the semantics for 'completed'.
@bobsummerwill bobsummerwill removed the eth label Aug 16, 2016
@bobsummerwill
Copy link
Contributor Author

This issue was moved to ethereum/aleth#3125

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants
@LefterisJP @bobsummerwill @eth100tx @int03h @smartbitcoin @Genoil @chriseth and others