Skip to content

Commit

Permalink
fixed -cs switch to work with any combination of cpu/ocl types
Browse files Browse the repository at this point in the history
  • Loading branch information
maztheman committed Nov 11, 2016
1 parent 1c66cc1 commit d64c0f6
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 65 deletions.
7 changes: 5 additions & 2 deletions nheqminer/libstratum/StratumClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,12 @@ template class StratumClient<ZMinerAVXCUDA80_XMP, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerSSE2CUDA80_XMP, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerAVXCUDA75_XMP, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerSSE2CUDA75_XMP, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerAVXCUDASA80_XMP, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerSSE2CUDASA80_XMP, ZcashJob, EquihashSolution>;
// Silentarmy
template class StratumClient<ZMinerAVXCUDA80_SA, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerAVXCUDASA80_SA, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerSSE2CUDA80_SA, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerAVXCUDA75_SA, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerSSE2CUDA75_SA, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerSSE2CUDA75_SA, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerAVXCUDASA80_SA, ZcashJob, EquihashSolution>;
template class StratumClient<ZMinerSSE2CUDASA80_SA, ZcashJob, EquihashSolution>;
5 changes: 4 additions & 1 deletion nheqminer/libstratum/StratumClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ typedef StratumClient<ZMinerAVXCUDA80_XMP, ZcashJob, EquihashSolution> ZcashStra
typedef StratumClient<ZMinerSSE2CUDA80_XMP, ZcashJob, EquihashSolution> ZcashStratumClientSSE2CUDA80_XMP;
typedef StratumClient<ZMinerAVXCUDA75_XMP, ZcashJob, EquihashSolution> ZcashStratumClientAVXCUDA75_XMP;
typedef StratumClient<ZMinerSSE2CUDA75_XMP, ZcashJob, EquihashSolution> ZcashStratumClientSSE2CUDA75_XMP;
typedef StratumClient<ZMinerAVXCUDASA80_XMP, ZcashJob, EquihashSolution> ZcashStratumClientAVXCUDASA80_XMP;
typedef StratumClient<ZMinerSSE2CUDASA80_XMP, ZcashJob, EquihashSolution> ZcashStratumClientSSE2CUDASA80_XMP;
// Silentarmy
typedef StratumClient<ZMinerAVXCUDA80_SA, ZcashJob, EquihashSolution> ZcashStratumClientAVXCUDA80_SA;
typedef StratumClient<ZMinerSSE2CUDA80_SA, ZcashJob, EquihashSolution> ZcashStratumClientSSE2CUDA80_SA;
typedef StratumClient<ZMinerAVXCUDA75_SA, ZcashJob, EquihashSolution> ZcashStratumClientAVXCUDA75_SA;
typedef StratumClient<ZMinerSSE2CUDA75_SA, ZcashJob, EquihashSolution> ZcashStratumClientSSE2CUDA75_SA;
typedef StratumClient<ZMinerAVXCUDASA80_SA, ZcashJob, EquihashSolution> ZcashStratumClientAVXCUDASA80_SA;
typedef StratumClient<ZMinerSSE2CUDA75_SA, ZcashJob, EquihashSolution> ZcashStratumClientSSE2CUDA75_SA;
typedef StratumClient<ZMinerSSE2CUDASA80_SA, ZcashJob, EquihashSolution> ZcashStratumClientSSE2CUDASA80_SA;
17 changes: 17 additions & 0 deletions nheqminer/libstratum/ZcashStratum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,16 @@ template class ZcashMiner<cpu_xenoncat, cuda_tromp, ocl_xmp>;
template class ZcashMiner<cpu_tromp, cuda_tromp, ocl_xmp>;
template class ZcashMiner<cpu_xenoncat, cuda_tromp_75, ocl_xmp>;
template class ZcashMiner<cpu_tromp, cuda_tromp_75, ocl_xmp>;
template class ZcashMiner<cpu_xenoncat, cuda_sa_solver, ocl_xmp>;
template class ZcashMiner<cpu_tromp, cuda_sa_solver, ocl_xmp>;

// Silentarmy
template class ZcashMiner<cpu_xenoncat, cuda_tromp, ocl_silentarmy>;
template class ZcashMiner<cpu_tromp, cuda_tromp, ocl_silentarmy>;
template class ZcashMiner<cpu_xenoncat, cuda_tromp_75, ocl_silentarmy>;
template class ZcashMiner<cpu_tromp, cuda_tromp_75, ocl_silentarmy>;
template class ZcashMiner<cpu_xenoncat, cuda_sa_solver, ocl_silentarmy>;
template class ZcashMiner<cpu_tromp, cuda_sa_solver, ocl_silentarmy>;

std::mutex benchmark_work;
std::vector<uint256*> benchmark_nonces;
Expand Down Expand Up @@ -858,6 +862,15 @@ void ZMinerSSE2CUDA75_XMP_doBenchmark(int hashes, int cpu_threads, int cuda_coun
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t) {
ZMinerSSE2CUDA75_XMP::doBenchmark(hashes, cpu_threads, cuda_count, cuda_en, cuda_b, cuda_t, opencl_count, opencl_platf, opencl_en, opencl_t);
}
void ZMinerAVXCUDASA80_XMP_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t) {
ZMinerAVXCUDASA80_XMP::doBenchmark(hashes, cpu_threads, cuda_count, cuda_en, cuda_b, cuda_t, opencl_count, opencl_platf, opencl_en, opencl_t);
}
void ZMinerSSE2CUDASA80_XMP_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t) {
ZMinerSSE2CUDASA80_XMP::doBenchmark(hashes, cpu_threads, cuda_count, cuda_en, cuda_b, cuda_t, opencl_count, opencl_platf, opencl_en, opencl_t);
}

// ocl_silentarmy
void ZMinerAVXCUDA80_SA_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t) {
Expand All @@ -879,4 +892,8 @@ void ZMinerAVXCUDASA80_SA_doBenchmark(int hashes, int cpu_threads, int cuda_coun
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t) {
ZMinerAVXCUDASA80_SA::doBenchmark(hashes, cpu_threads, cuda_count, cuda_en, cuda_b, cuda_t, opencl_count, opencl_platf, opencl_en, opencl_t);
}
void ZMinerSSE2CUDASA80_SA_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t) {
ZMinerSSE2CUDASA80_SA::doBenchmark(hashes, cpu_threads, cuda_count, cuda_en, cuda_b, cuda_t, opencl_count, opencl_platf, opencl_en, opencl_t);
}

12 changes: 11 additions & 1 deletion nheqminer/libstratum/ZcashStratum.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,16 @@ typedef ZcashMiner<cpu_xenoncat, cuda_tromp, ocl_xmp> ZMinerAVXCUDA80_XMP;
typedef ZcashMiner<cpu_tromp, cuda_tromp, ocl_xmp> ZMinerSSE2CUDA80_XMP;
typedef ZcashMiner<cpu_xenoncat, cuda_tromp_75, ocl_xmp> ZMinerAVXCUDA75_XMP;
typedef ZcashMiner<cpu_tromp, cuda_tromp_75, ocl_xmp> ZMinerSSE2CUDA75_XMP;
typedef ZcashMiner<cpu_tromp, cuda_sa_solver, ocl_xmp> ZMinerSSE2CUDASA80_XMP;
typedef ZcashMiner<cpu_xenoncat, cuda_sa_solver, ocl_xmp> ZMinerAVXCUDASA80_XMP;

