Skip to content

Instantly share code, notes, and snippets.

@asfdrwe
Created May 3, 2021 08:17
Show Gist options
  • Save asfdrwe/9bc5b447a8e2012c07ac9230b980a89f to your computer and use it in GitHub Desktop.
Save asfdrwe/9bc5b447a8e2012c07ac9230b980a89f to your computer and use it in GitHub Desktop.
M1 Mac patch for kawpowminer
diff -uNr kawpowminer/CMakeLists.txt kawpowminer-m1/CMakeLists.txt
--- kawpowminer/CMakeLists.txt 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/CMakeLists.txt 2021-05-03 14:52:37.000000000 +0900
@@ -14,8 +14,8 @@
set(HUNTER_CONFIGURATION_TYPES Release CACHE STRING "Build type of Hunter packages")
set(HUNTER_JOBS_NUMBER 6 CACHE STRING "Number of parallel builds used by Hunter")
HunterGate(
- URL "https://github.com/ruslo/hunter/archive/v0.23.214.tar.gz"
- SHA1 "e14bc153a7f16d6a5eeec845fb0283c8fad8c358"
+ URL "https://github.com/cpp-pm/hunter/archive/v0.23.295.tar.gz"
+ SHA1 "8a3447594fa5948cc7c6888dd86a9e823259c69f"
LOCAL
)
diff -uNr kawpowminer/cmake/Hunter/config.cmake kawpowminer-m1/cmake/Hunter/config.cmake
--- kawpowminer/cmake/Hunter/config.cmake 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/cmake/Hunter/config.cmake 2021-05-03 16:31:09.000000000 +0900
@@ -1,7 +1,18 @@
hunter_config(CURL VERSION ${HUNTER_CURL_VERSION} CMAKE_ARGS HTTP_ONLY=ON CMAKE_USE_OPENSSL=ON CMAKE_USE_LIBSSH2=OFF CURL_CA_PATH=none)
-hunter_config(Boost VERSION 1.70.0-p0)
+hunter_config(
+ Boost
+ URL "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz"
+ SHA1 "68be4a43b73c66370c8d3fd94723b3913217ce1b"
+)
+
+hunter_config(
+ OpenSSL
+ URL "https://www.openssl.org/source/openssl-1.1.1j.tar.gz"
+ SHA1 "04c340b086828eecff9df06dceff196790bb9268"
+ CMAKE_ARGS configure_architectures=${CMAKE_SYSTEM_PROCESSOR}
+)
hunter_config(ethash VERSION 1.0.0
URL https://github.com/RavenCommunity/cpp-kawpow/archive/1.1.0.tar.gz
SHA1 fff78f555a43900b6726c131305a71be769ef769
-)
\ No newline at end of file
+)
diff -uNr kawpowminer/kawpowminer/main.cpp kawpowminer-m1/kawpowminer/main.cpp
--- kawpowminer/kawpowminer/main.cpp 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/kawpowminer/main.cpp 2021-05-03 15:01:20.000000000 +0900
@@ -1238,7 +1238,7 @@
// Global boost's io_service
std::thread m_io_thread; // The IO service thread
boost::asio::deadline_timer m_cliDisplayTimer; // The timer which ticks display lines
- boost::asio::io_service::strand m_io_strand; // A strand to serialize posts in
+ boost::asio::io_context::strand m_io_strand; // A strand to serialize posts in
// multithreaded environment
// Physical Mining Devices descriptor
diff -uNr kawpowminer/libapicore/ApiServer.cpp kawpowminer-m1/libapicore/ApiServer.cpp
--- kawpowminer/libapicore/ApiServer.cpp 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libapicore/ApiServer.cpp 2021-05-03 15:02:01.000000000 +0900
@@ -351,7 +351,7 @@
}
ApiConnection::ApiConnection(
- boost::asio::io_service::strand& _strand, int id, bool readonly, string password)
+ boost::asio::io_context::strand& _strand, int id, bool readonly, string password)
: m_sessionId(id),
m_socket(g_io_service),
m_io_strand(_strand),
diff -uNr kawpowminer/libapicore/ApiServer.h kawpowminer-m1/libapicore/ApiServer.h
--- kawpowminer/libapicore/ApiServer.h 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libapicore/ApiServer.h 2021-05-03 15:03:29.000000000 +0900
@@ -22,7 +22,7 @@
{
public:
- ApiConnection(boost::asio::io_service::strand& _strand, int id, bool readonly, string password);
+ ApiConnection(boost::asio::io_context::strand& _strand, int id, bool readonly, string password);
~ApiConnection() = default;
@@ -57,7 +57,7 @@
int m_sessionId;
tcp::socket m_socket;
- boost::asio::io_service::strand& m_io_strand;
+ boost::asio::io_context::strand& m_io_strand;
boost::asio::streambuf m_sendBuffer;
boost::asio::streambuf m_recvBuffer;
Json::StreamWriterBuilder m_jSwBuilder;
@@ -92,6 +92,6 @@
string m_address;
uint16_t m_portnumber;
tcp::acceptor m_acceptor;
- boost::asio::io_service::strand m_io_strand;
+ boost::asio::io_context::strand m_io_strand;
std::vector<std::shared_ptr<ApiConnection>> m_sessions;
};
diff -uNr kawpowminer/libethash-cl/CLMiner.cpp kawpowminer-m1/libethash-cl/CLMiner.cpp
--- kawpowminer/libethash-cl/CLMiner.cpp 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libethash-cl/CLMiner.cpp 2021-05-03 15:33:34.000000000 +0900
@@ -475,6 +475,8 @@
platformType = ClPlatformTypeEnum::Clover;
else if (platformName == "NVIDIA CUDA")
platformType = ClPlatformTypeEnum::Nvidia;
+ else if (platformName == "Apple")
+ platformType = ClPlatformTypeEnum::Apple;
else
{
std::cerr << "Unrecognized platform " << platformName << std::endl;
@@ -529,6 +531,12 @@
uniqueId = s.str();
}
}
+ else if (clDeviceType == DeviceTypeEnum::Gpu && platformType == ClPlatformTypeEnum::Apple)
+ {
+ std::ostringstream s;
+ s << "Apple GPU " << pIdx << "." << dIdx;
+ uniqueId = s.str();
+ }
else if (clDeviceType == DeviceTypeEnum::Cpu)
{
std::ostringstream s;
@@ -644,6 +652,12 @@
m_hwmoninfo.devicePciId = m_deviceDescriptor.uniqueId;
m_hwmoninfo.deviceIndex = -1; // Will be later on mapped by nvml (see Farm() constructor)
}
+ else if (m_deviceDescriptor.clPlatformType == ClPlatformTypeEnum::Apple)
+ {
+ m_hwmoninfo.deviceType = HwMonitorInfoType::UNKNOWN;
+ m_hwmoninfo.devicePciId = m_deviceDescriptor.uniqueId;
+ m_hwmoninfo.deviceIndex = -1; // Will be later on mapped by nvml (see Farm() constructor)
+ }
else
{
// Don't know what to do with this
diff -uNr kawpowminer/libethcore/Farm.h kawpowminer-m1/libethcore/Farm.h
--- kawpowminer/libethcore/Farm.h 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libethcore/Farm.h 2021-05-03 15:05:40.000000000 +0900
@@ -279,7 +279,7 @@
CLSettings m_CLSettings; // OpenCL settings passed to CL Miner instantiator
CPSettings m_CPSettings; // CPU settings passed to CPU Miner instantiator
- boost::asio::io_service::strand m_io_strand;
+ boost::asio::io_context::strand m_io_strand;
boost::asio::deadline_timer m_collectTimer;
static const int m_collectInterval = 5000;
diff -uNr kawpowminer/libethcore/Miner.h kawpowminer-m1/libethcore/Miner.h
--- kawpowminer/libethcore/Miner.h 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libethcore/Miner.h 2021-05-03 15:23:44.000000000 +0900
@@ -81,7 +81,8 @@
Unknown,
Amd,
Clover,
- Nvidia
+ Nvidia,
+ Apple
};
enum class SolutionAccountingEnum
diff -uNr kawpowminer/libpoolprotocols/PoolManager.h kawpowminer-m1/libpoolprotocols/PoolManager.h
--- kawpowminer/libpoolprotocols/PoolManager.h 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libpoolprotocols/PoolManager.h 2021-05-03 15:06:01.000000000 +0900
@@ -83,7 +83,7 @@
WorkPackage m_currentWp;
- boost::asio::io_service::strand m_io_strand;
+ boost::asio::io_context::strand m_io_strand;
boost::asio::deadline_timer m_failovertimer;
boost::asio::deadline_timer m_submithrtimer;
diff -uNr kawpowminer/libpoolprotocols/getwork/EthGetworkClient.cpp kawpowminer-m1/libpoolprotocols/getwork/EthGetworkClient.cpp
--- kawpowminer/libpoolprotocols/getwork/EthGetworkClient.cpp 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libpoolprotocols/getwork/EthGetworkClient.cpp 2021-05-03 15:18:57.000000000 +0900
@@ -100,7 +100,7 @@
// Eventually endpoints get discarded on connection errors
m_endpoint = m_endpoints.front();
m_socket.async_connect(
- m_endpoint, m_io_strand.wrap(boost::bind(&EthGetworkClient::handle_connect, this, _1)));
+ m_endpoint, m_io_strand.wrap(boost::bind(&EthGetworkClient::handle_connect, this, boost::placeholders::_1)));
}
else
{
diff -uNr kawpowminer/libpoolprotocols/getwork/EthGetworkClient.h kawpowminer-m1/libpoolprotocols/getwork/EthGetworkClient.h
--- kawpowminer/libpoolprotocols/getwork/EthGetworkClient.h 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libpoolprotocols/getwork/EthGetworkClient.h 2021-05-03 15:06:56.000000000 +0900
@@ -49,7 +49,7 @@
std::atomic<bool> m_txPending = {false}; // Whether or not an async socket operation is pending
boost::lockfree::queue<std::string*> m_txQueue;
- boost::asio::io_service::strand m_io_strand;
+ boost::asio::io_context::strand m_io_strand;
boost::asio::ip::tcp::socket m_socket;
boost::asio::ip::tcp::resolver m_resolver;
diff -uNr kawpowminer/libpoolprotocols/stratum/EthStratumClient.h kawpowminer-m1/libpoolprotocols/stratum/EthStratumClient.h
--- kawpowminer/libpoolprotocols/stratum/EthStratumClient.h 2021-05-03 16:32:38.000000000 +0900
+++ kawpowminer-m1/libpoolprotocols/stratum/EthStratumClient.h 2021-05-03 15:07:39.000000000 +0900
@@ -124,7 +124,7 @@
std::chrono::time_point<std::chrono::steady_clock> m_current_timestamp;
boost::asio::io_service& m_io_service; // The IO service reference passed in the constructor
- boost::asio::io_service::strand m_io_strand;
+ boost::asio::io_context::strand m_io_strand;
boost::asio::ip::tcp::socket* m_socket;
std::string m_message; // The internal message string buffer
bool m_newjobprocessed = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment