YoRyan / nuxhash

A NiceHash cryptocurrency mining client for Linux.
GNU General Public License v3.0
264 stars 164 forks source link

matching gpu names, IDs and algos #7

Closed AlexevB closed 6 years ago

AlexevB commented 6 years ago

Hi there,

First of all, stellar work.

I have a small rig with 7 cards. I added the following (draft) code to your do_mining to check the mining stats per card:

                if current_revenue != 0 and maximum_revenue/current_revenue >= min_factor:
                    logging.info('Switching %s from %s to %s (%.3f -> %.3f mBTC/day)' %
                                 (device, current.name, maximum.name,
                                  current_revenue, maximum_revenue))
                    current_algorithm[device] = maximum

            # Check per card mining stats
            if isinstance(device, devices.nvidia.NvidiaDevice):
                if current is None:
                    logging.info('CUDA device %d (%s) %s: %.3f mBTC/day (%s)' % (device.cuda_index,
                    device.uuid, device.name,
                    mbtc_per_day(maximum), maximum.name ))
                else:
                    logging.info('CUDA device %d (%s) %s: %.3f mBTC/day (%s)' % (device.cuda_index,
                    device.uuid, device.name,
                    mbtc_per_day(current), current.name ))

        # attach devices to respective algorithms atomically
        for algorithm in algorithms:
            my_devices = [d for d, a in current_algorithm.items() if a == algorithm]
            algorithm.set_devices(my_devices)

After some 15 minutes of running I get the following results

2018-05-05 20:27:18,773 INFO: CUDA device 0 (GPU-f9e91651-f73e-eab9-3f0d-1c09c76336b4) GeForce GTX 1070: 0.249 mBTC/day (excavator_equihash)
2018-05-05 20:27:18,773 INFO: CUDA device 1 (GPU-0d084c58-d6a1-f9bb-b113-edc7c7cb5638) GeForce GTX 1070: 0.170 mBTC/day (excavator_neoscrypt)
2018-05-05 20:27:18,773 INFO: CUDA device 2 (GPU-a75c541b-faa1-741a-1c4d-74ae6fd506f2) GeForce GTX 1080 Ti: 0.162 mBTC/day (excavator_neoscrypt)
2018-05-05 20:27:18,773 INFO: CUDA device 3 (GPU-d3c3ec52-8dd9-1071-7391-5bdd0e9ebcfc) GeForce GTX 1070: 0.159 mBTC/day (excavator_equihash)
2018-05-05 20:27:18,773 INFO: CUDA device 4 (GPU-7ad23033-c01a-04dd-c5b0-e47fcc2de618) GeForce GTX 1070: 0.159 mBTC/day (excavator_equihash)
2018-05-05 20:27:18,773 INFO: CUDA device 5 (GPU-e21736e6-0db6-22e7-4b7d-499510eb128f) GeForce GTX 1070: 0.156 mBTC/day (excavator_equihash)
2018-05-05 20:27:18,774 INFO: CUDA device 6 (GPU-af3d4145-1d62-91fb-4f69-10d0d6339695) GeForce GTX 1080: 0.181 mBTC/day (excavator_lyra2rev2)

I am suspecting that at some place there is a mismatch between card id and mining results. It looks like the numbers do not add up. I checked that IDs do match with the names.

Any idea what could be happening?

AlexevB commented 6 years ago

I am checking the benchmark files.

It looks the mismatch is already there. "nvidia_GPU-f9e91651-f73e-eab9-3f0d-1c09c76336b4": (1070) "excavator_equihash": 683.7261216917163, "nvidia_GPU-af3d4145-1d62-91fb-4f69-10d0d6339695": (1080) "excavator_equihash": 508.4280246275978, "nvidia_GPU-a75c541b-faa1-741a-1c4d-74ae6fd506f2": (1080 ti) "excavator_equihash": 432.4455889662205,

YoRyan commented 6 years ago

Hi, thanks so much for investigating this! My multi-device code is a bit of a shot in the dark because I only have a single 1060 to work with, so I really appreciate the testing.

I think the problem is the program is not translating CUDA indices to excavator device id's correctly; they might not be 1:1 as I assumed. It would be super helpful if you could run the device.list excavator API call and post the results, so we can see the mapping on your system.

Please let me know if you need assistance with this.

AlexevB commented 6 years ago

With pleasure. The output gives this (the ids are different of those in nvidia-smi ) :

{
   "devices":[
      {
         "device_id":0,
         "name":"GeForce GTX 1080 Ti",
         "gpgpu_type":1,
         "subvendor":"3842",
         "details":{
            "cuda_id":0,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":3
         }
      },
      {
         "device_id":1,
         "name":"GeForce GTX 1080 Ti",
         "gpgpu_type":1,
         "subvendor":"1043",
         "details":{
            "cuda_id":1,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":4
         }
      },
      {
         "device_id":2,
         "name":"GeForce GTX 1080",
         "gpgpu_type":1,
         "subvendor":"1458",
         "details":{
            "cuda_id":2,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":13
         }
      },
      {
         "device_id":3,
         "name":"GeForce GTX 1070",
         "gpgpu_type":1,
         "subvendor":"1458",
         "details":{
            "cuda_id":3,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":1
         }
      },
      {
         "device_id":4,
         "name":"GeForce GTX 1070",
         "gpgpu_type":1,
         "subvendor":"3842",
         "details":{
            "cuda_id":4,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":2
         }
      },
      {
         "device_id":5,
         "name":"GeForce GTX 1070",
         "gpgpu_type":1,
         "subvendor":"3842",
         "details":{
            "cuda_id":5,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":8
         }
      },
      {
         "device_id":6,
         "name":"GeForce GTX 1070",
         "gpgpu_type":1,
         "subvendor":"3842",
         "details":{
            "cuda_id":6,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":11
         }
      },
      {
         "device_id":7,
         "name":"GeForce GTX 1070",
         "gpgpu_type":1,
         "subvendor":"3842",
         "details":{
            "cuda_id":7,
            "sm_major":6,
            "sm_minor":1,
            "bus_id":12
         }
      }
   ],
   "id":1,
   "error":null
}
[out.zip](https://github.com/YoRyan/nuxhash/files/1997718/out.zip)

Let me also attach the output of: nvidia-smi --query --xml-format > ~/out.xml

AlexevB commented 6 years ago

out.zip

YoRyan commented 6 years ago

Hi,

I took several weeks off but I'm back to work on this. Looks like excavator's device order is indeed not the same as the CUDA device order, so we have to use PCI bus ID's to translate. Try out master now and see if the identification is working properly. You may have to remove your benchmarks (~/.config/nuxhash/benchmarks.json).