ifdefelse / ProgPOW

A Programmatic Proof-of-Work for Ethash. Forked from https://github.com/ethereum-mining/ethminer
GNU General Public License v3.0
257 stars 84 forks source link

Win64 CUDA 9.0 build does not work correctly #18

Closed hackmod closed 5 years ago

hackmod commented 5 years ago

I'm not sure why this happens.

linux binary works nicely, but Win x86_64 (Windows 10) + CUDA 9.0 + Visual Studio 2017 build (with -Tv140 tool set) does not work correctly, (GTX1080-8GB)

so I've dig into the source code and found that the c_dag generation part at progpow_search() seems odd.

diff --git a/libethash-cuda/CUDAMiner_kernel.cu b/libethash-cuda/CUDAMiner_kernel.cu
index e64e7ff..d13bf49 100644
--- a/libethash-cuda/CUDAMiner_kernel.cu
+++ b/libethash-cuda/CUDAMiner_kernel.cu
@@ -163,6 +163,10 @@ progpow_search(
             c_dag[word + i] =  load.s[i];
     }

+    __syncthreads();
+    if (lane_id == 0)
+        printf("c_dag[0] = %08x%08x%08x%08x%08x%08x%08x%08x\n", c_dag[0], c_dag[1], c_dag[2], c_dag[3], c_dag[4], c_dag[5], c_dag[6], c_dag[7]);
+
     hash32_t digest;
     for (int i = 0; i < 8; i++)
         digest.uint32s[i] = 0;

for normal case under linux, it print out c_dag[0] = 2922db22466c51cc860021d27e41abf182c3d10b6acc5e7c3fa3d3f72b33ae8d - epoch 0

but Win x86_64 build case, it print some random output like as c_dag[0] = 277c371ef7acd87123f6476e5d3b88f9be8e87ce7e544ebd5479c6a1b9db7b5c - epoch 0

and it results GPU mix != CPU mix image

any suggestion?

ifdefelse commented 5 years ago

My dev system is Win 10 + x86_64 build + CUDA 10.0 + VS 2017 (no -Tv140).

This is what was used to generate the test vector, which passes against geth (with the required patches): https://github.com/ifdefelse/ProgPOW/blob/master/test/result.log

Can you try CUDA 10.0 instead of 9.0?

hackmod commented 5 years ago

for linux, CUDA 9.0 works nicely (ubuntu 16.04 + CUDA 9.0) and the compiled kernel.ptx almost the same. (few register numbering changed) personally, I will try to test CUDA 9.1, 9.2, and 10.0 in next week

hackmod commented 5 years ago

CUDA 10.0 (with -Tv140 toolset) works nicely~ image

hackmod commented 5 years ago

I guess, I have some installation problem with the CUDA-9.0. (maybe some outdated preview release?) After forcing update my old CUDA-9.0, it works nicely with no problem.

I can confirm that CUDA-9.0, CUDA-9.2 and CUDA-10.0 works! (CUDA-9.1 simply not tried)

so I can say that the minimal required CUDA version is 9.0 (Win 10 + Visual Studio 2017 (with v104 toolset)) 👍👍