Browse Source

renamed "cu" -> "cuda" globally

cl-refactor
Jan Willem Penterman 9 years ago
parent
commit
e46de57509
  1. 16
      CMakeLists.txt
  2. 2
      ethminer/CMakeLists.txt
  3. 36
      ethminer/MinerAux.h
  4. 29
      libethash-cu/CMakeLists.txt
  5. 64
      libethash-cu/rotl64.cuh
  6. 0
      libethash-cuda/cuda_helper.h
  7. 0
      libethash-cuda/dagger.cuh
  8. 4
      libethash-cuda/dagger_shared.cuh
  9. 4
      libethash-cuda/dagger_shuffled.cuh
  10. 52
      libethash-cuda/ethash_cuda_miner.cpp
  11. 6
      libethash-cuda/ethash_cuda_miner.h
  12. 4
      libethash-cuda/ethash_cuda_miner_kernel.cu
  13. 4
      libethash-cuda/ethash_cuda_miner_kernel.h
  14. 4
      libethash-cuda/ethash_cuda_miner_kernel_globals.h
  15. 0
      libethash-cuda/keccak.cuh
  16. 6
      libethcore/CMakeLists.txt
  17. 4
      libethcore/Ethash.h
  18. 22
      libethcore/EthashCUDAMiner.cpp
  19. 8
      libethcore/EthashCUDAMiner.h
  20. 4
      libethcore/EthashSealEngine.cpp

16
CMakeLists.txt

