Cgminer Source

Discussion in 'cgminer' started by SG-O, Jan 26, 2016.

  1. 2017/12/15 - Decred v1.1.2 released! → Release Notes  → Downloads
  1. Skralg

    Skralg New Member

    Dec 30, 2015
    3
    3
    Male
    Software Developer
    Las Vegas
    AMD Radeon HD 6470M, Cygwin Build, Intensity 10: 138.2Mh/s (1 min, 9 sec benchmark run)
     
  2. qwep

    qwep New Member

    Jan 17, 2016
    8
    0
    Male
    where I can find for Windows
     
  3. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    I expected this kind of comment...

    I have compiled the stock Decred CGMiner for Win64 (okay, not stock, I patched it otherwise it wouldn't have cross-built at all) and zipped it up for Windows users.

    The package contains the cgminer.exe binary (stripped), blake256.cl, a readme from yours truly, the official README file, and the patch containing every modification I did that allowed it to build.

    The patch is against https://github.com/decred/cgminer - of the branch 3.7 (which is currently the default) - commit d7751bbc31f68edfc1af61a9b36fd879f440a277.

    This package is also signed by me, and inside you can find a list of many places that have my GPG key ID and fingerprint for cross-checking, as well as places you can get the public key itself for verification. Plus it comes from my official site, but still, were it ever compromised, you would be protected against someone planting a malicious binary in its place by verifying that I signed the package you download from there.

    Anyways, I didn't actually test this binary - I cross built it - so do please report back on how it works. Without further ado:

    https://ottrbutt.com/miner/downloads/decred-cgminer/wolf-decred-cgminer-01272016-win64.zip
    https://ottrbutt.com/miner/downloads/decred-cgminer/wolf-decred-cgminer-01272016-win64.zip.sig

    EDIT:

    P.S. It doesn't rely on ANY DLLs except those that come with Windows, including the Cygwin bullshit. If it does, please report this to me, as it is a bug, IMO.
     
    kaida and LDWCom like this.
  4. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    Way ahead of you. Thought I'd do some Win64 binaries first, though.

    The only reason compilers are usually smarter than coders is because the majority of coders (IMHO) have no idea how their target platform works. For example, if you include the Blake constants inside a global constant array, most versions of the AMD OpenCL compiler (while often dumber than a box of broken rocks) will even realize that it should inline them - as long as it has the round loop unrolled. This may not always be done by it, because again, it's pretty damned stupid, but "#pragma unroll" before the loop will tell it to unroll it - at which point it will inline the constants during some optimization pass after code generation.
     
    anondran likes this.
  5. jcv

    jcv Full Member
    Developer

    I would actually say that optimizing is a combination of knowing the target platform very well (something that compiler writers should know) AND knowing the overall structure of the program well (something that a compiler at least has a chance at but is hard for a human). It isn't even saying anything bad about a coder not knowing those things, for most problems, they do not matter. As for #pragma unroll, that is giving the compiler a pretty good hint. Not much different than hand unrolling the loops.
     
    anondran likes this.
  6. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    You are quite correct - but I believe in general most coders have at least an okay grip on what they're writing. Most with talent, at least. This doesn't mean they'll always find brilliant ways to make the compiler see optimizations, but it does mean they should not butcher their implementation too badly such that the compiler is unduly crippled.

    My comment at the code was MAINLY directed at its readability - there's few real optimization opportunities (but they are there, I think; I have a couple of ideas, anyhow) - my point is mainly knowing the platform, language, and problem that you are solving well enough to not only optimize it, but to make it understandable, as well. Even if the code absolutely HAD to be unrolled when fed to the compiler in order for it to optimize well, you could still use macros.
     
    anondran likes this.
  7. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    anondran likes this.
  8. CommanderVenus

    CommanderVenus New Member

    Jan 11, 2016
    27
    4
    Linux 64 bit.
    #28 CommanderVenus, Feb 1, 2016
    Last edited: Feb 1, 2016
    Thank you for the ADL files. Why do these work but the ones from ADL_SDK9 dont?

    EDIT:
    The output after ./configure shows "ADL..................: SDK found, GPU monitoring support enabled" but when i go to make i get errors and it wont make.

    cgminer.c: At top level:
    cgminer.c:1974:13: warning: ‘gbt_decode’ defined but not used [-Wunused-function]
    static bool gbt_decode(struct pool *pool, json_t *res_val)
    ^
    CC cgminer-util.o
    CC cgminer-sha2.o
    CC cgminer-api.o
    CC cgminer-logging.o
    CC cgminer-driver-opencl.o
    CC cgminer-ocl.o
    CC cgminer-findnonce.o
    CC cgminer-adl.o
    adl.c:60:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ADL_Main_Memory_Alloc’
    static void * __stdcall ADL_Main_Memory_Alloc(int iSize)
    ^
    adl.c:68:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ADL_Main_Memory_Free’
    static void __stdcall ADL_Main_Memory_Free (void **lpBuffer)
    ^
    adl.c: In function ‘prepare_adl’:
    adl.c:186:36: error: ‘ADL_Main_Memory_Alloc’ undeclared (first use in this function)
    result = ADL_Main_Control_Create (ADL_Main_Memory_Alloc, 1);
    ^
    adl.c:186:36: note: each undeclared identifier is reported only once for each function it appears in
    adl.c: In function ‘free_adl’:
    adl.c:1413:2: warning: implicit declaration of function ‘ADL_Main_Memory_Free’ [-Wimplicit-function-declaration]
    ADL_Main_Memory_Free ((void **)&lpInfo);
    ^
    make[2]: *** [cgminer-adl.o] Error 1
    make[2]: Leaving directory `/home/user/Applications/cgminer-3.7'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/user/Applications/cgminer-3.7'
    make: *** [all] Error 2
     
  9. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    You probably didn't copy the contents of the include folder from the ADL SDK 9 package, but the whole thing.
     
  10. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    As @Wolf suggests and as the readme.txt file says in the ADL_SDK directory:

    Please insert AMD ADL files adl_defines.h adl_sdk.h adl_structures.h here

    In other words, you only copy those three files.
     
  11. CommanderVenus

    CommanderVenus New Member

    Jan 11, 2016
    27
    4
    Linux 64 bit.
    #31 CommanderVenus, Feb 1, 2016
    Last edited: Feb 2, 2016
  12. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    Image looks broken to me - anyways... works for me? Dunno.
     
  13. jrick

    jrick Member
    Developer

    Jan 4, 2016
    88
    81
    Male
    On the subject of loop unrolling and optimizations, a compiler is not always able to generate the most efficient code because it doesn't know the exact platform that the executable will run on. Instead, it optimizes for what it believes to be the common case (e.g. a "typical" amd64 processor, whatever that means). In particular it doesn't know the exact sizes of the caches (L1, L2, L3, and the instruction cache) and how large the cache line is. If a compiler is too aggressive in unrolling a loop, it could cause the program to execute slower on some hardware due to excessive icache misses. The compiler may also avoid using some parts of the instruction set because it does not run on all the processors it is targeting.

    This is one case where JIT'd code can actually outperform natively AoT compiled code, since the compiler does know the exact platform it is optimizing for.
     
  14. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    True, in some cases. On AMD, while a Tahiti bin will run on, say, Hawaii (usually) - this is something I would consider "black magic" since you really should never do it. Each chip has the same properties, even if the core config differs - for example, 7950/280 and 7970/280X have differing CU (compute unit) counts; the former with 28, the latter with 32. However, the only difference when it comes to optimization for CU count is slight, and it can only be done on the host side anyways - that is, changing the number of work-items to make the scheduler not have to do stupid things that would cause under-utilization of the GPU some or all of the time.
     
  15. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    @Wolf

    FYI... Google has flagged your site for harmful software.
    DETAILS.
     
  16. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    I know - I'm a miner dev that hosts miners. Since AV software is more concerned with pretending they found more malware than the next company, they flag miners as malware even though it's only something that is USED by malware sometimes. So, Google puts me on their stupid list, and I think Firefox uses it, too.
     
  17. sambiohazard

    sambiohazard Sr. Member

    Jan 21, 2016
    844
    372
    I have flagged google & facebook as harmful sites.
     
    Akai and David like this.
  18. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    Yep... I don't doubt the validity of your website and I'm all too familiar with false positives. I just wanted to make sure you were aware so that others that may be alarmed by the warning understand it's fine to proceed.

    Hahaha, indeed!!! :D
     
  19. Wolf

    Wolf Jr. Member

    Jan 25, 2016
    107
    45
    Most everyone has told me - I even tried to get off their list, but it seems extremely hard once you're on it. I might make a website that indexes the hashrate record screenshots and other stuff on my main site, and then warn on the former about Google's abuse of influence.
     
  20. CommanderVenus

    CommanderVenus New Member

    Jan 11, 2016
    27
    4
    Linux 64 bit.

Share This Page