Renamed macros for enable/disable algorithms.

This commit is contained in:
XMRig 2019-06-09 15:29:26 +07:00
parent 09cdddc7f6
commit d9eb700e03
11 changed files with 38 additions and 40 deletions

View file

@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8)
project(xmrig)
option(WITH_LIBCPUID "Use Libcpuid" ON)
option(WITH_AEON "CryptoNight-Lite support" ON)
option(WITH_SUMO "CryptoNight-Heavy support" ON)
option(WITH_CN_LITE "CryptoNight-Lite support" ON)
option(WITH_CN_HEAVY "CryptoNight-Heavy support" ON)
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
option(WITH_CN_GPU "CryptoNight-GPU support" ON)
option(WITH_HTTP "HTTP protocol support (client/server)" ON)
@ -182,20 +182,16 @@ include(cmake/OpenSSL.cmake)
include(cmake/asm.cmake)
include(cmake/cn-gpu.cmake)
if (NOT WITH_AEON)
add_definitions(/DXMRIG_NO_AEON)
if (WITH_CN_LITE)
add_definitions(/DXMRIG_ALGO_CN_LITE)
endif()
if (NOT WITH_SUMO)
add_definitions(/DXMRIG_NO_SUMO)
if (WITH_CN_HEAVY)
add_definitions(/DXMRIG_ALGO_CN_HEAVY)
endif()
if (NOT WITH_IPBC)
add_definitions(/DXMRIG_NO_IPBC)
endif()
if (NOT WITH_CN_PICO)
add_definitions(/DXMRIG_NO_CN_PICO)
if (WITH_CN_PICO)
add_definitions(/DXMRIG_ALGO_CN_PICO)
endif()
if (WITH_EMBEDDED_CONFIG)

View file

