diff options
author | fireice-uk <fireice-uk@users.noreply.github.com> | 2017-11-18 21:34:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-18 21:34:44 +0000 |
commit | 2cb7686ceeb32d46a40361b19e5e9116a8315fa6 (patch) | |
tree | d06f9fcabadf5966b0f458f6ff83252e8f124946 | |
parent | f50fa7d84d6cca05d0684c6f018ad5928301eafe (diff) | |
parent | 7e8475ab306ce865fd0c24fcf972db098298a534 (diff) | |
download | xmr-stak-2cb7686ceeb32d46a40361b19e5e9116a8315fa6.zip xmr-stak-2cb7686ceeb32d46a40361b19e5e9116a8315fa6.tar.gz |
Merge pull request #136 from psychocrypt/fix-openCLCompatibility
fix OpenCL compatibility
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | doc/compile.md | 4 | ||||
-rw-r--r-- | xmrstak/backend/amd/amd_gpu/gpu.cpp | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 09c7cec..33e97ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,15 +39,18 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${BUILD_TYPE}") set(XMR-STAK_CURRENCY "all" CACHE STRING "select miner currency") set_property(CACHE XMR-STAK_CURRENCY PROPERTY STRINGS "all;monero;aeon") -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set(XMR-STAK_COMPILE "native" CACHE STRING "select CPU compute architecture") - set_property(CACHE XMR-STAK_COMPILE PROPERTY STRINGS "native;generic") - if("${XMR-STAK_COMPILE}" STREQUAL "native") + +set(XMR-STAK_COMPILE "native" CACHE STRING "select CPU compute architecture") +set_property(CACHE XMR-STAK_COMPILE PROPERTY STRINGS "native;generic") +if("${XMR-STAK_COMPILE}" STREQUAL "native") + if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") set(CMAKE_CXX_FLAGS "-march=native -mtune=native ${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "-march=native -mtune=native ${CMAKE_C_FLAGS}") - elseif(NOT "${XMR-STAK_COMPILE}" STREQUAL "generic") - message(FATAL_ERROR "XMR-STAK_COMPILE is set to an unknown value '${XMR-STAK_COMPILE}'") endif() +elseif("${XMR-STAK_COMPILE}" STREQUAL "generic") + add_definitions("-DCONF_ENFORCE_OpenCL_1_2=1") +else() + message(FATAL_ERROR "XMR-STAK_COMPILE is set to an unknown value '${XMR-STAK_COMPILE}'") endif() if("${XMR-STAK_CURRENCY}" STREQUAL "all") diff --git a/doc/compile.md b/doc/compile.md index 30cf58c..cf25135 100644 --- a/doc/compile.md +++ b/doc/compile.md @@ -37,7 +37,7 @@ After the configuration you need to compile the miner, follow the guide for your - you can find the binary and the `config.txt` file after `make install` in `$HOME/xmr-stak-cpu/bin` - `CMAKE_LINK_STATIC` link libgcc and libstdc++ libraries static (default OFF) - disable with `cmake .. -DCMAKE_LINK_STATIC=ON` - - if you use static compile to run the miner on another system set `-DXMR-STAK_COMPILE=generic` (only available for LINUX, BSD and MacOSX) + - if you use static compile to run the miner on another system set `-DXMR-STAK_COMPILE=generic` - `CMAKE_BUILD_TYPE` set the build type - valid options: `Release` or `Debug` - you should always keep `Release` for your productive miners @@ -46,8 +46,6 @@ After the configuration you need to compile the miner, follow the guide for your - `OpenSSL_ENABLE` allow to disable/enable the dependency *OpenSSL* - it is not possible to connect to a *https* secured pool if option is disabled: `cmake .. -DOpenSSL_ENABLE=OFF` - `XMR-STAK_CURRENCY` - compile for Monero(XMR) or Aeon(AEON) usage only e.g. `cmake .. -DXMR-STAK_CURRENCY=monero` - -### only available for LINUX, BSD and MacOSX - `XMR-STAK_COMPILE` select the CPU compute architecture (default: native) - native means the miner binary can be used only on the system where it is compiled but will archive the highest hash rate - use `cmake .. -DXMR-STAK_COMPILE=generic` to run the miner on all CPU's with sse2 diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp index 791ceb2..b5a9d61 100644 --- a/xmrstak/backend/amd/amd_gpu/gpu.cpp +++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp @@ -172,7 +172,7 @@ const char* err_to_str(cl_int ret) return "CL_INVALID_LINKER_OPTIONS"; case CL_INVALID_DEVICE_PARTITION_COUNT: return "CL_INVALID_DEVICE_PARTITION_COUNT"; -#ifdef CL_VERSION_2_0 +#if defined(CL_VERSION_2_0) && !defined(CONF_ENFORCE_OpenCL_1_2) case CL_INVALID_PIPE_SIZE: return "CL_INVALID_PIPE_SIZE"; case CL_INVALID_DEVICE_QUEUE: @@ -227,7 +227,7 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_ } printer::inst()->print_msg(L1,"Device %lu work size %lu / %lu.", ctx->deviceIdx, ctx->workSize, MaximumWorkSize); -#ifdef CL_VERSION_2_0 +#if defined(CL_VERSION_2_0) && !defined(CONF_ENFORCE_OpenCL_1_2) const cl_queue_properties CommandQueueProperties[] = { 0, 0, 0 }; ctx->CommandQueues = clCreateCommandQueueWithProperties(opencl_ctx, ctx->DeviceID, CommandQueueProperties, &ret); #else |