ethereum-mining / ethminer

Ethereum miner with OpenCL, CUDA and stratum support
GNU General Public License v3.0
5.96k stars 2.28k forks source link

Specify OpenCL dir/lib when compiling from source #1324

Closed Bliss3d closed 6 years ago

Bliss3d commented 6 years ago

So I really would like to specify my OpenCL dir/lib when compiling from source. so I used:

cmake .. -DCUDA_ENABLE=OFF -DOpenCL_INCLUDE_DIR=/opt/rocm/opencl/include/ -DOpenCL_LIBRARY=/opt/rocm/opencl/lib/x86_64/libOpenCL.so

However I get this warning:

CMake Warning: Manually-specified variables were not used by the project:

CUDA_ENABLE
OpenCL_INCLUDE_DIR
OpenCL_LIBRARY

So, the opencl dir/lib I specified were not used to compile - and as a result the miner does not work.

StefanOberhumer commented 6 years ago

Not sure if this fits your requirements but try https://github.com/StefanOberhumer/ethminer/tree/CL-Own-CL-Library.

To disable CUDA use -DETHASHCUDA=OFF instead -DCUDA_ENABLE=OFF

saleelk commented 6 years ago

I had a question about how ethminer loads the OpenCL apis, without the ICD being explicitly present on the system.

saleelk commented 6 years ago

Nevermind, found it. I guess it links the ICD statically https://docs.hunter.sh/en/latest/packages/pkg/OpenCL.html?highlight=OpenCL

And that picks old ICD, since my pull request isnt merged with master yet

StefanOberhumer commented 6 years ago

If you're playing around with OpenCL-FPGA or OpenCL(explicit for your card) I think the best and easiest way is to adapt CMakeLists.txt in libethash-cl directory. Current ethminer "just" supports default hunter OpenCL implementation.

mrheat commented 6 years ago

Dont know if this belongs here, but it seems thats part of our problem with nallatech BSP, the manual says:

6.5.2.2 Switching to the Client Driver (FCD/ICD) Nallatech have supplied the 17.x version of this BSP package installer to not setup the FCD as part of the installation. If you need to use the client driver approach (FCD/ICD):

  1. Copy the FCD file (board/nalla_pcie/nalla_pcie.fcd) to /opt/Intel/OpenCL/Boards/nalla_pcie.fcd. This file is required for the new OpenCL client driver approach.
  2. Copy the Altera ICD file from ${INTELFPGAOCLSDKROOT}/Altera.icd to /etc/OpenCL/vendors/Altera.icd. This file is also required for the new OpenCL client driver approach.
  3. The installer has also included alternative board_env xml files for the ICD/FCD and non ICD/FCD use cases. There are two files installed into the board package root (nalla_pcie): board_env.icd (xml using the ICD/FCD approach) and board_env.old (xml using the non ICD/FCD approach)
  4. Copy the board_env.icd over the board_env.xml to use the required ICD/FCD library approach.

Guess i ask nallatech first about some clarification what is what and needed when and so on.

jean-m-cyr commented 6 years ago

Closing... not ethminer issue.

akostadinov commented 5 years ago

FYI, for anybody trying to build ethminer for ROCm, you can do the following (thanks to @StefanOberhumer's suggestion):

Then things should compile properly. But honestly I didn't see any positive difference compared to whatever hunter did. On the other hand will be very useful if ethminer provided an easy way to select some particular OpenCL library instead of heavily modifying CMakeLists.txt.

$ sudo lsof /opt/rocm/opencl/lib/x86_64/libOpenCL.so
COMMAND    PID   USER  FD   TYPE DEVICE SIZE/OFF     NODE NAME
ethminer 12408 user mem    REG  253,0    27728 35248619 /opt/rocm/opencl/lib/x86_64/libOpenCL.so.1

P.S. I don't think this nallatech BSP whatever it means has anything to do with selecting an OpenCL driver except maybe for that particular board.