// ocl_silentarmy
typedef ZcashMiner<cpu_xenoncat, cuda_tromp, ocl_silentarmy> ZMinerAVXCUDA80_SA;
typedef ZcashMiner<cpu_xenoncat, cuda_sa_solver, ocl_silentarmy> ZMinerAVXCUDASA80_SA;
typedef ZcashMiner<cpu_tromp, cuda_tromp, ocl_silentarmy> ZMinerSSE2CUDA80_SA;
typedef ZcashMiner<cpu_xenoncat, cuda_tromp_75, ocl_silentarmy> ZMinerAVXCUDA75_SA;
typedef ZcashMiner<cpu_tromp, cuda_tromp_75, ocl_silentarmy> ZMinerSSE2CUDA75_SA;
typedef ZcashMiner<cpu_tromp, cuda_sa_solver, ocl_silentarmy> ZMinerSSE2CUDASA80_SA;
typedef ZcashMiner<cpu_xenoncat, cuda_sa_solver, ocl_silentarmy> ZMinerAVXCUDASA80_SA;

// ocl_xmp
// gcc static undefined reference workaround
Expand All @@ -177,6 +181,10 @@ void ZMinerAVXCUDA75_XMP_doBenchmark(int hashes, int cpu_threads, int cuda_count
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
void ZMinerSSE2CUDA75_XMP_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
void ZMinerAVXCUDASA80_XMP_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
void ZMinerSSE2CUDASA80_XMP_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
// ocl_silentarmy
void ZMinerAVXCUDA80_SA_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
Expand All @@ -187,4 +195,6 @@ void ZMinerAVXCUDA75_SA_doBenchmark(int hashes, int cpu_threads, int cuda_count,
void ZMinerSSE2CUDA75_SA_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
void ZMinerAVXCUDASA80_SA_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
void ZMinerSSE2CUDASA80_SA_doBenchmark(int hashes, int cpu_threads, int cuda_count, int* cuda_en, int* cuda_b, int* cuda_t,
int opencl_count, int opencl_platf, int* opencl_en, int* opencl_t);
116 changes: 55 additions & 61 deletions nheqminer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@ static ZcashStratumClientAVXCUDA80_XMP* scSigAVXC80_XMP = nullptr;
static ZcashStratumClientSSE2CUDA80_XMP* scSigSSE2C80_XMP = nullptr;
static ZcashStratumClientAVXCUDA75_XMP* scSigAVXC75_XMP = nullptr;
static ZcashStratumClientSSE2CUDA75_XMP* scSigSSE2C75_XMP = nullptr;
static ZcashStratumClientAVXCUDASA80_XMP* scSigAVXCSA80_XMP = nullptr;
static ZcashStratumClientSSE2CUDASA80_XMP* scSigSSE2CSA80_XMP = nullptr;

// _SA
static ZcashStratumClientAVXCUDA80_SA* scSigAVXC80_SA = nullptr;
static ZcashStratumClientSSE2CUDA80_SA* scSigSSE2C80_SA = nullptr;
static ZcashStratumClientAVXCUDA75_SA* scSigAVXC75_SA = nullptr;
static ZcashStratumClientAVXCUDASA80_SA* scSigAVXCSA80_SA = nullptr;
static ZcashStratumClientSSE2CUDA75_SA* scSigSSE2C75_SA = nullptr;
static ZcashStratumClientAVXCUDASA80_SA* scSigAVXCSA80_SA = nullptr;
static ZcashStratumClientSSE2CUDASA80_SA* scSigSSE2CSA80_SA = nullptr;


extern "C" void stratum_sigint_handler(int signum)
{
Expand Down Expand Up @@ -460,101 +465,90 @@ int main(int argc, char* argv[])
std::string port = delim != std::string::npos ? location.substr(delim + 1) : "2142";

if (use_old_xmp) {
if (use_avx)
{
if (use_old_cuda)
{
if (use_avx) {
if (use_cuda_sa) {
start_mining<ZMinerAVXCUDASA80_XMP, ZcashStratumClientAVXCUDASA80_XMP>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigAVXCSA80_XMP);
} else if (use_old_cuda) {
start_mining<ZMinerAVXCUDA75_XMP, ZcashStratumClientAVXCUDA75_XMP>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigAVXC75_XMP);
}
else
{
} else {
start_mining<ZMinerAVXCUDA80_XMP, ZcashStratumClientAVXCUDA80_XMP>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigAVXC80_XMP);
}
}
else
{
if (use_old_cuda)
{
} else {
if (use_cuda_sa) {
start_mining<ZMinerSSE2CUDASA80_XMP, ZcashStratumClientSSE2CUDASA80_XMP>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigSSE2CSA80_XMP);
} else if (use_old_cuda) {
start_mining<ZMinerSSE2CUDA75_XMP, ZcashStratumClientSSE2CUDA75_XMP>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigSSE2C75_XMP);
}
else
{
} else {
start_mining<ZMinerSSE2CUDA80_XMP, ZcashStratumClientSSE2CUDA80_XMP>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigSSE2C80_XMP);
}
}
}
else { // sarmy
if (use_avx)
{
} else { // sarmy
if (use_avx) {
if (use_cuda_sa) {
start_mining<ZMinerAVXCUDASA80_SA, ZcashStratumClientAVXCUDASA80_SA>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigAVXCSA80_SA);
}
else if (use_old_cuda)
{
} else if (use_old_cuda) {
start_mining<ZMinerAVXCUDA75_SA, ZcashStratumClientAVXCUDA75_SA>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigAVXC75_SA);
}
else
{
} else {
start_mining<ZMinerAVXCUDA80_SA, ZcashStratumClientAVXCUDA80_SA>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigAVXC80_SA);
}
}
else
{
if (use_old_cuda)
{
} else {
if (use_cuda_sa) {
start_mining<ZMinerSSE2CUDASA80_SA, ZcashStratumClientSSE2CUDASA80_SA>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigSSE2CSA80_SA);
} else if (use_old_cuda) {
start_mining<ZMinerSSE2CUDA75_SA, ZcashStratumClientSSE2CUDA75_SA>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigSSE2C75_SA);
}
else
{
} else {
start_mining<ZMinerSSE2CUDA80_SA, ZcashStratumClientSSE2CUDA80_SA>(api_port, num_threads, cuda_device_count, opencl_device_count, opencl_platform,
host, port, user, password, scSigSSE2C80_SA);
}
}
}
}
else
{
} else {
if (use_old_xmp) {
if (use_avx)
{
if (use_old_cuda)
ZMinerAVXCUDA75_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
else
ZMinerAVXCUDA80_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
}
else
{
if (use_old_cuda)
ZMinerSSE2CUDA75_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
else
ZMinerSSE2CUDA80_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
if (use_avx) {
if (use_cuda_sa) {
ZMinerAVXCUDASA80_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else if (use_old_cuda) {
ZMinerAVXCUDA75_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else {
ZMinerAVXCUDA80_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
}
} else {
if (use_cuda_sa) {
ZMinerSSE2CUDASA80_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else if (use_old_cuda) {
ZMinerSSE2CUDA75_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else {
ZMinerSSE2CUDA80_XMP_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
}
}
}
else { // sarmy
if (use_avx)
{
} else { // sarmy
if (use_avx) {
if (use_cuda_sa) {
ZMinerAVXCUDASA80_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else if (use_old_cuda) {
ZMinerAVXCUDA75_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else {
ZMinerAVXCUDA80_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
}
}
else
{
if (use_old_cuda)
ZMinerSSE2CUDA75_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
else
ZMinerSSE2CUDA80_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else {
if (use_cuda_sa) {
ZMinerSSE2CUDASA80_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else if (use_old_cuda) {
ZMinerSSE2CUDA75_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
} else {
ZMinerSSE2CUDA80_SA_doBenchmark(num_hashes, num_threads, cuda_device_count, cuda_enabled, cuda_blocks, cuda_tpb, opencl_device_count, opencl_platform, opencl_enabled, opencl_threads);
}
}
}
}
Expand Down

0 comments on commit d64c0f6

Please sign in to comment.