Implemented CUDA config generation.
This commit is contained in:
parent
77d5b73724
commit
d4a3024996
16 changed files with 208 additions and 42 deletions
|
@ -22,12 +22,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_OCLCONFIG_GEN_H
|
||||
#define XMRIG_OCLCONFIG_GEN_H
|
||||
#ifndef XMRIG_CUDACONFIG_GEN_H
|
||||
#define XMRIG_CUDACONFIG_GEN_H
|
||||
|
||||
|
||||
#include "backend/common/Threads.h"
|
||||
#include "backend/cuda/CudaThreads.h"
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -36,7 +37,76 @@
|
|||
namespace xmrig {
|
||||
|
||||
|
||||
static inline size_t generate(const char *key, Threads<CudaThreads> &threads, const Algorithm &algorithm, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
if (threads.isExist(algorithm) || threads.has(key)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return threads.move(key, CudaThreads(devices, algorithm));
|
||||
}
|
||||
|
||||
|
||||
template<Algorithm::Family FAMILY>
|
||||
static inline size_t generate(Threads<CudaThreads> &, const std::vector<CudaDevice> &) { return 0; }
|
||||
|
||||
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
count += generate("cn", threads, Algorithm::CN_1, devices);
|
||||
count += generate("cn/2", threads, Algorithm::CN_2, devices);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_0)) {
|
||||
threads.disable(Algorithm::CN_0);
|
||||
count++;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
count += generate("cn/gpu", threads, Algorithm::CN_GPU, devices);
|
||||
# endif
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_LITE>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
size_t count = generate("cn-lite", threads, Algorithm::CN_LITE_1, devices);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_LITE_0)) {
|
||||
threads.disable(Algorithm::CN_LITE_0);
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_HEAVY
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_HEAVY>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
return generate("cn-heavy", threads, Algorithm::CN_HEAVY_0, devices);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_PICO
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_PICO>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_OCLCONFIG_GEN_H */
|
||||
#endif /* XMRIG_CUDACONFIG_GEN_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue