How xmrig/xmrig-amd works
Project type and purpose
• This is an open-source, high-performance Monero (XMR) miner targeting AMD GPUs via OpenCL. It provides a command-line interface (CLI), automatic GPU configuration, failover mining server support, and an HTTP API for remote control.
File structure
• Top-level files:
• CMakeLists.txt, cmake/… → build and platform configuration
• README.md, LICENSE, CHANGELOG.md
• config.json → default JSON configuration
• src/… directories (all C++ source):
• src/App*.cpp, src/Mem*.cpp, src/Summary.cpp → application entry points, platform abstractions
• src/core → Config loader, Controller orchestrator
• src/api → HTTP API server, router, network state
• src/net & src/common/net → mining-pool TCP/TLS client, job submission, strategies (failover, single-pool)
• src/amd → AMD-specific OpenCL context, kernel compilation, cache, GPU threads
• src/crypto → CryptoNight implementations (CPU asm, GPU OpenCL .cl files), soft AES, hash libraries
• src/workers → thread and worker abstractions, CPU & OpenCL worker threads, hashrate reporting
• src/base, src/common → I/O, JSON parsing (rapidjson), logging backends, filesystem watchers, argument parsing, platform utilities
• src/interfaces → core interface definitions (IConfig, IWorker, IJobResultListener, etc.)
README for additional insights
• Confirms use of OpenCL, microhttpd for HTTP API, JSON config, TLS support, NiceHash compatibility, failover pool support.
• No built-in database—configuration and state are in memory or file‐based.
Elements
• from CLI to Config Loader
• Config Loader → Controller → Modules
• Worker → Crypto Engine → OpenCL Manager / CPU Kernels → result flows back to Worker → Network Client
• HTTP API → Controller / NetworkState
• Events flow to Logger