Skip to content

Commit

Permalink
Merge pull request #6 from Tritonn204/dev
Browse files Browse the repository at this point in the history
Static linking re-enabled, Clang compatibility
  • Loading branch information
Tritonn204 authored Mar 11, 2024
2 parents ddb9d79 + f56473b commit 071d164
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16.3)

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_FLAGS_RELEASE "-static -O3 -fPIE -ftree-vectorize")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -m64 -O3 -pthread -Wall -Wuninitialized -fprefetch-loop-arrays -funroll-all-loops -ftree-vectorize")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -static -m64 -O3 -Wall -Wuninitialized -fprefetch-loop-arrays -funroll-all-loops -ftree-vectorize")

set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER g++)
Expand Down Expand Up @@ -106,4 +106,4 @@ endif()
if(UNIX)
target_link_libraries(${PROJECT_NAME} udns pthread)
endif()
target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json OpenSSL::SSL ${Boost_LIBRARIES} OpenSSL::Crypto)
target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
**Dependencies are as follows:**
- OpenSSL v3.0.2 (static libs)
- Boost v1.8.2 (b2 with link=static)
- GMP (with C++ support enabled)
- UDNS (UNIX only. sudo apt-get install libudns-dev)
- FMT (header only)

Expand Down
25 changes: 23 additions & 2 deletions src/astrobwtv3/pow.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,29 @@ inline void prefetch(T *data, int size, int hint) {
const size_t prefetch_distance = 256; // Prefetch 8 cache lines ahead
const size_t cache_line_size = 64; // Assuming a 64-byte cache line

for (size_t i = 0; i < size; i += prefetch_distance * cache_line_size) {
__builtin_prefetch(&data[i], 0, hint);
switch(hint) {
case 0:
for (size_t i = 0; i < size; i += prefetch_distance * cache_line_size) {
__builtin_prefetch(&data[i], 0, 0);
}
break;
case 1:
for (size_t i = 0; i < size; i += prefetch_distance * cache_line_size) {
__builtin_prefetch(&data[i], 0, 1);
}
break;
case 2:
for (size_t i = 0; i < size; i += prefetch_distance * cache_line_size) {
__builtin_prefetch(&data[i], 0, 2);
}
break;
case 3:
for (size_t i = 0; i < size; i += prefetch_distance * cache_line_size) {
__builtin_prefetch(&data[i], 0, 3);
}
break;
default:
break;
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/miner/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
//------------------------------------------------------------------------------

#define FMT_HEADER_ONLY
#define BOOST_ASIO_DISABLE_CONCEPTS


#include "rootcert.h"

Expand Down Expand Up @@ -65,6 +67,7 @@
#define THREAD_PRIORITY_TIME_CRITICAL -20
#endif


#if defined(_WIN32)
LPTSTR lpNxtPage; // Address of the next page to ask for
DWORD dwPages = 0; // Count of pages gotten so far
Expand Down

0 comments on commit 071d164

Please sign in to comment.