@ -49,7 +49,7 @@ set(D_TOOLS ON)
set(D_TESTS ON)
set(D_FATDB ON)
set(D_ETHASHCL ON)
set(D_ETHASHCU OFF)
set(D_ETHASHCUDA OFF)
set(D_EVMJIT ON)
set(D_JSCONSOLE ON)
set(D_JSONRPC ON)
@ -136,7 +136,7 @@ elseif (BUNDLE STREQUAL "cudaminer")
set(D_ETHKEY OFF)
set(D_MINER ON)
set(D_ETHASHCL ON)
set(D_ETHASHCU ON)
set(D_ETHASHCUDA ON)
set(D_FATDB OFF)
set(D_JSONRPC ON)
set(D_JSCONSOLE OFF)
@ -173,8 +173,8 @@ function(configureProject)
add_definitions(-DETH_ETHASHCL)
endif()
if (ETHASHCU)
add_definitions(-DETH_ETHASHCU)
if (ETHASHCUDA)
add_definitions(-DETH_ETHASHCUDA)
endif()
if (EVMJIT)
@ -310,7 +310,7 @@ eth_format_option(ROCKSDB)
eth_format_option(TOOLS)
eth_format_option(ETHKEY)
eth_format_option(ETHASHCL)
eth_format_option(ETHASHCU)
eth_format_option(ETHASHCUDA)
eth_format_option(JSCONSOLE)
eth_format_option(OLYMPIC)
eth_format_option(SERPENT)
@ -361,7 +361,7 @@ message("-- SERPENT Build Serpent language components ${SERPENT}
message("-- GUI Build GUI components ${GUI}")
message("-- TESTS Build tests ${TESTS}")
message("-- ETHASHCL Build OpenCL components ${ETHASHCL}")
message("-- ETHASHCU Build CUDA components ${ETHASHCU}")
message("-- ETHASHCUDA Build CUDA components ${ETHASHCUDA}")
message("-- JSCONSOLE Build with javascript console ${JSCONSOLE}")
message("-- EVMJIT Build LLVM-based JIT EVM ${EVMJIT}")
message("------------------------------------------------------------------------")
@ -450,8 +450,8 @@ if (GENERAL OR MINER)
if (ETHASHCL)
add_subdirectory(libethash-cl)
endif ()
if (ETHASHCU)
add_subdirectory(libethash-cu)
if (ETHASHCUDA)
add_subdirectory(libethash-cuda)
endif ()
endif ()

2
ethminer/CMakeLists.txt

@ -11,7 +11,7 @@ if (JSONRPC)
include_directories(${JSON_RPC_CPP_INCLUDE_DIRS})
endif()
if (ETHASHCU)
if (ETHASHCUDA)
include_directories(${CUDA_INCLUDE_DIRS})
endif ()

36
ethminer/MinerAux.h

@ -46,8 +46,8 @@
#if ETH_ETHASHCL || !ETH_TRUE
#include <libethash-cl/ethash_cl_miner.h>
#endif
#if ETH_ETHASHCU || !ETH_TRUE
#include <libethash-cu/ethash_cu_miner.h>
#if ETH_ETHASHCUDA || !ETH_TRUE
#include <libethash-cuda/ethash_cuda_miner.h>
#endif
#if ETH_JSONRPC || !ETH_TRUE
#include <libweb3jsonrpc/WebThreeStubServer.h>
@ -145,7 +145,7 @@ public:
cerr << "Bad " << arg << " option: " << argv[i] << endl;
BOOST_THROW_EXCEPTION(BadArgument());
}
#if ETH_ETHASHCL || ETH_ETHASHCU || !ETH_TRUE
#if ETH_ETHASHCL || ETH_ETHASHCUDA || !ETH_TRUE
else if ((arg == "--cl-global-work" || arg == "--cuda-grid-size") && i + 1 < argc)
try {
m_globalWorkSizeMultiplier = stol(argv[++i]);
@ -183,7 +183,7 @@ public:
else if (arg == "--allow-opencl-cpu")
m_clAllowCPU = true;
#endif
#if ETH_ETHASHCU || !ETH_TRUE
#if ETH_ETHASHCUDA || !ETH_TRUE
else if (arg == "--cuda-devices")
{
while (m_cudaDeviceCount < 16 && i + 1 < argc)
@ -343,7 +343,7 @@ public:
if (m_minerType == MinerType::CL)
EthashGPUMiner::listDevices();
#endif
#if ETH_ETHASHCU || !ETH_TRUE
#if ETH_ETHASHCUDA || !ETH_TRUE
if (m_minerType == MinerType::CUDA)
EthashCUDAMiner::listDevices();
#endif
@ -374,7 +374,7 @@ public:
}
else if (m_minerType == MinerType::CUDA)
{
#if ETH_ETHASHCU || !ETH_TRUE
#if ETH_ETHASHCUDA || !ETH_TRUE
if (!EthashCUDAMiner::configureGPU(
m_localWorkSize,
m_globalWorkSizeMultiplier,
@ -393,7 +393,7 @@ public:
EthashCUDAMiner::setNumInstances(m_miningThreads);
#else
cerr << "Selected CUDA mining without having compiled with -DETHASHCU=1 or -DBUNDLE=cudaminer" << endl;
cerr << "Selected CUDA mining without having compiled with -DETHASHCUDA=1 or -DBUNDLE=cudaminer" << endl;
exit(1);
#endif
}
@ -443,11 +443,11 @@ public:
<< " --cl-global-work Set the OpenCL global work size as a multiple of the local work size. Default is " << toString(ethash_cl_miner::c_defaultGlobalWorkSizeMultiplier) << " * " << toString(ethash_cl_miner::c_defaultLocalWorkSize) << endl
<< " --cl-ms-per-batch Set the OpenCL target milliseconds per batch (global workgroup size). Default is " << toString(ethash_cl_miner::c_defaultMSPerBatch) << ". If 0 is given then no autoadjustment of global work size will happen" << endl
#endif
#if ETH_ETHASHCU || !ETH_TRUE
#if ETH_ETHASHCUDA || !ETH_TRUE
<< " --cuda-extragpu-mem Set the memory (in MB) you believe your GPU requires for stuff other than mining. Windows rendering e.t.c.." << endl
<< " --cuda-block-size Set the CUDA block work size. Default is " << toString(ethash_cu_miner::c_defaultBlockSize) << endl
<< " --cuda-grid-size Set the CUDA grid size. Default is " << toString(ethash_cu_miner::c_defaultGridSize) << endl
<< " --cuda-streams Set the number of CUDA streams. Default is " << toString(ethash_cu_miner::c_defaultNumStreams) << endl
<< " --cuda-block-size Set the CUDA block work size. Default is " << toString(ethash_cuda_miner::c_defaultBlockSize) << endl
<< " --cuda-grid-size Set the CUDA grid size. Default is " << toString(ethash_cuda_miner::c_defaultGridSize) << endl
<< " --cuda-streams Set the number of CUDA streams. Default is " << toString(ethash_cuda_miner::c_defaultNumStreams) << endl
<< " --cuda-turbo Get a bit of extra hashrate at the cost of high CPU load... Default is false" << endl
<< " --cuda-devices <0 1 ..n> Select which GPUs to mine on. Default is to use all" << endl
#endif
@ -485,7 +485,7 @@ private:
#if ETH_ETHASHCL
sealers["opencl"] = GenericFarm<EthashProofOfWork>::SealerDescriptor{&EthashGPUMiner::instances, [](GenericMiner<EthashProofOfWork>::ConstructionInfo ci){ return new EthashGPUMiner(ci); }};
#endif
#if ETH_ETHASHCU
#if ETH_ETHASHCUDA
sealers["cuda"] = GenericFarm<EthashProofOfWork>::SealerDescriptor{ &EthashGPUMiner::instances, [](GenericMiner<EthashProofOfWork>::ConstructionInfo ci){ return new EthashCUDAMiner(ci); } };
#endif
f.setSealers(sealers);
@ -563,7 +563,7 @@ private:
#if ETH_ETHASHCL
sealers["opencl"] = GenericFarm<EthashProofOfWork>::SealerDescriptor{&EthashGPUMiner::instances, [](GenericMiner<EthashProofOfWork>::ConstructionInfo ci){ return new EthashGPUMiner(ci); }};
#endif
#if ETH_ETHASHCU
#if ETH_ETHASHCUDA
sealers["cuda"] = GenericFarm<EthashProofOfWork>::SealerDescriptor{ &EthashCUDAMiner::instances, [](GenericMiner<EthashProofOfWork>::ConstructionInfo ci){ return new EthashCUDAMiner(ci); } };
#endif
(void)_m;
@ -676,18 +676,18 @@ private:
bool m_shouldListDevices = false;
bool m_clAllowCPU = false;
#if ETH_ETHASHCL || !ETH_TRUE
#if !ETH_ETHASHCU || !ETH_TRUE
#if !ETH_ETHASHCUDA || !ETH_TRUE
unsigned m_globalWorkSizeMultiplier = ethash_cl_miner::c_defaultGlobalWorkSizeMultiplier;
unsigned m_localWorkSize = ethash_cl_miner::c_defaultLocalWorkSize;
#endif
unsigned m_msPerBatch = ethash_cl_miner::c_defaultMSPerBatch;
#endif
#if ETH_ETHASHCU || !ETH_TRUE
unsigned m_globalWorkSizeMultiplier = ethash_cu_miner::c_defaultGridSize;
unsigned m_localWorkSize = ethash_cu_miner::c_defaultBlockSize;
#if ETH_ETHASHCUDA || !ETH_TRUE
unsigned m_globalWorkSizeMultiplier = ethash_cuda_miner::c_defaultGridSize;
unsigned m_localWorkSize = ethash_cuda_miner::c_defaultBlockSize;
unsigned m_cudaDeviceCount = 0;
unsigned m_cudaDevices[16];
unsigned m_numStreams = ethash_cu_miner::c_defaultNumStreams;
unsigned m_numStreams = ethash_cuda_miner::c_defaultNumStreams;
bool m_cudaHighCPULoad = false;
#endif
uint64_t m_currentBlock = 0;

29
libethash-cu/CMakeLists.txt

@ -1,29 +0,0 @@
set(EXECUTABLE ethash-cu)
FIND_PACKAGE(CUDA REQUIRED)
file(GLOB SRC_LIST "*.cpp" "*.cu")
file(GLOB HEADERS "*.h" "*.cuh")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--std=c++11;--disable-warnings;--ptxas-options=-v;-use_fast_math;-lineinfo)
LIST(APPEND CUDA_NVCC_FLAGS_RELEASE -O3)
LIST(APPEND CUDA_NVCC_FLAGS_DEBUG -G)
if(COMPUTE)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_${COMPUTE},code=sm_${COMPUTE})
else(COMPUTE)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_20,code=sm_20;-gencode arch=compute_30,code=sm_30;-gencode arch=compute_32,code=sm_32;-gencode arch=compute_35,code=sm_35;-gencode arch=compute_50,code=sm_50;-gencode arch=compute_52,code=sm_52)
endif(COMPUTE)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CUDA_INCLUDE_DIRS})
include_directories(..)
CUDA_ADD_LIBRARY(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
TARGET_LINK_LIBRARIES(${EXECUTABLE} ${CUDA_LIBRARIES} ethash)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )

64
libethash-cu/rotl64.cuh

@ -1,64 +0,0 @@
#include <cuda.h>
#include <cuda_runtime.h>
#include <stdint.h>
// 64-bit ROTATE LEFT
#if __CUDA_ARCH__ >= 320
__device__ uint64_t ROTL64H(const uint64_t x, const int offset)
{
uint64_t res;
asm("{\n\t"
".reg .u32 tl,th,vl,vh;\n\t"
"mov.b64 {tl,th}, %1;\n\t"
"shf.l.wrap.b32 vl, tl, th, %2;\n\t"
"shf.l.wrap.b32 vh, th, tl, %2;\n\t"
"mov.b64 %0, {vl,vh};\n\t"
"}"
: "=l"(res) : "l"(x), "r"(offset)
);
return res;
}
__device__ uint64_t ROTL64L(const uint64_t x, const int offset)
{
uint64_t res;
asm("{\n\t"
".reg .u32 tl,th,vl,vh;\n\t"
"mov.b64 {tl,th}, %1;\n\t"
"shf.l.wrap.b32 vl, tl, th, %2;\n\t"
"shf.l.wrap.b32 vh, th, tl, %2;\n\t"
"mov.b64 %0, {vh,vl};\n\t"
"}"
: "=l"(res) : "l"(x), "r"(offset)
);
return res;
}
#elif __CUDA_ARCH__ >= 120
#define ROTL64H(x, n) ROTL64(x,n)
#define ROTL64L(x, n) ROTL64(x,n)
__device__ __forceinline__
uint64_t ROTL64(const uint64_t x, const int offset)
{
uint64_t result;
asm("{\n\t"
".reg .b64 lhs;\n\t"
".reg .u32 roff;\n\t"
"shl.b64 lhs, %1, %2;\n\t"
"sub.u32 roff, 64, %2;\n\t"
"shr.b64 %0, %1, roff;\n\t"
"add.u64 %0, lhs, %0;\n\t"
"}\n"
: "=l"(result) : "l"(x), "r"(offset));
return result;
}
#else
#define ROTL64H(x, n) ROTL64(x,n)
#define ROTL64L(x, n) ROTL64(x,n)
/* host */
#define ROTL64(x, n) (((x) << (n)) | ((x) >> (64 - (n))))
#endif

0
libethash-cu/cuda_helper.h → libethash-cuda/cuda_helper.h

0
libethash-cu/dagger.cuh → libethash-cuda/dagger.cuh

4
libethash-cu/dagger_shared.cuh → libethash-cuda/dagger_shared.cuh

@ -1,5 +1,5 @@
#include "ethash_cu_miner_kernel_globals.h"
#include "ethash_cu_miner_kernel.h"
#include "ethash_cuda_miner_kernel_globals.h"
#include "ethash_cuda_miner_kernel.h"
#include "keccak.cuh"
#include "dagger.cuh"

4
libethash-cu/dagger_shuffled.cuh → libethash-cuda/dagger_shuffled.cuh

@ -1,5 +1,5 @@
#include "ethash_cu_miner_kernel_globals.h"
#include "ethash_cu_miner_kernel.h"
#include "ethash_cuda_miner_kernel_globals.h"
#include "ethash_cuda_miner_kernel.h"
#include "keccak.cuh"
#include "dagger.cuh"

52
libethash-cu/ethash_cu_miner.cpp → libethash-cuda/ethash_cuda_miner.cpp

@ -14,8 +14,8 @@
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ethash_cu_miner.cpp
* @author Tim Hughes <tim@twistedfury.com>
/** @file ethash_cuda_miner.cpp
* @author Genoil <jw@meneer.net>
* @date 2015
*/
@ -37,8 +37,8 @@
#include <libethash/ethash.h>
#include <libethash/internal.h>
#include <cuda_runtime.h>
#include "ethash_cu_miner.h"
#include "ethash_cu_miner_kernel_globals.h"
#include "ethash_cuda_miner.h"
#include "ethash_cuda_miner_kernel_globals.h"
#define ETHASH_BYTES 32
@ -54,14 +54,14 @@
using namespace std;
unsigned const ethash_cu_miner::c_defaultBlockSize = 128;
unsigned const ethash_cu_miner::c_defaultGridSize = 2048; // * CL_DEFAULT_LOCAL_WORK_SIZE
unsigned const ethash_cu_miner::c_defaultNumStreams = 2;
unsigned const ethash_cuda_miner::c_defaultBlockSize = 128;
unsigned const ethash_cuda_miner::c_defaultGridSize = 2048; // * CL_DEFAULT_LOCAL_WORK_SIZE
unsigned const ethash_cuda_miner::c_defaultNumStreams = 2;
#if defined(_WIN32)
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* lpOutputString);
static std::atomic_flag s_logSpin = ATOMIC_FLAG_INIT;
#define ETHCU_LOG(_contents) \
#define ETHCUDA_LOG(_contents) \
do \
{ \
std::stringstream ss; \
@ -72,7 +72,7 @@ static std::atomic_flag s_logSpin = ATOMIC_FLAG_INIT;
s_logSpin.clear(std::memory_order_release); \
} while (false)
#else
#define ETHCU_LOG(_contents) cout << "[CUDA]:" << _contents << endl
#define ETHCUDA_LOG(_contents) cout << "[CUDA]:" << _contents << endl
#endif
#define CUDA_SAFE_CALL(call) \
@ -85,13 +85,13 @@ do { \
} \
} while (0)
ethash_cu_miner::search_hook::~search_hook() {}
ethash_cuda_miner::search_hook::~search_hook() {}
ethash_cu_miner::ethash_cu_miner()
ethash_cuda_miner::ethash_cuda_miner()
{
}
std::string ethash_cu_miner::platform_info(unsigned _deviceId)
std::string ethash_cuda_miner::platform_info(unsigned _deviceId)
{
int runtime_version;
int device_count;
@ -121,14 +121,14 @@ std::string ethash_cu_miner::platform_info(unsigned _deviceId)
}
unsigned ethash_cu_miner::getNumDevices()
unsigned ethash_cuda_miner::getNumDevices()
{
int device_count;
CUDA_SAFE_CALL(cudaGetDeviceCount(&device_count));
return device_count;
}
bool ethash_cu_miner::configureGPU(
bool ethash_cuda_miner::configureGPU(
unsigned _blockSize,
unsigned _gridSize,
unsigned _numStreams,
@ -152,14 +152,14 @@ bool ethash_cu_miner::configureGPU(
CUDA_SAFE_CALL(cudaGetDeviceProperties(&props, i));
if (props.totalGlobalMem >= requiredSize)
{
ETHCU_LOG(
ETHCUDA_LOG(
"Found suitable CUDA device [" << string(props.name)
<< "] with " << props.totalGlobalMem << " bytes of GPU memory"
);
return true;
}
ETHCU_LOG(
ETHCUDA_LOG(
"CUDA device " << string(props.name)
<< " has insufficient GPU memory." << to_string(props.totalGlobalMem) <<
" bytes of memory found < " << to_string(requiredSize) << " bytes of memory required"
@ -168,13 +168,13 @@ bool ethash_cu_miner::configureGPU(
return false;
}
unsigned ethash_cu_miner::s_extraRequiredGPUMem;
unsigned ethash_cu_miner::s_blockSize = ethash_cu_miner::c_defaultBlockSize;
unsigned ethash_cu_miner::s_gridSize = ethash_cu_miner::c_defaultGridSize;
unsigned ethash_cu_miner::s_numStreams = ethash_cu_miner::c_defaultNumStreams;
bool ethash_cu_miner::s_highCPU = false;
unsigned ethash_cuda_miner::s_extraRequiredGPUMem;
unsigned ethash_cuda_miner::s_blockSize = ethash_cuda_miner::c_defaultBlockSize;
unsigned ethash_cuda_miner::s_gridSize = ethash_cuda_miner::c_defaultGridSize;
unsigned ethash_cuda_miner::s_numStreams = ethash_cuda_miner::c_defaultNumStreams;
bool ethash_cuda_miner::s_highCPU = false;
void ethash_cu_miner::listDevices()
void ethash_cuda_miner::listDevices()
{
string outString = "\nListing CUDA devices.\nFORMAT: [deviceID] deviceName\n";
for (unsigned int i = 0; i < getNumDevices(); i++)
@ -186,10 +186,10 @@ void ethash_cu_miner::listDevices()
outString += "\tCompute version: " + to_string(props.major) + "." + to_string(props.minor) + "\n";
outString += "\tcudaDeviceProp::totalGlobalMem: " + to_string(props.totalGlobalMem) + "\n";
}
ETHCU_LOG(outString);
ETHCUDA_LOG(outString);
}
void ethash_cu_miner::finish()
void ethash_cuda_miner::finish()
{
for (unsigned i = 0; i != s_numStreams; i++) {
cudaStreamDestroy(m_streams[i]);
@ -198,7 +198,7 @@ void ethash_cu_miner::finish()
cudaDeviceReset();
}
bool ethash_cu_miner::init(uint8_t const* _dag, uint64_t _dagSize, unsigned _deviceId)
bool ethash_cuda_miner::init(uint8_t const* _dag, uint64_t _dagSize, unsigned _deviceId)
{
int device_count = getNumDevices();
@ -276,7 +276,7 @@ static unsigned waitStream(cudaStream_t stream)
return wait_ms;
}
void ethash_cu_miner::search(uint8_t const* header, uint64_t target, search_hook& hook)
void ethash_cuda_miner::search(uint8_t const* header, uint64_t target, search_hook& hook)
{
struct pending_batch
{

6
libethash-cu/ethash_cu_miner.h → libethash-cuda/ethash_cuda_miner.h

@ -5,9 +5,9 @@
#include <time.h>
#include <functional>
#include <libethash/ethash.h>
#include "ethash_cu_miner_kernel.h"
#include "ethash_cuda_miner_kernel.h"
class ethash_cu_miner
class ethash_cuda_miner
{
public:
struct search_hook
@ -20,7 +20,7 @@ public:
};
public:
ethash_cu_miner();
ethash_cuda_miner();
static std::string platform_info(unsigned _deviceId = 0);
static unsigned getNumDevices();

4
libethash-cu/ethash_cu_miner_kernel.cu → libethash-cuda/ethash_cuda_miner_kernel.cu

@ -4,8 +4,8 @@
* thanks to sp_, trpuvot, djm34, cbuchner for things i took from ccminer.
*/
#include "ethash_cu_miner_kernel.h"
#include "ethash_cu_miner_kernel_globals.h"
#include "ethash_cuda_miner_kernel.h"
#include "ethash_cuda_miner_kernel_globals.h"
#include "cuda_helper.h"
#define SHUFFLE_MIN_VER 350

4
libethash-cu/ethash_cu_miner_kernel.h → libethash-cuda/ethash_cuda_miner_kernel.h

@ -1,5 +1,5 @@
#ifndef _ETHASH_CU_MINER_KERNEL_H_
#define _ETHASH_CU_MINER_KERNEL_H_
#ifndef _ETHASH_CUDA_MINER_KERNEL_H_
#define _ETHASH_CUDA_MINER_KERNEL_H_
#include <stdint.h>
#include <cuda_runtime.h>

4
libethash-cu/ethash_cu_miner_kernel_globals.h → libethash-cuda/ethash_cuda_miner_kernel_globals.h

@ -1,5 +1,5 @@
#ifndef _ETHASH_CU_MINER_KERNEL_GLOBALS_H_
#define _ETHASH_CU_MINER_KERNEL_GLOBALS_H_
#ifndef _ETHASH_CUDA_MINER_KERNEL_GLOBALS_H_
#define _ETHASH_CUDA_MINER_KERNEL_GLOBALS_H_
//#include "cuda_helper.h"

0
libethash-cu/keccak.cuh → libethash-cuda/keccak.cuh

6
libethcore/CMakeLists.txt

@ -10,7 +10,7 @@ if (CPUID_FOUND)
include_directories(${Cpuid_INCLUDE_DIRS})
endif ()
if (ETHASHCU)
if (ETHASHCUDA)
include_directories(${CUDA_INCLUDE_DIRS})
endif ()
@ -25,8 +25,8 @@ target_link_libraries(${EXECUTABLE} ethash)
if (ETHASHCL)
target_link_libraries(${EXECUTABLE} ethash-cl)
endif ()
if (ETHASHCU)
target_link_libraries(${EXECUTABLE} ethash-cu)
if (ETHASHCUDA)
target_link_libraries(${EXECUTABLE} ethash-cuda)
endif ()
target_link_libraries(${EXECUTABLE} devcrypto)
if (CPUID_FOUND)

4
libethcore/Ethash.h

@ -33,7 +33,7 @@
#include "Sealer.h"
class ethash_cl_miner;
class ethash_cu_miner;
class ethash_cuda_miner;
namespace dev
{
@ -46,7 +46,7 @@ namespace eth
class BlockInfo;
class EthashCLHook;
class EthashCUHook;
class EthashCUDAHook;
class Ethash
{

22
libethcore/EthashCUDAMiner.cpp

@ -21,12 +21,12 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
* Determines the PoW algorithm.
*/
#if ETH_ETHASHCU || !ETH_TRUE
#if ETH_ETHASHCUDA || !ETH_TRUE
#include "EthashCUDAMiner.h"
#include <thread>
#include <chrono>
#include <libethash-cu/ethash_cu_miner.h>
#include <libethash-cuda/ethash_cuda_miner.h>
using namespace std;
using namespace dev;
using namespace eth;
@ -35,11 +35,11 @@ namespace dev
{
namespace eth
{
class EthashCUHook : public ethash_cu_miner::search_hook
class EthashCUDAHook : public ethash_cuda_miner::search_hook
{
public:
EthashCUHook(EthashCUDAMiner* _owner) : m_owner(_owner) {}
EthashCUHook(EthashCUHook const&) = delete;
EthashCUDAHook(EthashCUDAMiner* _owner) : m_owner(_owner) {}
EthashCUDAHook(EthashCUDAHook const&) = delete;
void abort()
{
@ -106,7 +106,7 @@ int EthashCUDAMiner::s_devices[16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -
EthashCUDAMiner::EthashCUDAMiner(ConstructionInfo const& _ci) :
GenericMiner<EthashProofOfWork>(_ci),
Worker("cudaminer" + toString(index())),
m_hook( new EthashCUHook(this))
m_hook( new EthashCUDAHook(this))
{
}
@ -144,7 +144,7 @@ void EthashCUDAMiner::workLoop()
m_minerSeed = w.seedHash;
delete m_miner;
m_miner = new ethash_cu_miner;
m_miner = new ethash_cuda_miner;
unsigned device = instances() > 1 ? (s_devices[index()] > -1 ? s_devices[index()] : index()) : s_deviceId;
@ -185,17 +185,17 @@ void EthashCUDAMiner::pause()
std::string EthashCUDAMiner::platformInfo()
{
return ethash_cu_miner::platform_info(s_deviceId);
return ethash_cuda_miner::platform_info(s_deviceId);
}
unsigned EthashCUDAMiner::getNumDevices()
{
return ethash_cu_miner::getNumDevices();
return ethash_cuda_miner::getNumDevices();
}
void EthashCUDAMiner::listDevices()
{
return ethash_cu_miner::listDevices();
return ethash_cuda_miner::listDevices();
}
bool EthashCUDAMiner::configureGPU(
@ -214,7 +214,7 @@ bool EthashCUDAMiner::configureGPU(
cout << "Given localWorkSize of " << toString(_blockSize) << "is invalid. Must be either 32,64 or 128" << endl;
return false;
}
if (!ethash_cu_miner::configureGPU(
if (!ethash_cuda_miner::configureGPU(
_blockSize,
_gridSize,
_numStreams,

8
libethcore/EthashCUDAMiner.h

@ -22,7 +22,7 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if ETH_ETHASHCU || !ETH_TRUE
#if ETH_ETHASHCUDA || !ETH_TRUE
#include "libdevcore/Worker.h"
#include "EthashAux.h"
@ -34,7 +34,7 @@ namespace eth
{
class EthashCUDAMiner : public GenericMiner<EthashProofOfWork>, Worker
{
friend class dev::eth::EthashCUHook;
friend class dev::eth::EthashCUDAHook;
public:
EthashCUDAMiner(ConstructionInfo const& _ci);
@ -77,8 +77,8 @@ namespace eth
using GenericMiner<EthashProofOfWork>::accumulateHashes;
EthashCUHook* m_hook = nullptr;
ethash_cu_miner* m_miner = nullptr;
EthashCUDAHook* m_hook = nullptr;
ethash_cuda_miner* m_miner = nullptr;
h256 m_minerSeed; ///< Last seed in m_miner
static unsigned s_platformId;

4
libethcore/EthashSealEngine.cpp

@ -36,7 +36,7 @@ EthashSealEngine::EthashSealEngine()
#if ETH_ETHASHCL
sealers["opencl"] = GenericFarm<EthashProofOfWork>::SealerDescriptor{&EthashGPUMiner::instances, [](GenericMiner<EthashProofOfWork>::ConstructionInfo ci){ return new EthashGPUMiner(ci); }};
#endif
#if ETH_ETHASHCU
#if ETH_ETHASHCUDA
sealers["cuda"] = GenericFarm<EthashProofOfWork>::SealerDescriptor{ &EthashCUDAMiner::instances, [](GenericMiner<EthashProofOfWork>::ConstructionInfo ci){ return new EthashCUDAMiner(ci); } };
#endif
m_farm.setSealers(sealers);
@ -49,7 +49,7 @@ strings EthashSealEngine::sealers() const
#if ETH_ETHASHCL
, "opencl"
#endif
#if ETH_ETHASHCU
#if ETH_ETHASHCUDA
, "cuda"
#endif
};

Loading…
Cancel
Save