@ -16,8 +16,10 @@ if (WITH_CN_GPU AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set_source_files_properties(src/crypto/cn/gpu/cn_gpu_avx.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX")
endif()
endif()
add_definitions(/DXMRIG_ALGO_CN_GPU)
else()
set(CN_GPU_SOURCES "")
add_definitions(/DXMRIG_NO_CN_GPU)
remove_definitions(/DXMRIG_ALGO_CN_GPU)
endif()

View file

@ -70,21 +70,21 @@ static AlgoData const algorithms[] = {
{ "cryptonight/zls", "cn/zls", xmrig::CRYPTONIGHT, xmrig::VARIANT_ZLS },
{ "cryptonight/double", "cn/double", xmrig::CRYPTONIGHT, xmrig::VARIANT_DOUBLE },
# ifndef XMRIG_NO_AEON
# ifdef XMRIG_ALGO_CN_LITE
{ "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
{ "cryptonight-light", "cn-light", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
{ "cryptonight-lite/0", "cn-lite/0", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 },
{ "cryptonight-lite/1", "cn-lite/1", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
# endif
# ifndef XMRIG_NO_SUMO
# ifdef XMRIG_ALGO_CN_HEAVY
{ "cryptonight-heavy", "cn-heavy", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_AUTO },
{ "cryptonight-heavy/0", "cn-heavy/0", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 },
{ "cryptonight-heavy/xhv", "cn-heavy/xhv", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_XHV },
{ "cryptonight-heavy/tube", "cn-heavy/tube", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE },
# endif
# ifndef XMRIG_NO_CN_PICO
# ifdef XMRIG_ALGO_CN_PICO
{ "cryptonight-pico/trtl", "cn-pico/trtl", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL },
{ "cryptonight-pico", "cn-pico", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL },
{ "cryptonight-turtle", "cn-trtl", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL },
@ -92,7 +92,7 @@ static AlgoData const algorithms[] = {
{ "cryptonight_turtle", "cn_turtle", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL },
# endif
# ifndef XMRIG_NO_CN_GPU
# ifdef XMRIG_ALGO_CN_GPU
{ "cryptonight/gpu", "cn/gpu", xmrig::CRYPTONIGHT, xmrig::VARIANT_GPU },
# endif
};

View file

@ -244,7 +244,7 @@ void xmrig::Config::setThreads(const rapidjson::Value &threads)
xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const
{
# ifndef XMRIG_NO_AEON
# ifdef XMRIG_ALGO_CN_LITE
if (m_algorithm.algo() == xmrig::CRYPTONIGHT_LITE) {
return getAlgoVariantLite();
}
@ -262,7 +262,7 @@ xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const
}
#ifndef XMRIG_NO_AEON
#ifdef XMRIG_ALGO_CN_LITE
xmrig::AlgoVariant xmrig::Config::getAlgoVariantLite() const
{
if (m_algoVariant <= AV_AUTO || m_algoVariant >= AV_MAX) {

View file

@ -90,7 +90,7 @@ private:
void setThreads(const rapidjson::Value &threads);
AlgoVariant getAlgoVariant() const;
# ifndef XMRIG_NO_AEON
# ifdef XMRIG_ALGO_CN_LITE
AlgoVariant getAlgoVariantLite() const;
# endif

View file

@ -37,15 +37,15 @@ Usage: " APP_ID " [OPTIONS]\n\
Options:\n\
-a, --algo=ALGO specify the algorithm to use\n\
cryptonight\n"
#ifndef XMRIG_NO_AEON
#ifdef XMRIG_ALGO_CN_LITE
"\
cryptonight-lite\n"
#endif
#ifndef XMRIG_NO_SUMO
#ifdef XMRIG_ALGO_CN_HEAVY
"\
cryptonight-heavy\n"
#endif
#ifndef XMRIG_NO_CN_PICO
#ifdef XMRIG_ALGO_CN_PICO
"\
cryptonight-pico\n"
#endif

View file

@ -284,7 +284,7 @@ static inline void cn_explode_scratchpad(const __m128i *input, __m128i *output)
}
#ifndef XMRIG_NO_CN_GPU
#ifdef XMRIG_ALGO_CN_GPU
template<xmrig::Algo ALGO, size_t MEM>
void cn_explode_scratchpad_gpu(const uint8_t *input, uint8_t *output)
{
@ -583,7 +583,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
}
#ifndef XMRIG_NO_CN_GPU
#ifdef XMRIG_ALGO_CN_GPU
template<size_t ITER, uint32_t MASK>
void cn_gpu_inner_arm(const uint8_t *spad, uint8_t *lpad);

View file

@ -272,7 +272,7 @@ const static uint8_t test_output_double[160] = {
0x5E, 0x2E, 0xC1, 0x80, 0x89, 0x39, 0xB3, 0x54, 0x39, 0x52, 0x0E, 0x69, 0x3D, 0xF6, 0xC5, 0x4A
};
#ifndef XMRIG_NO_AEON
#ifdef XMRIG_ALGO_CN_LITE
// "cn-lite/0"
const static uint8_t test_output_v0_lite[160] = {
0x36, 0x95, 0xB4, 0xB5, 0x3B, 0xB0, 0x03, 0x58, 0xB0, 0xAD, 0x38, 0xDC, 0x16, 0x0F, 0xEB, 0x9E,
@ -304,7 +304,7 @@ const static uint8_t test_output_v1_lite[160] = {
#endif
#ifndef XMRIG_NO_SUMO
#ifdef XMRIG_ALGO_CN_HEAVY
// "cn-heavy/0"
const static uint8_t test_output_v0_heavy[160] = {
0x99, 0x83, 0xF2, 0x1B, 0xDF, 0x20, 0x10, 0xA8, 0xD7, 0x07, 0xBB, 0x2F, 0x14, 0xD7, 0x86, 0x64,
@ -351,7 +351,7 @@ const static uint8_t test_output_tube_heavy[160] = {
#endif
#ifndef XMRIG_NO_CN_PICO
#ifdef XMRIG_ALGO_CN_PICO
// "cn-pico/trtl"
const static uint8_t test_output_pico_trtl[160] = {
0x08, 0xF4, 0x21, 0xD7, 0x83, 0x31, 0x17, 0x30, 0x0E, 0xDA, 0x66, 0xE9, 0x8F, 0x4A, 0x25, 0x69,
@ -368,7 +368,7 @@ const static uint8_t test_output_pico_trtl[160] = {
#endif
#ifndef XMRIG_NO_CN_GPU
#ifdef XMRIG_ALGO_CN_GPU
// "cn/gpu"
const static uint8_t test_output_gpu[160] = {
0xE5, 0x5C, 0xB2, 0x3E, 0x51, 0x64, 0x9A, 0x59, 0xB1, 0x27, 0xB9, 0x6B, 0x51, 0x5F, 0x2B, 0xF7,

View file

@ -361,7 +361,7 @@ static inline void cn_explode_scratchpad(const __m128i *input, __m128i *output)
}
#ifndef XMRIG_NO_CN_GPU
#ifdef XMRIG_ALGO_CN_GPU
template<xmrig::Algo ALGO, size_t MEM>
void cn_explode_scratchpad_gpu(const uint8_t *input, uint8_t *output)
{
@ -708,7 +708,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
}
#ifndef XMRIG_NO_CN_GPU
#ifdef XMRIG_ALGO_CN_GPU
template<size_t ITER, uint32_t MASK>
void cn_gpu_inner_avx(const uint8_t *spad, uint8_t *lpad);

View file

@ -207,7 +207,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
add_asm_func<CRYPTONIGHT, VARIANT_WOW>(asm_func_map);
add_asm_func<CRYPTONIGHT, VARIANT_4>(asm_func_map);
# ifndef XMRIG_NO_CN_PICO
# ifdef XMRIG_ALGO_CN_PICO
add_asm_func<CRYPTONIGHT_PICO, VARIANT_TRTL>(asm_func_map);
# endif
@ -321,7 +321,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TRTL
# ifndef XMRIG_NO_CN_GPU
# ifdef XMRIG_ALGO_CN_GPU
cryptonight_single_hash_gpu<CRYPTONIGHT, false, VARIANT_GPU>,
nullptr,
cryptonight_single_hash_gpu<CRYPTONIGHT, true, VARIANT_GPU>,
@ -391,7 +391,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_DOUBLE>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_DOUBLE>,
# ifndef XMRIG_NO_AEON
# ifdef XMRIG_ALGO_CN_LITE
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_0>,
@ -449,7 +449,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_DOUBLE
# endif
# ifndef XMRIG_NO_SUMO
# ifdef XMRIG_ALGO_CN_HEAVY
cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_0>,
@ -519,7 +519,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_DOUBLE
# endif
# ifndef XMRIG_NO_CN_PICO
# ifdef XMRIG_ALGO_CN_PICO
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_0
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_1
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TUBE

View file

@ -68,7 +68,7 @@ bool MultiWorker<N>::selfTest()
verify(VARIANT_ZLS, test_output_zls) &&
verify(VARIANT_DOUBLE, test_output_double);
# ifndef XMRIG_NO_CN_GPU
# ifdef XMRIG_ALGO_CN_GPU
if (!rc || N > 1) {
return rc;
}
@ -79,14 +79,14 @@ bool MultiWorker<N>::selfTest()
# endif
}
# ifndef XMRIG_NO_AEON
# ifdef XMRIG_ALGO_CN_LITE
if (m_thread->algorithm() == CRYPTONIGHT_LITE) {
return verify(VARIANT_0, test_output_v0_lite) &&
verify(VARIANT_1, test_output_v1_lite);
}
# endif
# ifndef XMRIG_NO_SUMO
# ifdef XMRIG_ALGO_CN_HEAVY
if (m_thread->algorithm() == CRYPTONIGHT_HEAVY) {
return verify(VARIANT_0, test_output_v0_heavy) &&
verify(VARIANT_XHV, test_output_xhv_heavy) &&
@ -94,7 +94,7 @@ bool MultiWorker<N>::selfTest()
}
# endif
# ifndef XMRIG_NO_CN_PICO
# ifdef XMRIG_ALGO_CN_PICO
if (m_thread->algorithm() == CRYPTONIGHT_PICO) {
return verify(VARIANT_TRTL, test_output_pico_trtl);
}