--opencl-device / --opencl-platform manipulations

I'm still a bit confused as to what these options do...

I understand --opencl-device allows using multiple GPUS. But I tried for instance to specify and very high number and it didn't seem to make a difference.

So my questions are:
1. Can one get a list of device number to GPU? Is it always 0-based?
2. I don't know what --opencl-platform does nor how it could be used :-/
3. Same as 1 for platforms, if relevant



  • GenoilGenoil 0xeb9310b185455f863f526dab3d245809f6854b4dMember Posts: 769 ✭✭✭
    edited May 2015
    Hi, my tiny contributions to the Ethereum source code mostly had to do with these two options, so let me explain:

    In OpenCL you have platforms and devices. Platforms are independent implementations of the spec by i.e. Apple, Intel, AMD. On most systems only one platform exists, but I happened to run into the issue where eth would always try to use the Intel platform, while I required it to use the NVidia platform. So that's when I added that flag.

    The device flag already existed back then. It is used to specify the device you want to use. Back then (we're talking weeks, tops) there was no ethminer yet, but the farm code was in progress, yet I didn't know its intentions. If I had known those, I would probably not have written the multi-GPU support, where you can use multiple GPU's with a single eth/ethminer. I wrote it in the same way as the CPU miner, as if a GPU equals a logical CPU core. The program by default tried to use as many GPU's as it could find and you could only limit it use the device flag to use only a specific one or top it off with the t flag, that I reintroduced.

    Both the flags implementations silently correct any wrong input, so that's why they don't seem to have any effect in many cases.

    Yesterday I noticed that the latest develop now sets the number of GPU's used to 1 by default. This is a good choice. But it still not possible for instance to use only device 1 and 2, and not 0. For that you need to run two ethminers with the device flag, as @StephanTual wrote yesterday in the official mining how to on this forum.

    Hope this helps.
  • Wil611Wil611 Member Posts: 77 ✭✭
    edited May 2015
    @Genoil are you saying if I have to AMD GPUs and don't specify a specific --opencl-device (0 or 1) that ethminer would use both in a single instance and designate them as gpuminer0 and gpuminer1 within the console? would I need the -t flag for that? I'm currently running two instances of ethminer and am wondering what would be more efficient.
  • GenoilGenoil 0xeb9310b185455f863f526dab3d245809f6854b4dMember Posts: 769 ✭✭✭
    edited May 2015
    @Wil611 yes that was the original behavior, but current behavior sets the numbers of GPU miners default to 1 (device 0). I don't have a system with two GPU's at the moment to test, but I think you could still force ethminer to use two GPUs like this: ethminer -G -t 2.

    As long as you have plenty of RAM , I don't expect there to be much performance difference. But when you have a rig with 5 cards and only 4GB of RAM, you will benefit from using multiple GPUs per ethminer, as each instance of ethminer takes up the curretn dag size (1GB+ at this moment) in RAM.
  • Wil611Wil611 Member Posts: 77 ✭✭
    @Genoil makes sense thanks. I may give it a try.
  • acrosacros Member Posts: 63 ✭✭
    Thanks a lot @Genoil ! Are you aware of a way to list the devices and platforms available on UNIX-like systems? I know "lspci -v | grep VGA" for the former, but I feel like there's got to be better!
  • GenoilGenoil 0xeb9310b185455f863f526dab3d245809f6854b4dMember Posts: 769 ✭✭✭
  • acrosacros Member Posts: 63 ✭✭
    I confirm that it works well for listing platforms/devices:

    $ curl https://codeload.github.com/hpc12/tools/tar.gz/master | tar xvfz -
    $ cd tools-master
    $ make # if error: ... /usr/bin/ld: cannot find -lOpenCL .., then issue a: sudo ln -s /usr/lib/libOpenCL.so.1 /usr/lib/libOpenCL.so (see http://stackoverflow.com/questions/335928/ld-cannot-find-an-existing-library)
    $ ./print-devices
    platform 0: vendor 'Advanced Micro Devices, Inc.'
    device 0: 'Bonaire'
    device 1: 'AMD A6-7400K Radeon R5, 6 Compute Cores 2C+4G'
  • keokeo Member Posts: 21
    thanks for print-devices.

    Here's what I get:
    $ ./print-devices
    platform 0: vendor 'Apple'
      device 0: 'Intel(R) Core(TM)2 Duo CPU     P8800  @ 2.66GHz'
      device 1: 'GeForce 9400M'
      device 2: 'GeForce 9600M GT'
    Based on this I run a benchmark on ethminer:
    $  ethminer -G -M --opencl-device 2 --opencl-platform 0
    Benchmarking on platform: 2-thread CPU
    Preparing DAG...
    Warming up...
    Trial 1... 66
    Trial 2... 33
    Trial 3... 66
    Trial 4... 66
    Trial 5... 100
    min/mean/max: 33/66/100 H/s
    inner mean: 55 H/s
    This is definitely NOT a GPU, even if a very old one :)

    The weird thing is that yesterday, I teseted with --opencl-device from 0 to 12. I got these very low results for most of the time, but for id 5, 7 and 10 I got 50KH/s. They were all named "2-thread CPU" btw.

    Then, the even weirder things is that today I get these super low figures for all ids. I haven't updated the code, no new compile, nothing, just 24 hrs later.

    Any ideas?
  • acrosacros Member Posts: 63 ✭✭
    @keo my guess would be that your drivers are not installed correctly...
  • acrosacros Member Posts: 63 ✭✭
    out of curiosity, have you tried without specifying the platform (since you only have 1 anyway)? i never specify it myself, maybe it's something dumb like that :)
  • CryptoFutureCryptoFuture Member Posts: 44
    I'm getting the same problem with it not wanting to use my GPU. I never had the problem until I updated cpp-ethereum recently due to the fork
  • keokeo Member Posts: 21
    @acros this is on OSX, there's no such thing as 'driver installation' as it is part of the OS. All other OpenCL apps work, except for this one :(

    Doesn't matter if I use --opencl-platform or not, the effect is the same.
  • jzenjzen Member Posts: 49
    @keo Was your version of ethminer built from source using the -DETHASHCL=1 parameter on the cmake command line? Or, if you used brew to pour a bottled version, did yo brew install cpp-ethereum --with-gpu-mining?
  • keokeo Member Posts: 21
    @jzen no, simply installed it with brew install cpp-ethereum. Reinstalling now. Thanks for the tip.
  • acrosacros Member Posts: 63 ✭✭
    @keo , yes I suspect @jzen is right then, that might be your problem
  • keokeo Member Posts: 21
    @acros @jzen did it, and it's still the same :(
  • acrosacros Member Posts: 63 ✭✭
    @keo I would submit an issue on github's cpp-ethereum as the result you get from print-devices makes me feel like it may just be a problem with the application in the end
  • gcolbourngcolbourn Member Posts: 48
    Still not managed to get more than 1 GPU working. aticonfig recognises both GPUs, but ./print-devices doesn't. Nether does ethminer.:

    [email protected]:~/tools-master$ ./print-devices
    platform 0: vendor 'Advanced Micro Devices, Inc.'
    device 0: 'Tahiti'
    device 1: 'AMD Sempron(tm) 145 Processor'

    [email protected]:~/tools-master$ fglrxinfo
    display: :0 screen: 0
    OpenGL vendor string: Advanced Micro Devices, Inc.
    OpenGL renderer string: AMD Radeon HD 7900 Series
    OpenGL version string: 4.4.12968 Compatibility Profile Context 14.201.1006.1002

    [email protected]:~/tools-master$ aticonfig --list-adapters
    * 0. 01:00.0 AMD Radeon HD 7900 Series
    1. 06:00.0 AMD Radeon HD 7900 Series

    * - Default adapter

    [email protected]:~/tools-master$ ethminer --list-devices
    Listing OpenCL devices.
    FORMAT: [deviceID] deviceName
    [0] Tahiti

    [email protected]:~/tools-master$

    Can anyone help? Time's running out!
  • gcolbourngcolbourn Member Posts: 48
    Ok, so started again with a fresh install of Ubuntu (this time 15.04) and I get:

    [email protected]:~$ ethminer -M -G --benchmark-warmup 30
    Trial 1... 41768277
    Trial 2... 41331370
    Trial 3... 41680896
    Trial 4... 41680896
    Trial 5... 41593514
    min/mean/max: 41331370/41610990/41768277 H/s
    inner mean: 41680895 H/s

    Woohoo! That has to be both R9 280X's. Now I just have to decide whether to risk adding the 3rd one I've got.. (I had a 4th, but that blew up in mining on the testnet, probably from overheating, so I'm wary.)
Sign In or Register to comment.