From a4bac9f551f4338716ffd20c591f4cf92b406100 Mon Sep 17 00:00:00 2001 From: Harold Brenes Date: Thu, 30 Sep 2021 18:11:13 -0500 Subject: [PATCH 1/3] Working on switching over to a CMake-based build and adding Windows support (#98) - Switched to CMake-based config and removed legacy build system. - Added Windows support. - Tracking latest bls-signatures version. - Updated README with new build instructions. - Updated LICESNE copyrights. --- .gitignore | 3 +- .gitmodules | 4 - .vscode/c_cpp_properties.json | 1698 +---------------- .vscode/launch.json | 140 +- .vscode/settings.json | 3 +- .vscode/tasks.json | 143 +- CMakeLists.txt | 311 +++ LICENSE | 2 +- Makefile | 192 -- README.md | 71 +- bladebit.natvis | 8 +- bladebit.sln | 33 - bladebit.vcxproj | 491 ----- bladebit.vcxproj.filters | 615 ------ build-bls | 63 - builds/linux/debug.arm.mk | 45 - builds/linux/debug.arm.test.mk | 45 - builds/linux/debug.mk | 48 - builds/linux/debug.test.mk | 50 - builds/linux/release.arm.mk | 45 - builds/linux/release.arm.test.mk | 45 - builds/linux/release.mk | 48 - builds/linux/release.test.mk | 50 - builds/macos/debug.arm.mk | 44 - builds/macos/debug.arm.test.mk | 44 - builds/macos/debug.mk | 47 - builds/macos/debug.test.mk | 49 - builds/macos/release.arm.mk | 44 - builds/macos/release.arm.test.mk | 44 - builds/macos/release.mk | 47 - builds/macos/release.test.mk | 49 - builds/win32/debug.arm.mk | 49 - builds/win32/debug.arm.test.mk | 49 - builds/win32/debug.mk | 52 - builds/win32/debug.test.mk | 54 - builds/win32/release.arm.mk | 49 - builds/win32/release.arm.test.mk | 49 - builds/win32/release.mk | 52 - builds/win32/release.test.mk | 54 - cmake_modules/FindNUMA.cmake | 24 + lib/.gitkeep | 0 modules/.gitkeep | 0 modules/bls-signatures | 1 - project.js | 172 -- src/ChiaConsts.h | 2 +- src/Globals.h | 2 +- src/Platform.h | 4 +- src/PlotWriter.cpp | 2 +- src/SysHost.h | 11 +- src/Types.h | 16 +- src/Util.cpp | 27 +- src/Util.h | 9 +- src/bech32/segwit_addr.c | 4 +- src/io/FileStream.h | 24 +- src/main.cpp | 26 +- src/memplot/DbgHelper.cpp | 6 +- src/memplot/DbgHelper.h | 46 +- src/memplot/FxSort.h | 4 +- src/memplot/MemPhase1.cpp | 26 +- src/memplot/MemPhase3.cpp | 2 +- src/memplot/MemPlotter.cpp | 9 +- src/platform/linux/SysHost_Linux.cpp | 86 +- .../unix/Thread_Unix.cpp} | 79 +- src/platform/win32/FileStream_Win32.cpp | 416 ++++ src/platform/win32/SysHost_Win32.cpp | 449 ++++- src/platform/win32/Thread_Win32.cpp | 127 ++ src/test/test_numa_sort.cpp | 12 +- src/threading/Semaphore.cpp | 33 +- src/threading/Semaphore.h | 5 + src/threading/Thread.h | 11 +- sync | 31 - 71 files changed, 1682 insertions(+), 4913 deletions(-) delete mode 100644 .gitmodules create mode 100644 CMakeLists.txt delete mode 100644 Makefile delete mode 100644 bladebit.sln delete mode 100644 bladebit.vcxproj delete mode 100644 bladebit.vcxproj.filters delete mode 100755 build-bls delete mode 100644 builds/linux/debug.arm.mk delete mode 100644 builds/linux/debug.arm.test.mk delete mode 100644 builds/linux/debug.mk delete mode 100644 builds/linux/debug.test.mk delete mode 100644 builds/linux/release.arm.mk delete mode 100644 builds/linux/release.arm.test.mk delete mode 100644 builds/linux/release.mk delete mode 100644 builds/linux/release.test.mk delete mode 100644 builds/macos/debug.arm.mk delete mode 100644 builds/macos/debug.arm.test.mk delete mode 100644 builds/macos/debug.mk delete mode 100644 builds/macos/debug.test.mk delete mode 100644 builds/macos/release.arm.mk delete mode 100644 builds/macos/release.arm.test.mk delete mode 100644 builds/macos/release.mk delete mode 100644 builds/macos/release.test.mk delete mode 100644 builds/win32/debug.arm.mk delete mode 100644 builds/win32/debug.arm.test.mk delete mode 100644 builds/win32/debug.mk delete mode 100644 builds/win32/debug.test.mk delete mode 100644 builds/win32/release.arm.mk delete mode 100644 builds/win32/release.arm.test.mk delete mode 100644 builds/win32/release.mk delete mode 100644 builds/win32/release.test.mk create mode 100644 cmake_modules/FindNUMA.cmake delete mode 100644 lib/.gitkeep delete mode 100644 modules/.gitkeep delete mode 160000 modules/bls-signatures delete mode 100644 project.js rename src/{threading/Thread.cpp => platform/unix/Thread_Unix.cpp} (80%) create mode 100644 src/platform/win32/FileStream_Win32.cpp create mode 100644 src/platform/win32/Thread_Win32.cpp delete mode 100755 sync diff --git a/.gitignore b/.gitignore index 2a095e95..2b57b132 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ dist/ *.log park*_hash.txt -lib/* \ No newline at end of file +lib/* +build/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 20a3e3d7..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "modules/bls-signatures"] - path = modules/bls-signatures - url = https://github.com/harold-b/bls-signatures.git - branch = bladebit diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index ae9c246a..a6220f2e 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,1697 +1,25 @@ { - "version": 4, - "env": { - "cStandard": "c11", - "cppStandard": "c++17", - "winSdk": "10.0.17134.0", - "cxx-win32": "Set me to the path to the compiler", - "inteli-win32": "msvc-x64", - "compilerArgs": [], - "forcedIncludes": [ - "src/pch.h" - ], - "cxx-linux": "/usr/bin/g++", - "inteli-linux": "linux-gcc-arm64", - "cxx-macos": "/usr/bin/clang++", - "inteli-macos": "macos-clang-arm64" - }, "configurations": [ { - "name": "chia32x.linux.release", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.debug", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "configurationProvider": "ms-vscode.makefile-tools" - }, - { - "name": "chia32x.win32.release", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.debug", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.debug.arm", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.release.arm", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.linux.debug.arm", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.release.arm", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.release", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.debug", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.debug.arm", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.release.arm", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.win32.debug.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.release.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.debug.arm.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.release.arm.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.linux.debug.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.release.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.debug.arm.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.release.arm.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.debug.test", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.release.test", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.debug.arm.test", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.release.arm.test", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.win32.licgen.debug", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "GEN_LICENSE=1", - "READ_LICENSE=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.licgen.release", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "GEN_LICENSE=1", - "READ_LICENSE=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.release.priv", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.debug.priv", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.release.arm.priv", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.win32.debug.arm.priv", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "chia32x.linux.licgen.debug", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "GEN_LICENSE=1", - "READ_LICENSE=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.licgen.release", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "GEN_LICENSE=1", - "READ_LICENSE=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.release.priv", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.debug.priv", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.release.arm.priv", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.linux.debug.arm.priv", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.licgen.debug", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "GEN_LICENSE=1", - "READ_LICENSE=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.licgen.release", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "GEN_LICENSE=1", - "READ_LICENSE=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.release.priv", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.debug.priv", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.release.arm.priv", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "chia32x.macos.debug.arm.priv", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1", - "READ_LICENSE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.win32.release", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.win32.debug", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.win32.debug.arm", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.win32.release.arm", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.win32.debug.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.win32.release.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.win32.debug.arm.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.win32.release.arm.test", - "compilerPath": "Set me to the path to the compiler", - "defines": [ - "_HAS_STD_BYTE=0", - "_WIN32=1", - "WIN32=1", - "WIN32_LEAN_AND_MEAN=1", - "UNICODE=1", - "NOMINMAX=1", - "_CRT_SECURE_NO_WARNINGS=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "msvc-x64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ], - "windowsSdkVersion": "10.0.17134.0" - }, - { - "name": "bladebit.linux.release", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.linux.debug", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.linux.debug.arm", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.linux.release.arm", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.linux.debug.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.linux.release.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.linux.debug.arm.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.linux.release.arm.test", - "compilerPath": "/usr/bin/g++", - "defines": [ - "_HAS_STD_BYTE=0", - "_GNU_SOURCE=1", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "linux-gcc-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.release", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.debug", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.debug.arm", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.release.arm", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.debug.test", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.release.test", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" - ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.debug.arm.test", - "compilerPath": "/usr/bin/clang++", - "defines": [ - "_HAS_STD_BYTE=0", - "DEBUG=1", - "_DEBUG=1", - "TEST_MODE=1" - ], + "name": "Win32", "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" + "${workspaceFolder}/**" ], - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ - "src/pch.h" - ] - }, - { - "name": "bladebit.macos.release.arm.test", - "compilerPath": "/usr/bin/clang++", "defines": [ - "_HAS_STD_BYTE=0", - "NDEBUG=1", - "_NDEBUG=1", - "TEST_MODE=1" - ], - "includePath": [ - "${workspaceFolder}/include", - "${workspaceFolder}/lib/include", - "${workspaceFolder}/lib/include/relic", - "${workspaceFolder}/src" + "_DEBUG", + "UNICODE", + "_UNICODE" ], - "cStandard": "c11", + "windowsSdkVersion": "10.0.19041.0", + "compilerPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx64\\x64\\cl.exe", + "cStandard": "c17", "cppStandard": "c++17", - "intelliSenseMode": "macos-clang-arm64", - "compilerArgs": [], - "forcedInclude": [ + "intelliSenseMode": "windows-msvc-x64", + "configurationProvider": "ms-vscode.cmake-tools" + ,"forcedInclude": [ "src/pch.h" ] } - ] + ], + "version": 4 } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 6ce9f8f8..07218318 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,142 +5,38 @@ "version": "0.2.0", "configurations": [ { - "name": "Debug Arm64", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.bin/debug.arm/bladebit", - "args": [ - "-f" , "ade0cc43610ce7540ab96a524d0ab17f5df7866ef13d1221a7203e5d10ad2a4ae37f7b73f6cdfd6ddf4122e8a1c2f8ef" - ,"-p", "80a836a74b077cabaca7a76d1c3c9f269f7f3a8f2fa196a65ee8953eb81274eb8b7328d474982617af5a0fe71b47e9b8" - // ,"-c", "" - // ,"-w" - ,"-n", "2" - ,"-v" - // ,".sandbox" - ,"/home/harito/data" - ], + "name" : "BladeBit", + "request" : "launch", + "type" : "cppvsdbg", "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, + "cwd" : "${workspaceFolder}", + // "console" : "externalTerminal", - "linux": { - "MIMode": "gdb", - "miDebuggerPath": "/usr/bin/gdb" - }, + "preLaunchTask": "build_debug", - "osx": { - "MIMode": "lldb" + "console": "internalConsole", + "windows": { + "program": "${workspaceFolder}/build/debug/bladebit.exe" }, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "preLaunchTask": "build_debug_arm" - }, - - { - "name": "Test Arm64", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.bin/debug.arm.test/bladebit", - "args": [ - "-s" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, - "linux": { - "MIMode": "gdb", - "miDebuggerPath": "/usr/bin/gdb" + "program": "${workspaceFolder}/build/debug/bladebit" }, "osx": { - "MIMode": "lldb" + "program": "${workspaceFolder}/build/debug/bladebit" }, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "preLaunchTask": "build_arm_debug_test" - }, - - // x86 Debug - { - "name": "Debug x86", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.bin/debug/bladebit", - "args": [ - "-f" , "ade0cc43610ce7540ab96a524d0ab17f5df7866ef13d1221a7203e5d10ad2a4ae37f7b73f6cdfd6ddf4122e8a1c2f8ef" - ,"-p", "80a836a74b077cabaca7a76d1c3c9f269f7f3a8f2fa196a65ee8953eb81274eb8b7328d474982617af5a0fe71b47e9b8" - // ,"-i", "d1476057a46d887f6770ee1c435049853a60ca6352206799b0a27a49670bb192" - // ,"-w" - // ,"-t", "48" - , "/home/harito/data" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "preLaunchTask": "build_debug", - "miDebuggerPath": "/usr/bin/gdb" - }, - // x86 Test - { - "name": "Debug x86 - Test", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.bin/debug.test/bladebit", "args": [ - // "-f" , "ade0cc43610ce7540ab96a524d0ab17f5df7866ef13d1221a7203e5d10ad2a4ae37f7b73f6cdfd6ddf4122e8a1c2f8ef" - // ,"-p", "80a836a74b077cabaca7a76d1c3c9f269f7f3a8f2fa196a65ee8953eb81274eb8b7328d474982617af5a0fe71b47e9b8" - // , ".sandbox" - "-c", "8" - // ,"-o" - // ,"-t", "32" - - ], - - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - // { - // "description": "Set scheduler locking to step", - // "ignoreFailures": false, - // "text": "set scheduler-locking step" - // }, - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "preLaunchTask": "build_debug_test", - "miDebuggerPath": "/usr/bin/gdb" + "-f", "ade0cc43610ce7540ab96a524d0ab17f5df7866ef13d1221a7203e5d10ad2a4ae37f7b73f6cdfd6ddf4122e8a1c2f8ef", + "-p", "80a836a74b077cabaca7a76d1c3c9f269f7f3a8f2fa196a65ee8953eb81274eb8b7328d474982617af5a0fe71b47e9b8", + "-n", "2", + "-w", + "-v", + "${workspaceFolder}/.sandbox" + ] } - ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index fc7a3bc7..5a297bd9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -104,5 +104,6 @@ "cSpell.words": [ "Ryzen" ], - "C_Cpp.errorSquiggles": "Enabled" + "C_Cpp.errorSquiggles": "Enabled", + "cmake.configureOnOpen": true } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 85f9e286..56a09c8a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,156 +2,45 @@ "version": "2.0.0", "tasks": [ { - "type": "shell", - "label": "build_debug_arm", + "type" : "shell", + "label" : "build_debug", + "detail": "Build Debug BladeBit", - "linux":{ - "command": "/usr/bin/bash", - "args": [ - "-c", - "make clean && make CONFIG=debug.arm -j64" - ], - }, - - "osx":{ - "command": "/bin/bash", + "windows":{ + "command": "cmake", "args": [ - "-c", - "make CONFIG=debug.arm -j8" - ], + "--build", ".", + "--target", "bladebit", + "--config", "Debug" + ] }, - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "detail": "Build Debug ARM64" - }, - - { - "type": "shell", - "label": "build_arm_debug_test", - "linux":{ "command": "/usr/bin/bash", "args": [ "-c", - "make clean && make CONFIG=debug.arm.test -j64" + "make clean && make CONFIG=debug.arm -j64" ], + "problemMatcher": [ "$gcc" ] }, "osx":{ "command": "/bin/bash", "args": [ "-c", - "make CONFIG=debug.arm.test -j8" + "make CONFIG=debug.arm -j8" ], + "problemMatcher": [ "$gcc" ] }, "options": { - "cwd": "${workspaceFolder}" + "cwd": "${workspaceFolder}/build" }, - "problemMatcher": [ - "$gcc" - ], + "group": { "kind": "build", "isDefault": true - }, - "detail": "Build DebugTest ARM64" - }, - - - { - "type": "shell", - "label": "build_debug", - "command": "/usr/bin/bash", - "args": [ - "-c", - "make clean && make CONFIG=debug -j24" - ], - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": false - }, - "detail": "Build Debug" - } - - ,{ - "type": "shell", - "label": "build_debug_test", - "command": "/usr/bin/bash", - "args": [ - "-c", - "make clean && make CONFIG=debug.test -j24" - ], - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": false - }, - "detail": "Build Debug Test" - } - - // Debug priv - ,{ - "label": "build_debug_priv", - "type": "shell", - "command": "/usr/bin/bash", - "args": [ - "-c", - "make clean && make CONFIG=debug.priv -j24" - ], - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": false - }, - "detail": "Build Debug Priv" - } - - // Licgen - ,{ - "label": "build_debug_licgen", - "type": "shell", - "command": "/usr/bin/bash", - "args": [ - "-c", - "make clean && make CONFIG=licgen.debug -j24" - ], - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": false - }, - "detail": "Build Debug Licgen" + } } ] } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..1a0ed2c3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,311 @@ +cmake_minimum_required(VERSION 3.14 FATAL_ERROR) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_CONFIGURATION_TYPES Release Debug) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" + CACHE STRING "Possible values are: Release, Debug" + FORCE + ) +endif() +message("Config: ${CMAKE_BUILD_TYPE}") + +project(bladebit) + + +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules +) + +# Grab BLS +include(FetchContent) + +FetchContent_Declare( + bls + GIT_REPOSITORY https://github.com/Chia-Network/bls-signatures.git + GIT_TAG 1.0.6 +) + +set(BUILD_BLS_PYTHON_BINDINGS "0" CACHE STRING "0") +set(BUILD_BLS_TESTS "0" CACHE STRING "") +set(BUILD_BLS_BENCHMARKS "0" CACHE STRING "") +FetchContent_MakeAvailable(bls) + +# Config +set(CMAKE_C_FLAGS_RELEASE_INIT) +set(CMAKE_C_FLAGS_DEBUG_INIT) +set(CMAKE_CXX_FLAGS_RELEASE_INIT) +set(CMAKE_CXX_FLAGS_DEBUG_INIT) + + +set(c_opts) +set(link_opts) + +set(release_c_opts) +set(debug_c_opts) +set(dev_c_opts) + +set(release_link_opts) +set(debug_link_opts) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + + # MSVC + set(c_opts + /std:c++17 + /Zc:__cplusplus + /MP + /Zi + # /EHsc- + # /Wall + /W3 + /WX + /FIpch.h + /wd4068 + /wd4464 + /wd4668 + /wd4820 + /wd4514 + /wd4626 + /wd5027 + /DUNICODE=1 + /DWIN32_LEAN_AND_MEAN=1 + /DNOMINMAX=1 + /D_CRT_SECURE_NO_WARNINGS=1 + /D_HAS_EXCEPTIONS=0 + ${c_opts}) + + set(link_opts + /SUBSYSTEM:CONSOLE + /STACK:33554432,1048576 + ${link_opts}) + + set(release_c_opts + /MT + /Oi + /O2 + /Gy + /GL + /DNDEBUG=1 + /D_NDEBUG=1 + ${release_c_opts}) + + set(debug_c_opts + /MTd + /Od + /DDEBUG=1 + /D_DEBUG=1 + ${debug_c_opts}) + + set(dev_c_opts + ${dev_c_opts}) + + + set(release_link_opts + /DEBUG:FULL + /LTCG + /OPT:REF,ICF,LBR + ${release_link_opts}) + + set(debug_link_opts + /DEBUG:FASTLINK + /OPT:NOREF,NOICF,NOLBR + /INCREMENTAL + ${debug_link_opts}) + + # Dependency config + target_compile_options(bls PRIVATE /MP) + target_compile_options(relic_s PRIVATE /MP) + target_compile_options(sodium PRIVATE /MP) + + target_compile_options(bls PRIVATE $<$:/MT>) + target_compile_options(relic_s PRIVATE $<$:/MT>) + target_compile_options(sodium PRIVATE $<$:/MT>) + + target_compile_options(bls PRIVATE $<$:/MTd>) + target_compile_options(relic_s PRIVATE $<$:/MTd>) + target_compile_options(sodium PRIVATE $<$:/MTd>) + +else() + + # *Nix + set(c_opts --include=pch.h -march=native -Wall -Wno-comment -Wno-unknown-pragmas -g ${c_opts}) + + set(release_c_opts + -O3 -flto + -D_NDEBUG=1 + -DNDEBUG=1 + ${release_c_opts}) + + set(debug_c_opts + -O0 + -DDEBUG=1 + -D_DEBUG=1 + ${debug_c_opts}) + + set(dev_c_opts + ${dev_c_opts}) + + # GCC + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + + set(c_opts -fmax-errors=5 ${c_opts}) + + # Clang + elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + + set(c_opts_FLAGS -ferror-limit=5 -fdeclspec -Wunknown-pragmas ${c_opts}) + + endif() + +endif() + + +# Main Sources +file(GLOB_RECURSE bb_sources + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS + LIST_DIRECTORIES false + src/*.cpp + src/*.c +) + +# Headers +file(GLOB_RECURSE bb_headers + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS + LIST_DIRECTORIES false + src/*.h + src/*.hpp + src/*.inl +) + +# Configure dependent on config/platform/architecture +list(FILTER bb_sources EXCLUDE REGEX "src/main\.cpp") +list(FILTER bb_sources EXCLUDE REGEX "src/(test|platform)/.+") +list(FILTER bb_sources EXCLUDE REGEX "src/b3/blake3_(avx|sse).+") + +# Architecture +if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64" OR ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64") + + if(NOT MSVC) + + list(APPEND bb_sources + src/b3/blake3_avx2_x86-64_unix.S + src/b3/blake3_avx512_x86-64_unix.S + src/b3/blake3_sse41_x86-64_unix.S + ) + + set_source_files_properties( + src/b3/blake3_avx2_x86-64_unix.S + src/b3/blake3_avx512_x86-64_unix.S + src/b3/blake3_sse41_x86-64_unix.S + PROPERTIES LANGUAGE C) + else() + list(APPEND bb_sources + src/b3/blake3_avx2.c + src/b3/blake3_avx512.c + src/b3/blake3_sse41.c + ) + # Disable blake3 convertion loss of data warnings + set_source_files_properties( + src/b3/blake3_avx2.c + src/b3/blake3_avx512.c + src/b3/blake3_sse41.c + PROPERTIES COMPILE_FLAGS + /wd4244 + ) + endif() + +elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64" OR ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "aarch64") +else() + message( FATAL_ERROR "Unsupported architecture '${CMAKE_HOST_SYSTEM_PROCESSOR}'" ) +endif() + +# OS +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + + file(GLOB_RECURSE src_linux RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS LIST_DIRECTORIES false + src/platform/unix/*.cpp + src/platform/linux/*.cpp + ) + list(APPEND bb_sources ${src_linux}) + +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + + file(GLOB_RECURSE src_win RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS LIST_DIRECTORIES false + src/platform/win32/*.cpp + ) + list(APPEND bb_sources ${src_win}) + +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + + file(GLOB_RECURSE src_mac RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS LIST_DIRECTORIES false + src/platform/unix/*.cpp + src/platform/macos/*.cpp + ) + list(APPEND bb_sources ${src_mac}) + +else() + message( FATAL_ERROR "Unsupported operating system '${CMAKE_SYSTEM_NAME}'" ) +endif() + +# Dev config? +file(GLOB_RECURSE src_dev RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS LIST_DIRECTORIES false + src/test/*.cpp +) + +file(GLOB_RECURSE headers_dev RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS LIST_DIRECTORIES false + src/test/*.h +) + + +# Exe +find_package(Threads REQUIRED) + +set(platform_libs) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + find_package(NUMA REQUIRED) + set(platform_libs ${NUMA_LIBRARY} gmp) +endif() + +set(bb_include_dirs + ${INCLUDE_DIRECTORIES} + ${CMAKE_CURRENT_SOURCE_DIR}/src +) + + +# BladeBit +add_executable(bladebit src/main.cpp ${bb_sources} ${bb_headers}) +add_executable(bladebit_dev EXCLUDE_FROM_ALL src/test/test_main.cpp ${bb_sources} ${src_dev} ${bb_headers} ${headers_dev}) + +macro(config_proj tgt) + + target_compile_options(${tgt} PRIVATE $<$:${c_opts} ${release_c_opts}>) + target_compile_options(${tgt} PRIVATE $<$:${c_opts} ${debug_c_opts}>) + target_link_options(${tgt} PRIVATE $<$:${link_opts} ${release_link_opts}>) + target_link_options(${tgt} PRIVATE $<$:${link_opts} ${debug_link_opts}>) + + target_include_directories(${tgt} PRIVATE ${bb_include_dirs}) + target_link_libraries(${tgt} Threads::Threads bls ${platform_libs}) +endmacro() + +config_proj(bladebit) +config_proj(bladebit_dev) + + +# Pretty source view for IDE projects +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src + FILES ${bb_sources} ${bb_headers} ${src_dev} ${headers_dev} +) + diff --git a/LICENSE b/LICENSE index 21b3317b..1f11ebce 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2021 Harold Brenes + Copyright 2021 Harold Brenes, Chia Network Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Makefile b/Makefile deleted file mode 100644 index 5f72c253..00000000 --- a/Makefile +++ /dev/null @@ -1,192 +0,0 @@ -# Usage: make -j<#threads> CONFIG= - -# -------------------------------------------------------- -# Public Config -# -------------------------------------------------------- -CC := gcc -CXX := g++ -AR := ar - -PLATFORM := linux -CONFIG := release -VERBOSE := 0 - -OBJ_DIR := .obj -OBJ_EXT := o -OUT_DIR := .bin -OUT_NAME := bladebit -Q := @ - -PCH := src/pch.h - -is_release := -is_arm := - -# Detect platform -ifeq ($(OS),Windows_NT) - PLATFORM := win32 -else - UNAME := $(shell uname -s) - - ifeq ($(UNAME),Linux) - PLATFORM := linux - endif - - ifeq ($(UNAME),Darwin) - PLATFORM := macos - endif -endif - -LDFLAGS := -pthread \ - -Llib \ - -lbls \ - -lnuma - - -# Is it release or debug? -ifneq (,$(findstring release,$(CONFIG))) - is_release := 1 -endif - -ifneq (,$(findstring arm,$(CONFIG))) - is_arm := 1 -endif - -# Platform-specific configs -ifeq ($(PLATFORM),macos) - CC := clang - CXX := clang++ - - LDFLAGS += -Llib/macos -endif - -ifeq ($(PLATFORM),linux) - ifeq ($(is_arm),1) - LDFLAGS += -Llib/linux/arm - else - LDFLAGS += -Llib/linux/x86 - endif -endif - -CFLAGS := \ - -Wall \ - -Wno-comment - -CXXFLAGS := \ - -std=c++17 - - -# GCC or Clang? -ifneq (,$(findstring gcc,$(CC))) - CFLAGS += \ - -fmax-errors=5 -endif - -ifneq (,$(findstring clang,$(CC))) - CFLAGS += \ - -ferror-limit=5 \ - -fdeclspec \ - -fno-exceptions \ - -Wunknown-pragmas -endif - -# For ARM -ifeq ($(is_arm),1) -# CFLAGS += -mfpu=neon-vfpv4 -else -endif - - - -# Include precompiled header in all compilation units -ifneq ($(PCH),) - CFLAGS += --include=$(PCH) -endif - -# -------------------------------------------------------- -# Private Config -# -------------------------------------------------------- -SOURCES := -SRC_ROOT := src -OPT_FLAGS := - - -ifeq ($(is_release),1) - OPT_FLAGS := -O3 -flto -g -else - OPT_FLAGS := -O0 -g -endif - -CFLAGS += $(OPT_FLAGS) - -ifneq ($(VERBOSE),0) - Q := -endif - - -# Include config vars -include builds/$(PLATFORM)/$(CONFIG).mk - -# -# prepare sources and objects -# - -sources = $(SOURCES) - -objects := $(sources:$(SRC_ROOT)/%=$(OBJ_DIR)/%) -objects := $(objects:.cpp=.$(OBJ_EXT)) -objects := $(objects:.c=.$(OBJ_EXT)) -objects := $(objects:.S=.$(OBJ_EXT)) - -# -------------------------------------------------------- -# Targets -# -------------------------------------------------------- -.PHONY: clean compile bladebit lib - -default: bladebit - -# static library -lib: compile - @mkdir -p $(OUT_DIR)/$(CONFIG) - $(Q)$(AR) rc $(OUT_DIR)/$(CONFIG)/lib$(OUT_NAME).a $(objects) - - -# make exe -bladebit: compile - @mkdir -p $(OUT_DIR)/$(CONFIG) - $(Q)$(CXX) $(OPT_FLAGS) $(objects) -o $(OUT_DIR)/$(CONFIG)/$(OUT_NAME) $(LDFLAGS) - @objcopy --only-keep-debug $(OUT_DIR)/$(CONFIG)/$(OUT_NAME) $(OUT_DIR)/$(CONFIG)/$(OUT_NAME).debug - @strip --strip-debug --strip-unneeded $(OUT_DIR)/$(CONFIG)/$(OUT_NAME) - @objcopy --add-gnu-debuglink="$(OUT_DIR)/$(CONFIG)/$(OUT_NAME).debug" $(OUT_DIR)/$(CONFIG)/$(OUT_NAME) - -# compile sources -compile: info $(objects) - -info: - @echo "Compiling for $(PLATFORM) with $(CXX)" -# @echo $(objects) -clean: - @rm -rf $(OBJ_DIR) - @rm -rf $(OUT_DIR) - -# Compile ASM -$(OBJ_DIR)/%.$(OBJ_EXT): $(SRC_ROOT)/%.S - @echo $< - @mkdir -p $(@D) - $(Q)$(CC) $(CFLAGS) -c $< -o $@ - $(Q)$(CC) $(CFLAGS) -c $< -MM -MT $(@D)/$(*F).o -o $(@D)/$(*F).d - -# Compile C -$(OBJ_DIR)/%.$(OBJ_EXT): $(SRC_ROOT)/%.c - @echo $< - @mkdir -p $(@D) - $(Q)$(CC) $(CFLAGS) -c $< -o $@ - $(Q)$(CC) $(CFLAGS) -c $< -MM -MT $(@D)/$(*F).o -o $(@D)/$(*F).d - -# Compile C++ -$(OBJ_DIR)/%.$(OBJ_EXT): $(SRC_ROOT)/%.cpp - @echo $< - @mkdir -p $(@D) - $(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) -c $< -o $@ - $(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) -c $< -MM -MT $(@D)/$(*F).o -o $(@D)/$(*F).d - diff --git a/README.md b/README.md index e9ed205b..e6194976 100644 --- a/README.md +++ b/README.md @@ -5,70 +5,61 @@ A fast **RAM-only**, **k32-only**, Chia plotter. ## Requirements **416 GiB of RAM are required** to run it, plus a few more megabytes for stack space and small allocations. -## Building - -### Prerequisites -This repository depends on Chia's [bls-signatures](https://github.com/Chia-Network/bls-signatures) repository to generate keys and plot ids, which requires [Cmake](https://cmake.org/). At the time of this writing **Cmake 3.14+** is required by bls-signatures. See the repository for any updated build instructions. - 64-bit is supported only, for obvious reasons. -Only Linux is currently completed. There are several platform abstractions misisng for macOS and Windows. -**Linux** -> *NOTE: Some repositories may have cmake versions not compatible with BLS, in which case you would have to build & install Cmake yourself.* +## Prerequisites +Only **Linux** & **Windows** are supported. +### Linux + +Install the following packages: ```bash # CentOS or Amazon Linux sudo yum group install -y "Development Tools" -sudo yum install -y cmake numactl-devel +sudo yum install -y cmake gmp-devel numactl-devel -# Ubuntu -sudo apt install -y build-essential -sudo apt install -y cmake libnuma-dev +# Ubuntu or Debian-based +sudo apt install -y build-essential cmake libgmp-dev libnuma-dev ``` +### Windows +Must have [Visual Studio 2019](https://visualstudio.microsoft.com/vs/) or its build tools installed. -### Build - -> *NOTE: BLS/Relic seems to be incompatible with some versiong of GCC* - +## Building -Install pre-requisites then run: -**Linux** +### Linux ```bash -# Clone the repo & its submodules -git clone --recursive https://github.com/harold-b/bladebit.git && cd bladebit -# Build bls library. Only needs to be done once. -./build-bls +# Clone the repo & its submodules +git clone && cd bladebit -# For x86 -make clean && make -j$(nproc --all) +# Create a build directory for cmake and cd into it +mkdir -p build && cd build -# For ARM -make clean && make -j$(nproc --all) CONFIG=release.arm +# Generate config files & build +cmake .. +cmake --build . --target bladebit --config Release ``` -The resulting binary will be found at `.bin/release/bladebit` for **x86** or `.bin/release.arm/bladebit` for **ARM**. +The resulting binary will be found under the `build/` directory. +On Windows it will be under `build/Release/`. ## Usage -Run **bladebit** with the `-h` for usage and command line options. +Run **bladebit** with the `-h` for complete usage and command line options: ```bash -# x86 -.bin/release/bladebit -h +# Linux +build/bladebit -h -# ARM -.bin/release.arm/bladebit -h +# Windows +build/Release/bladebit.exe -h ``` ## License Licensed under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0). See [LICENSE](LICENSE). -## Build Tools -This project synchronizes Makefiles, VS project files and VS Code c_cpp_properties.json files by a custom tool called psync which is not currently published. I created the tool a while back for cross-platform game engine development and it is scrappy-ly coded and unclean. At some point I will publish it to facilitate development. - # Other Details @@ -77,18 +68,18 @@ Writes to disk only occur to the final plot file, and it is done sequentially, u ## Pool Plots -Pool plots have been implemented and plot id and plot memo generation tested against the chia-blockchain implementation, where it generates the exact data. More testing from the community is required to verify that the plots are properly operating with pools. +Pool plots are fully supported and tested against the chia-blockchain implementation. The community has also verified that pool plots are working properly and winning proofs with them. ## NUMA systems -Memory is bound on interleaved mode for NUMA systems which currently gives the best performance on systems with several nodes. This can be disabled with with the `-m or --no-numa` switch. +Memory is bound on interleaved mode for NUMA systems which currently gives the best performance on systems with several nodes. This is the default behavior on NUMA systems, it can be disabled with with the `-m or --no-numa` switch. ## Huge TLBs This is not supported yet. Some folks have reported some gains when using huge page sizes. Although this was something I wanted to test, I focused first instead on things that did not necessarily depended on system config. But I'd like to add support for it in the future (trivial from the development point of view, I have just not configured the test system with huge page sizes). -## Other Optimizations -Memory accesses are pretty tight. So some spots are saturated, and completely memory bound. That is, the CPU is already completely saturated, and won't be able to do more unless access to memory is faster. However, there are more pending optimizations, some ARM-specific, some x86-specific, and other experiments for either architecture that I'd like to implement/test. I hope to have the time to do this. But your supports will surely help. +## Other Observations +This implementation is highly memory-bound so optimizing your system towards fast memory access is essential. CPUs with large caches will benefit as well. -Copyright 2021 Harold Brenes +Copyright 2021 Harold Brenes, Chia Network Inc diff --git a/bladebit.natvis b/bladebit.natvis index 063061d0..a0cb31fd 100644 --- a/bladebit.natvis +++ b/bladebit.natvis @@ -1,12 +1,12 @@ - - [{_count}] + + [{length}] - _count - _ptr[$i] + length + values[$i] diff --git a/bladebit.sln b/bladebit.sln deleted file mode 100644 index aeee16c5..00000000 --- a/bladebit.sln +++ /dev/null @@ -1,33 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31129.286 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chia32x", "Chia32x.vcxproj", "{29FDE9B6-D410-50EA-841A-870643648120}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6767152D-88A1-40D9-8D1C-DC02976C7C30}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - debug|x64 = debug|x64 - debug|x86 = debug|x86 - release|x64 = release|x64 - release|x86 = release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {29FDE9B6-D410-50EA-841A-870643648120}.debug|x64.ActiveCfg = debug|x64 - {29FDE9B6-D410-50EA-841A-870643648120}.debug|x64.Build.0 = debug|x64 - {29FDE9B6-D410-50EA-841A-870643648120}.debug|x86.ActiveCfg = debug|Win32 - {29FDE9B6-D410-50EA-841A-870643648120}.debug|x86.Build.0 = debug|Win32 - {29FDE9B6-D410-50EA-841A-870643648120}.release|x64.ActiveCfg = release|x64 - {29FDE9B6-D410-50EA-841A-870643648120}.release|x64.Build.0 = release|x64 - {29FDE9B6-D410-50EA-841A-870643648120}.release|x86.ActiveCfg = release|Win32 - {29FDE9B6-D410-50EA-841A-870643648120}.release|x86.Build.0 = release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {9F2D1C78-0F7B-4FF8-9F47-0B1BA68B4886} - EndGlobalSection -EndGlobal diff --git a/bladebit.vcxproj b/bladebit.vcxproj deleted file mode 100644 index cb9d01e2..00000000 --- a/bladebit.vcxproj +++ /dev/null @@ -1,491 +0,0 @@ - - - - - - - debug - Win32 - - - debug - x64 - - - release - Win32 - - - release - x64 - - - - - - true - true - true - true - - - - {335077bc-947f-6c5b-b7d9-3f6af2285577} - bladebit - bladebit - 10.0 - $(ProjectDir).bin - $(ProjectDir).obj - - - - - - - bladebit - StaticLibrary - v142 - Unicode - - - - true - true - - - false - true - - - - - - - - - - - - - - - $(BinsDir) - $(InterDir) - - - - - - - - - - $(ProjectDir)Include;%(AdditionalIncludeDirectories) - true - ProgramDatabase - - %(PreprocessorDefinitions) - - - - - - true - %(AdditionalLibraryDirectories) - /ignore:4049 /ignore:4217 %(AdditionalOptions) - - - - - - - Level3 - MultiThreaded - MaxSpeed - true - true - true - - - true - true - - %(AdditionalLibraryDirectories) - - - - - - - Level3 - MultiThreadedDebug - Disabled - false - false - - - true - /debug:fastlink %(AdditionalOptions) - - %(AdditionalLibraryDirectories) - - - - - - - - - - - - _HAS_STD_BYTE=0;_WIN32=1;WIN32=1;WIN32_LEAN_AND_MEAN=1;UNICODE=1;NOMINMAX=1;_CRT_SECURE_NO_WARNINGS=1;NDEBUG=1;_NDEBUG=1;%(PreprocessorDefinitions) - $(ProjectDir)include;$(ProjectDir)lib/include;$(ProjectDir)lib/include/relic;$(ProjectDir)src;%(AdditionalIncludeDirectories) - - - - - _HAS_STD_BYTE=0;_WIN32=1;WIN32=1;WIN32_LEAN_AND_MEAN=1;UNICODE=1;NOMINMAX=1;_CRT_SECURE_NO_WARNINGS=1;DEBUG=1;_DEBUG=1;%(PreprocessorDefinitions) - $(ProjectDir)include;$(ProjectDir)lib/include;$(ProjectDir)lib/include/relic;$(ProjectDir)src;%(AdditionalIncludeDirectories) - - - - - _HAS_STD_BYTE=0;_WIN32=1;WIN32=1;WIN32_LEAN_AND_MEAN=1;UNICODE=1;NOMINMAX=1;_CRT_SECURE_NO_WARNINGS=1;DEBUG=1;_DEBUG=1;%(PreprocessorDefinitions) - $(ProjectDir)include;$(ProjectDir)lib/include;$(ProjectDir)lib/include/relic;$(ProjectDir)src;%(AdditionalIncludeDirectories) - - - - - _HAS_STD_BYTE=0;_WIN32=1;WIN32=1;WIN32_LEAN_AND_MEAN=1;UNICODE=1;NOMINMAX=1;_CRT_SECURE_NO_WARNINGS=1;NDEBUG=1;_NDEBUG=1;%(PreprocessorDefinitions) - $(ProjectDir)include;$(ProjectDir)lib/include;$(ProjectDir)lib/include/relic;$(ProjectDir)src;%(AdditionalIncludeDirectories) - - - - - _HAS_STD_BYTE=0;_WIN32=1;WIN32=1;WIN32_LEAN_AND_MEAN=1;UNICODE=1;NOMINMAX=1;_CRT_SECURE_NO_WARNINGS=1;DEBUG=1;_DEBUG=1;TEST_MODE=1;%(PreprocessorDefinitions) - $(ProjectDir)include;$(ProjectDir)lib/include;$(ProjectDir)lib/include/relic;$(ProjectDir)src;%(AdditionalIncludeDirectories) - - - - - _HAS_STD_BYTE=0;_WIN32=1;WIN32=1;WIN32_LEAN_AND_MEAN=1;UNICODE=1;NOMINMAX=1;_CRT_SECURE_NO_WARNINGS=1;NDEBUG=1;_NDEBUG=1;TEST_MODE=1;%(PreprocessorDefinitions) - $(ProjectDir)include;$(ProjectDir)lib/include;$(ProjectDir)lib/include/relic;$(ProjectDir)src;%(AdditionalIncludeDirectories) - - - - - - $(ProjectDir)lib;%(AdditionalLibraryDirectories) - bls.lib;%(AdditionalDependencies) - - - - - $(ProjectDir)lib;%(AdditionalLibraryDirectories) - bls.lib;%(AdditionalDependencies) - - - - - $(ProjectDir)lib;$(ProjectDir)lib\linux\arm;%(AdditionalLibraryDirectories) - bls.lib;%(AdditionalDependencies) - - - - - $(ProjectDir)lib;$(ProjectDir)lib\linux\arm;%(AdditionalLibraryDirectories) - bls.lib;%(AdditionalDependencies) - - - - - $(ProjectDir)lib;%(AdditionalLibraryDirectories) - bls.lib;%(AdditionalDependencies) - - - - - $(ProjectDir)lib;%(AdditionalLibraryDirectories) - bls.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - - - true - true - true - true - true - true - - - - - - - - - - - true - true - - - - - - - - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - - - - - - true - true - true - true - - - true - true - true - true - - - - - - - - - - - - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bladebit.vcxproj.filters b/bladebit.vcxproj.filters deleted file mode 100644 index 9106605a..00000000 --- a/bladebit.vcxproj.filters +++ /dev/null @@ -1,615 +0,0 @@ - - - - - {a59031b3-37c4-58ad-7c67-fab1262cd96a} - - - {0b932c7a-0b4d-fb8b-708c-59fddbb4eb0b} - - - {8db9baa5-cbc2-25c3-947b-520bb192ad88} - - - {b1a4dd12-f2fb-0d0e-d102-f19f0398533a} - - - {85b9e582-4ac3-94a9-8368-781d15c42898} - - - {a2552a42-5428-9392-31be-cf4a47a7afe1} - - - {d5755668-0cd5-9f94-362e-c18e8bb0e6fc} - - - {0a66f43f-f279-46fa-9fa2-f6c8f6cfcf84} - - - {c3c8fc3d-af47-914b-b81d-1bbc7958b45a} - - - {9168ce3a-4293-f2eb-6a52-49a24277e99c} - - - {495f6a59-fd01-198b-5073-4bca7c5c13c7} - - - {106140df-a651-9ed6-1c13-86d591d7c9cc} - - - {6cc81b1d-01d8-40ba-85af-d6084f4db0b5} - - - {c233b50f-95ec-bfbb-762d-c0e32693c5bc} - - - {9b1ae37c-887d-ef76-aec4-d4b2426aacc7} - - - {7df57c02-b2ee-c49e-f22b-b76e1731e177} - - - {74e5b3e8-c2ec-0cca-7e8a-ff5394940f7b} - - - {31d79ad2-3b0a-f930-925a-ee39109638d0} - - - {da067ac4-4aab-a236-ded2-cd25f4539bd6} - - - {b865288a-1291-deac-3553-b0cb51bfd4ed} - - - {e4d4811c-1c96-3e46-e571-381d226a5232} - - - {7df57c02-b2ee-c49e-f22b-b76e1731e177} - - - {a59031b3-37c4-58ad-7c67-fab1262cd96a} - - - {0b932c7a-0b4d-fb8b-708c-59fddbb4eb0b} - - - {8db9baa5-cbc2-25c3-947b-520bb192ad88} - - - {b1a4dd12-f2fb-0d0e-d102-f19f0398533a} - - - {85b9e582-4ac3-94a9-8368-781d15c42898} - - - {a2552a42-5428-9392-31be-cf4a47a7afe1} - - - {106140df-a651-9ed6-1c13-86d591d7c9cc} - - - {c233b50f-95ec-bfbb-762d-c0e32693c5bc} - - - {9b1ae37c-887d-ef76-aec4-d4b2426aacc7} - - - - - src\algorithm - - - src\algorithm - - - src\b3 - - - src\b3 - - - src\bech32 - - - src - - - src - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src - - - src\io - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src - - - src - - - src - - - src - - - src\pos - - - src - - - src\threading - - - src\threading - - - src\threading - - - src - - - src - - - src\util - - - src - - - src - - - lib/include/bls - - - lib/include/bls - - - lib/include/bls - - - lib/include/bls - - - lib/include/bls - - - lib/include/bls - - - lib/include/bls - - - lib/include/bls - - - lib/include/relic/low - - - lib/include/relic/low - - - lib/include/relic/low - - - lib/include/relic/low - - - lib/include/relic/low - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - lib/include/relic - - - src/algorithm - - - src/algorithm - - - src/b3 - - - src/b3 - - - src/bech32 - - - src - - - src - - - src/fse - - - src/fse - - - src/fse - - - src/fse - - - src/fse - - - src/fse - - - src/fse - - - src/fse - - - src/fse - - - src - - - src/io - - - src/memplot - - - src/memplot - - - src/memplot - - - src/memplot - - - src/memplot - - - src/memplot - - - src/memplot - - - src/memplot - - - src/memplot - - - src/memplot - - - src - - - src - - - src - - - src - - - src/pos - - - src - - - src/threading - - - src/threading - - - src/threading - - - src - - - src - - - src/util - - - src - - - src - - - - - src\algorithm - - - src\b3 - - - src\b3 - - - src\b3 - - - src\b3 - - - src\b3 - - - src\b3 - - - src\bech32 - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src\fse - - - src\io - - - src - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src\memplot - - - src - - - src\platform\linux - - - src\platform\macos - - - src\platform\unix - - - src\platform\win32 - - - src - - - src - - - src\pos - - - src - - - src\test - - - src\test - - - src\threading - - - src\threading - - - src\threading - - - src - - - src\util - - - - - - src\b3 - - - src\b3 - - - src\b3 - - - src\fse - - - src\fse - - - src\fse - - - \ No newline at end of file diff --git a/build-bls b/build-bls deleted file mode 100755 index cede09b0..00000000 --- a/build-bls +++ /dev/null @@ -1,63 +0,0 @@ -#! /usr/bin/env bash -set -e -_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -cd $_dir - -n_threads=$(nproc --all) - -# Assume 64-bit (only 64-bit is supported) -os= -arch= - -case $(uname -m) in - x86_64) arch=x86 ;; - arm64) arch=arm ;; - aarch64) arch=arm ;; - - *) - echo "Unsupported architecture '$(uname -m)'" - exit 1 - ;; -esac - -case "$OSTYPE" in - "linux-gnu"*) os=linux ;; - "darwin"*) os=macos ;; - - *) - echo "Unsupported OS '$OSTYPE'" - exit 1 - ;; - -esac - - -# Build -pushd modules/bls-signatures - -mkdir -p build -cd build -cmake ../ -cmake --build . -- -j$n_threads - -popd - - - -# Copy headers & library -rm -rf lib/include/bls -rm -rf lib/include/relic -mkdir -p lib/include/bls -mkdir -p lib/include/relic - -cp -r modules/bls-signatures/build/_deps/relic-src/include/* lib/include/relic -cp -r modules/bls-signatures/build/_deps/relic-build/include/* lib/include/relic -cp -r modules/bls-signatures/src/*.hpp lib/include/bls/ - -tgt_dir=lib/$os/$arch -mkdir -p $tgt_dir - -cp modules/bls-signatures/build/libbls.a $tgt_dir/ - - - diff --git a/builds/linux/debug.arm.mk b/builds/linux/debug.arm.mk deleted file mode 100644 index 9ffb8319..00000000 --- a/builds/linux/debug.arm.mk +++ /dev/null @@ -1,45 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/linux/debug.arm.test.mk b/builds/linux/debug.arm.test.mk deleted file mode 100644 index 26f5df34..00000000 --- a/builds/linux/debug.arm.test.mk +++ /dev/null @@ -1,45 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/Test.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/linux/debug.mk b/builds/linux/debug.mk deleted file mode 100644 index 7ad63814..00000000 --- a/builds/linux/debug.mk +++ /dev/null @@ -1,48 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/linux/debug.test.mk b/builds/linux/debug.test.mk deleted file mode 100644 index db3ae3f1..00000000 --- a/builds/linux/debug.test.mk +++ /dev/null @@ -1,50 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/test_main.cpp \ - src/test/test_numa_sort.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/linux/release.arm.mk b/builds/linux/release.arm.mk deleted file mode 100644 index a4a286cb..00000000 --- a/builds/linux/release.arm.mk +++ /dev/null @@ -1,45 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/linux/release.arm.test.mk b/builds/linux/release.arm.test.mk deleted file mode 100644 index 3c84a33e..00000000 --- a/builds/linux/release.arm.test.mk +++ /dev/null @@ -1,45 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/Test.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/linux/release.mk b/builds/linux/release.mk deleted file mode 100644 index edf5bfe8..00000000 --- a/builds/linux/release.mk +++ /dev/null @@ -1,48 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/linux/release.test.mk b/builds/linux/release.test.mk deleted file mode 100644 index e4d5499e..00000000 --- a/builds/linux/release.test.mk +++ /dev/null @@ -1,50 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/linux/SysHost_Linux.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/test_main.cpp \ - src/test/test_numa_sort.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_GNU_SOURCE=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/debug.arm.mk b/builds/macos/debug.arm.mk deleted file mode 100644 index 6dd6c1fc..00000000 --- a/builds/macos/debug.arm.mk +++ /dev/null @@ -1,44 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/debug.arm.test.mk b/builds/macos/debug.arm.test.mk deleted file mode 100644 index 5814775b..00000000 --- a/builds/macos/debug.arm.test.mk +++ /dev/null @@ -1,44 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/Test.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/debug.mk b/builds/macos/debug.mk deleted file mode 100644 index 4717f872..00000000 --- a/builds/macos/debug.mk +++ /dev/null @@ -1,47 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/debug.test.mk b/builds/macos/debug.test.mk deleted file mode 100644 index ef75b4e5..00000000 --- a/builds/macos/debug.test.mk +++ /dev/null @@ -1,49 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/test_main.cpp \ - src/test/test_numa_sort.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/release.arm.mk b/builds/macos/release.arm.mk deleted file mode 100644 index b815b48b..00000000 --- a/builds/macos/release.arm.mk +++ /dev/null @@ -1,44 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/release.arm.test.mk b/builds/macos/release.arm.test.mk deleted file mode 100644 index 0f929148..00000000 --- a/builds/macos/release.arm.test.mk +++ /dev/null @@ -1,44 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/Test.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/release.mk b/builds/macos/release.mk deleted file mode 100644 index b5a3a48e..00000000 --- a/builds/macos/release.mk +++ /dev/null @@ -1,47 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/macos/release.test.mk b/builds/macos/release.test.mk deleted file mode 100644 index 320226ce..00000000 --- a/builds/macos/release.test.mk +++ /dev/null @@ -1,49 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/macos/SysHost_Macos.cpp \ - src/platform/unix/FileStream_Unix.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/test_main.cpp \ - src/test/test_numa_sort.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/debug.arm.mk b/builds/win32/debug.arm.mk deleted file mode 100644 index ed77688b..00000000 --- a/builds/win32/debug.arm.mk +++ /dev/null @@ -1,49 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/debug.arm.test.mk b/builds/win32/debug.arm.test.mk deleted file mode 100644 index 5d73e03a..00000000 --- a/builds/win32/debug.arm.test.mk +++ /dev/null @@ -1,49 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/Test.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/debug.mk b/builds/win32/debug.mk deleted file mode 100644 index cc68641f..00000000 --- a/builds/win32/debug.mk +++ /dev/null @@ -1,52 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/debug.test.mk b/builds/win32/debug.test.mk deleted file mode 100644 index 7ccb6e76..00000000 --- a/builds/win32/debug.test.mk +++ /dev/null @@ -1,54 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/test_main.cpp \ - src/test/test_numa_sort.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DDEBUG=1 \ - -D_DEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/release.arm.mk b/builds/win32/release.arm.mk deleted file mode 100644 index 6de9787b..00000000 --- a/builds/win32/release.arm.mk +++ /dev/null @@ -1,49 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/release.arm.test.mk b/builds/win32/release.arm.test.mk deleted file mode 100644 index d925eaab..00000000 --- a/builds/win32/release.arm.test.mk +++ /dev/null @@ -1,49 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/Test.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/release.mk b/builds/win32/release.mk deleted file mode 100644 index 2c0cea9d..00000000 --- a/builds/win32/release.mk +++ /dev/null @@ -1,52 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/main.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/builds/win32/release.test.mk b/builds/win32/release.test.mk deleted file mode 100644 index 1fd24374..00000000 --- a/builds/win32/release.test.mk +++ /dev/null @@ -1,54 +0,0 @@ - -# Autogenerated by psync 1.2.0 - -SOURCES += \ - src/algorithm/YSort.cpp \ - src/b3/blake3_avx2_x86-64_unix.S \ - src/b3/blake3_avx512_x86-64_unix.S \ - src/b3/blake3_dispatch.c \ - src/b3/blake3_portable.c \ - src/b3/blake3_sse41_x86-64_unix.S \ - src/b3/blake3.c \ - src/bech32/segwit_addr.c \ - src/fse/debug.c \ - src/fse/entropy_common.c \ - src/fse/fse_compress.c \ - src/fse/fse_decompress.c \ - src/fse/hist.c \ - src/io/FileStream.cpp \ - src/memplot/DbgHelper.cpp \ - src/memplot/MemPhase1.cpp \ - src/memplot/MemPhase2.cpp \ - src/memplot/MemPhase3.cpp \ - src/memplot/MemPhase4.cpp \ - src/memplot/MemPlotter.cpp \ - src/pch.cpp \ - src/platform/win32/SysHost_Win32.cpp \ - src/PlotContext.cpp \ - src/PlotWriter.cpp \ - src/pos/chacha8.cpp \ - src/SysHost.cpp \ - src/test/test_main.cpp \ - src/test/test_numa_sort.cpp \ - src/threading/Semaphore.cpp \ - src/threading/Thread.cpp \ - src/threading/ThreadPool.cpp \ - src/Util.cpp \ - src/util/Log.cpp - -CFLAGS += \ - -D_HAS_STD_BYTE=0 \ - -D_WIN32=1 \ - -DWIN32=1 \ - -DWIN32_LEAN_AND_MEAN=1 \ - -DUNICODE=1 \ - -DNOMINMAX=1 \ - -D_CRT_SECURE_NO_WARNINGS=1 \ - -DNDEBUG=1 \ - -D_NDEBUG=1 \ - -DTEST_MODE=1 \ - -Iinclude \ - -Ilib/include \ - -Ilib/include/relic \ - -Isrc - diff --git a/cmake_modules/FindNUMA.cmake b/cmake_modules/FindNUMA.cmake new file mode 100644 index 00000000..c5d288ba --- /dev/null +++ b/cmake_modules/FindNUMA.cmake @@ -0,0 +1,24 @@ +# Find libnuma +# +# NUMA_FOUND : True if libnuma was found +# NUMA_INCLUDE_DIR : Where to find numa.h & numaif.h +# NUMA_LIBRARY : Library to link + +include(FindPackageHandleStandardArgs) + +find_path(NUMA_INCLUDE_DIR + NAMES numa.h numaif.h + HINTS ${INCLUDE_INSTALL_DIR}) + +find_library(NUMA_LIBRARY + NAMES numa + HINTS ${LIB_INSTALL_DIR}) + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NUMA + REQUIRED_VARS NUMA_INCLUDE_DIR NUMA_LIBRARY) + +mark_as_advanced( + NUMA_INCLUDE_DIR + NUMA_LIBRARY) \ No newline at end of file diff --git a/lib/.gitkeep b/lib/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/.gitkeep b/modules/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/bls-signatures b/modules/bls-signatures deleted file mode 160000 index 4f002bca..00000000 --- a/modules/bls-signatures +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4f002bca9667dbd470782ed411f86053f52b74c0 diff --git a/project.js b/project.js deleted file mode 100644 index fea44ef5..00000000 --- a/project.js +++ /dev/null @@ -1,172 +0,0 @@ - -const CONFIG_NAMES = [ - 'release', - 'debug', - 'debug.arm', - 'release.arm', - - // Test/sandbox mode - 'debug.test', - 'release.test', - // 'debug.arm.test', - // 'release.arm.test' -]; - -const UNIX_SOURCES = [ - 'src/platform/**/unix/**/*' -]; - - -// Project Transform Function -const bladebit = project( 'bladebit', CONFIG_NAMES, { - headerPaths: [ - 'include', - 'lib/include', - 'lib/include/relic', - 'src' - ], - - src: [ - 'src/**/*', - 'src/b3/*.S', - ], - - ignore: [ - 'src/platform/**/*' - - ,'src/b3/blake3_avx*.c' - ,'src/b3/blake3_sse*.c' - ,'src/test/**/*' - ], - - // precompiledHeader: 'src/pch.cpp', - - libraryPaths : [ - 'lib' - ], - - def :{ - _HAS_STD_BYTE: 0 - }, - - undef:[ - - ], - - libs: [ - 'bls' - ] -}); - -/// -/// Configs -/// -bladebit.configs.release = () => config({ - def : { NDEBUG: 1, _NDEBUG: 1 }, - undef: [ 'DEBUG', '_DEBUG' ] - -}); - -bladebit.configs.debug = () => config({ - def : { DEBUG: 1, _DEBUG: 1 }, - undef: [ 'NDEBUG', '_NDEBUG' ], - -}); - -/// Architectures -bladebit.configs.arm = () => config({ - def : { - // PLATFORM_IS_ARM: 1 - // ,BLAKE3_USE_NEON: 1 - } - - ,libraryPaths : [ - 'lib/linux/arm' - ] - - ,ignore: [ - 'src/b3/*.S' - ] -}); - -/// -/// Platforms -/// -bladebit.platforms.win32 = () => config({ - def: { - _WIN32 : 1 - ,WIN32 : 1 - ,WIN32_LEAN_AND_MEAN : 1 - ,UNICODE : 1 - ,NOMINMAX : 1 - ,_CRT_SECURE_NO_WARNINGS : 1 - }, - - precompiledHeader: 'src/pch.cpp', - - src: [ - 'src/platform/**/win32/**/*', - 'src/platform/**/*_win32*', - 'src/platform/**/*_Win32*' - ], - - ignore: [ - - ] -}); - -bladebit.platforms.linux = () => config({ - src: UNIX_SOURCES.concat([ - - 'src/platform/**/linux/**/*' - - // x86 blake - // 'src/b3/blake3_sse2_x86-64_unix.S', - ,'src/b3/blake3_sse41_x86-64_unix.S' - ,'src/b3/blake3_avx2_x86-64_unix.S' - ,'src/b3/blake3_avx512_x86-64_unix.S' - ]) - - ,libraryPaths : [ - 'lib/linux', - 'lib/linux/x86' - ] - - ,def: { - _GNU_SOURCE: 1 - // ,BLAKE3_NO_AVX512: 1 - } -}); - -bladebit.platforms.macos = () => config({ - src: UNIX_SOURCES.concat([ - 'src/platform/**/macos/**/*' - ]) - - ,def: { - // _GNU_SOURCE: 1 - // ,BLAKE3_NO_AVX512: 1 - } -}); - - -bladebit.configs.test = () => config({ - def: { - TEST_MODE: 1 - } - - ,src: [ - - 'src/test/test_main.cpp' - ,'src/test/test_numa_sort.cpp' - // ,'src/test/TestNuma.cpp' - ] - - ,ignore: [ - 'src/main.cpp' - ] -}); - - -const projects = { bladebit: bladebit }; -return projects; \ No newline at end of file diff --git a/src/ChiaConsts.h b/src/ChiaConsts.h index c2125732..ee8006e9 100644 --- a/src/ChiaConsts.h +++ b/src/ChiaConsts.h @@ -138,6 +138,6 @@ inline size_t CalculateParkSize( TableId tableId ) // values of k, we need extra space to account for the additional variability. constexpr inline static size_t CalculateC3Size() { - return CDiv( kC3BitsPerEntry * kCheckpoint1Interval, 8 ); + return (size_t)CDiv( kC3BitsPerEntry * kCheckpoint1Interval, 8 ); } diff --git a/src/Globals.h b/src/Globals.h index d172ac83..ac2a4100 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -43,7 +43,7 @@ error Unsupported Apple platform. #endif -#elif defined( __WIN32 ) +#elif defined( _WIN32 ) #define PLATFORM_IS_WINDOWS 1 #endif diff --git a/src/Platform.h b/src/Platform.h index 5e934162..c11f94f3 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -1,11 +1,13 @@ #pragma once #ifdef _WIN32 - + + #define NOMINMAX 1 #define WIN32_LEAN_AND_MEAN 1 #include typedef HANDLE ThreadId; + typedef HANDLE SemaphoreId; // *nix #elif __linux__ || __APPLE__ diff --git a/src/PlotWriter.cpp b/src/PlotWriter.cpp index eb43c994..65b9b13c 100644 --- a/src/PlotWriter.cpp +++ b/src/PlotWriter.cpp @@ -241,7 +241,7 @@ bool DiskPlotWriter::WaitUntilFinishedWriting() //----------------------------------------------------------- void DiskPlotWriter::WriterMain( void* data ) { - SysHost::SetCurrentThreadAffinityMask( 1 ); + SysHost::SetCurrentThreadAffinityCpuId( 0 ); ASSERT( data ); DiskPlotWriter* self = reinterpret_cast( data ); diff --git a/src/SysHost.h b/src/SysHost.h index 96cf2b05..0176af31 100644 --- a/src/SysHost.h +++ b/src/SysHost.h @@ -17,6 +17,10 @@ struct NumaInfo uint nodeCount; // How many NUMA nodes in the system uint cpuCount; // Total cpu count used by nodes Span* cpuIds; // CPU ids of each node + + #ifdef _WIN32 +// Span procGroup; // Processor group each cpu belongs to. + #endif }; class SysHost @@ -32,6 +36,9 @@ class SysHost /// Gets the currently available (unused) system ram in bytes static size_t GetAvailableSystemMemory(); + /// Get the total number of logical CPUs in the system + static uint GetLogicalCPUCount(); + /// Create an allocation in the virtual memory space /// If initialize == true, then all pages are touched so that /// the pages are actually assigned. @@ -42,10 +49,10 @@ class SysHost static bool VirtualProtect( void* ptr, size_t size, VProtect flags = VProtect::NoAccess ); /// Set the processor affinity mask for the current process - static uint64 SetCurrentProcessAffinityMask( uint64 mask ); + // static uint64 SetCurrentProcessAffinityMask( uint64 mask ); /// Set the processor affinity mask for the current thread - static uint64 SetCurrentThreadAffinityMask( uint64 mask ); +// static uint64 SetCurrentThreadAffinityMask( uint64 mask ); /// Set the processor affinity mask to a specific cpu id for the current thread static bool SetCurrentThreadAffinityCpuId( uint32 cpuId ); diff --git a/src/Types.h b/src/Types.h index dfffa009..4b7eb921 100644 --- a/src/Types.h +++ b/src/Types.h @@ -1,15 +1,19 @@ #pragma once -typedef uint8_t byte; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -typedef uint64_t uint64; +typedef uint8_t byte; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef unsigned long long int uint64; #if !uint typedef uint32 uint; #endif +#if !ssize_t + typedef int64_t ssize_t; +#endif + typedef uint8 u8; typedef uint16 u16; typedef uint32 u32; @@ -19,7 +23,7 @@ typedef int8_t sbyte; typedef int8_t int8; typedef int16_t int16; typedef int32_t int32; -typedef int64_t int64; +typedef long long int int64; typedef int8 i8; typedef int16 i16; diff --git a/src/Util.cpp b/src/Util.cpp index a06f2225..00988b7d 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -2,17 +2,34 @@ #include "util/Log.h" //----------------------------------------------------------- -void Fatal( const char* message, ... ) +void VFatal( const char* message, va_list args ) { - va_list args; - va_start( args, message ); - Log::Error( "Fatal Error:" ); Log::WriteError( " " ); Log::Error( message, args ); Log::FlushError(); - va_end( args ); ASSERT( 0 ); exit( 1 ); +} + +//----------------------------------------------------------- +void Fatal( const char* message, ... ) +{ + va_list args; + va_start( args, message ); + VFatal( message, args ); + va_end( args ); +} + +//----------------------------------------------------------- +void FatalIf( bool condition, const char* message, ... ) +{ + if( condition ) + { + va_list args; + va_start( args, message ); + VFatal( message, args ); + va_end( args ); + } } \ No newline at end of file diff --git a/src/Util.h b/src/Util.h index a8426c8c..fd819d0c 100644 --- a/src/Util.h +++ b/src/Util.h @@ -4,6 +4,7 @@ #include #ifdef _MSC_VER + #define Swap16( x ) _byteswap_ushort( x ) #define Swap32( x ) _byteswap_ulong( x ) #define Swap64( x ) _byteswap_uint64( x ) #elif defined( __GNUC__ ) @@ -33,6 +34,8 @@ //----------------------------------------------------------- void Fatal( const char* message, ... ); +void FatalIf( bool condition, const char* message, ... ); + //----------------------------------------------------------- template inline void ZeroMem( T* ptr ) @@ -228,10 +231,10 @@ inline void HexStrToBytes( const char* str, const size_t strSize, int i = 0; while( str < end ) { - byte msb = HEX_TO_BIN[(int)str[0]]; - byte lsb = HEX_TO_BIN[(int)str[1]]; + byte msb = (byte)HEX_TO_BIN[(int)str[0]]; + byte lsb = (byte)HEX_TO_BIN[(int)str[1]]; - byte v = lsb + msb * 16; + byte v = lsb + msb * 16u; dst[i++] = v; str += 2; } diff --git a/src/bech32/segwit_addr.c b/src/bech32/segwit_addr.c index 731b6e16..7cd7c614 100644 --- a/src/bech32/segwit_addr.c +++ b/src/bech32/segwit_addr.c @@ -35,7 +35,8 @@ static uint32_t bech32_polymod_step(uint32_t pre) { (-((b >> 4) & 1) & 0x2a1462b3UL); } - +#pragma warning( push ) +#pragma warning( disable : 4715 ) // Not all control paths retrn a value #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wreturn-type" static uint32_t bech32_final_constant(bech32_encoding enc) { @@ -44,6 +45,7 @@ static uint32_t bech32_final_constant(bech32_encoding enc) { assert(0); } #pragma GCC diagnostic pop +#pragma warning( pop ) static const char* charset = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; diff --git a/src/io/FileStream.h b/src/io/FileStream.h index 2330ae7b..a2d8fc72 100644 --- a/src/io/FileStream.h +++ b/src/io/FileStream.h @@ -1,4 +1,5 @@ #pragma once +#include "Platform.h" enum class FileAccess : uint16 { @@ -58,7 +59,10 @@ class FileStream bool Flush(); - inline size_t BlockSize() { return _blockSize; } + inline size_t BlockSize() + { + return _blockSize; + } void Close(); @@ -72,7 +76,15 @@ class FileStream return err; } - +private: + inline bool HasValidFD() const + { + #if PLATFORM_IS_UNIX + return _fd != -1; + #else + return _fd != INVALID_HANDLE_VALUE; + #endif + } private: size_t _writePosition = 0; @@ -80,11 +92,11 @@ class FileStream FileAccess _access = FileAccess::None; FileFlags _flags = FileFlags::None; int _error = 0; + size_t _blockSize = 0; // for O_DIRECT/FILE_FLAG_NO_BUFFERING #if PLATFORM_IS_UNIX - int _fd = -1; - size_t _blockSize = 0; // for O_DIRECT - // byte* _blockBuffer = nullptr; // for O_DIRECT - // uint32 _blockBytes = 0; // Pending block-unaligned bytes to be written to disk. + int _fd = -1; + #elif PLATFORM_IS_WINDOWS + HANDLE _fd = INVALID_HANDLE_VALUE; #endif }; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 14c4985f..a62f5189 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,16 +12,22 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wreturn-type" +#pragma warning( push ) + extern "C" { #include "bech32/segwit_addr.h" } #pragma GCC diagnostic ignored "-Wsign-compare" -#include "bls/bls.hpp" -#include "bls/elements.hpp" -#include "bls/schemes.hpp" -#include "bls/util.hpp" +#pragma warning( disable : 6287 ) +#pragma warning( disable : 4267 ) +#pragma warning( disable : 26495 ) +#include "bls.hpp" +#include "elements.hpp" +#include "schemes.hpp" +#include "util.hpp" #pragma GCC diagnostic pop +#pragma warning( pop ) #define PLOT_FILE_PREFIX_LEN (sizeof("plot-k32-2021-08-05-18-55-")-1) #define PLOT_FILE_FMT_LEN (sizeof( "/plot-k32-2021-08-05-18-55-77a011fc20f0003c3adcc739b615041ae56351a22b690fd854ccb6726e5f43b7.plot.tmp" )) @@ -49,8 +55,8 @@ struct Config }; /// Internal Functions -void ParseCommandLine( int argc, const char* argv[], Config& cfg ); -bool HexPKeyToG1Element( const char* hexKey, bls::G1Element& pkey ); +void ParseCommandLine( int argc, const char* argv[], Config& cfg ); +bool HexPKeyToG1Element( const char* hexKey, bls::G1Element& pkey ); ByteSpan DecodePuzzleHash( const char* poolContractAddress ); void GeneratePlotIdAndMemo( Config& cfg, byte plotId[32], byte plotMemo[48+48+32], uint16& outMemoSize ); @@ -137,7 +143,7 @@ int main( int argc, const char* argv[] ) if( outputFolderLen ) { - mempcpy( plotOutPath, cfg.outputFolder, outputFolderLen ); + memcpy( plotOutPath, cfg.outputFolder, outputFolderLen ); // Add a trailing slash, if we need one. if( plotOutPath[outputFolderLen-1] != '/' ) @@ -258,7 +264,7 @@ void ParseCommandLine( int argc, const char* argv[], Config& cfg ) const char* val = value(); int64 v = 0; - int r = sscanf( val, "%ld", &v ); + int r = sscanf( val, "%lli", &v ); if( r != 1 ) Fatal( "Invalid value for argument '%s'.", arg ); @@ -420,7 +426,7 @@ void ParseCommandLine( int argc, const char* argv[], Config& cfg ) Fatal( "Error: Either a pool public key or a pool contract address must be specified." ); - const uint threadCount = std::thread::hardware_concurrency(); + const uint threadCount = SysHost::GetLogicalCPUCount(); if( cfg.threads == 0 ) cfg.threads = threadCount; @@ -616,7 +622,7 @@ ByteSpan DecodePuzzleHash( const char* poolContractAddress ) { uint value = data[i]; - if( value < 0 or (value >> fromBits) ) + if( value < 0 || (value >> fromBits) ) Fatal( "Error: Invalid pool contract address '%s'. Could not decode bits.", poolContractAddress ); acc = ((acc << fromBits) | value) & maxAcc; diff --git a/src/memplot/DbgHelper.cpp b/src/memplot/DbgHelper.cpp index 9ad8dcf2..cb86d53a 100644 --- a/src/memplot/DbgHelper.cpp +++ b/src/memplot/DbgHelper.cpp @@ -20,7 +20,7 @@ void DumpTestProofs( const MemPlotContext& cx, const uint64 f7Index ) const uint32 f7 = cx.t7YBuffer [f7Index]; const Pair& f7Pair = cx.t7LRBuffer[f7Index]; - Log::Line( "T7 [%-2llu] f7 : %lu : 0x%08lx", f7Index, f7, f7 ); + Log::Line( "T7 [%-2llu] f7 : %llu : 0x%08lx", f7Index, f7, f7 ); Log::Line( "T7 [%-2llu] L/R : %-8lu | %-8lu", f7Index, f7Pair.left, f7Pair.right ); const Pair* rPairs[16]; // R table pairs @@ -34,7 +34,7 @@ void DumpTestProofs( const MemPlotContext& cx, const uint64 f7Index ) for( uint i = 1; i < 6; i++ ) { const uint32 rCount = 1ul << (i-1); - const uint32 lCount = 1 << i; + const uint32 lCount = 1ul << i; const Pair* table = tables[i]; Log::Line( "Table %d", 7-i ); @@ -106,7 +106,7 @@ void PrintHash( FILE* file, uint64 index, const void* input, size_t inputSize ) blake3_hasher_update( &hasher, input, inputSize ); blake3_hasher_finalize( &hasher, (uint8_t*)hash, sizeof( hash ) ); - fprintf( file, "[%-12lu] 0x", index ); + fprintf( file, "[%-12llu] 0x", index ); for( uint64 i = 0; i < sizeof( hash ); i+=16 ) { fprintf( file, diff --git a/src/memplot/DbgHelper.h b/src/memplot/DbgHelper.h index 6c921ad5..230fdbcd 100644 --- a/src/memplot/DbgHelper.h +++ b/src/memplot/DbgHelper.h @@ -70,12 +70,22 @@ inline bool DbgReadTableFromFile( ThreadPool& pool, const char* path, uint64& ou static void* block = nullptr; if( !block ) { - int r = posix_memalign( &block, blockSize, blockSize ); - if( r != 0 ) - { - Log::Line( "Failed to get aligned block with error %d.", r ); - return false; - } + #if PLATFORM_IS_UNIX + int r = posix_memalign( &block, blockSize, blockSize ); + if( r != 0 ) + { + Log::Line( "Failed to get aligned block with error %d.", r ); + return false; + } + #else + block = _aligned_malloc( blockSize, blockSize ); + + if( !block ) + { + Log::Line( "Failed to allocate aligned block." ); + return false; + } + #endif } ASSERT( block ); memset( block, 0, blockSize ); @@ -256,7 +266,7 @@ inline void DbgWriteTableToFile( ThreadPool& pool, const char* path, uint64 entr ASSERT( size > blockSize ); - if( !file.Reserve( blockSize + CDiv( size, blockSize ) ) ) + if( !file.Reserve( blockSize + CDiv( size, (int)blockSize ) ) ) { Log::Line( "Failed to reserve size with error %d for table '%s'.", file.GetError(), path ); } @@ -265,12 +275,22 @@ inline void DbgWriteTableToFile( ThreadPool& pool, const char* path, uint64 entr static void* block = nullptr; if( !block ) { - int r = posix_memalign( &block, blockSize, blockSize ); - if( r != 0 ) - { - Log::Line( "Failed to get aligned block with error %d.", r ); - return; - } + #if PLATFORM_IS_UNIX + int r = posix_memalign( &block, blockSize, blockSize ); + if( r != 0 ) + { + Log::Line( "Failed to get aligned block with error %d.", r ); + return; + } + #else + block = _aligned_malloc( blockSize, blockSize ); + + if( !block ) + { + Log::Line( "Failed to allocate aligned block." ); + return; + } + #endif } ASSERT( block ); diff --git a/src/memplot/FxSort.h b/src/memplot/FxSort.h index 544bc9ca..1d231075 100644 --- a/src/memplot/FxSort.h +++ b/src/memplot/FxSort.h @@ -56,13 +56,13 @@ inline void MapFxWithSortKey( const Pair* pairSrc, Pair* pairDst ) { // Sort metadata and pairs on y via the sort key - const uint64 threadCount = pool.ThreadCount(); + const uint32 threadCount = pool.ThreadCount(); const uint64 entriesPerThread = length / threadCount; const uint64 trailingEntries = length - ( entriesPerThread * threadCount ); MapFxJob jobs[MAX_JOBS]; - for( uint64 i = 0; i < threadCount; i++ ) + for( uint32 i = 0; i < threadCount; i++ ) { auto& job = jobs[i]; diff --git a/src/memplot/MemPhase1.cpp b/src/memplot/MemPhase1.cpp index 67f29f58..b2686b66 100644 --- a/src/memplot/MemPhase1.cpp +++ b/src/memplot/MemPhase1.cpp @@ -220,7 +220,7 @@ uint64 MemPhase1::GenerateF1() // job.threadCount = numThreads; job.key = key; - job.blockCount = blocksPerThread; + job.blockCount = (uint32)blocksPerThread; job.entryCount = (uint32)entriesPerThread; job.x = (uint32)offset; job.blocks = blocks + blockOffset; @@ -228,8 +228,8 @@ uint64 MemPhase1::GenerateF1() job.xBuffer = xTmp + offset; } - jobs[numThreads-1].entryCount += trailingEntries; - jobs[numThreads-1].blockCount += trailingBlocks; + jobs[numThreads-1].entryCount += (uint32)trailingEntries; + jobs[numThreads-1].blockCount += (uint32)trailingBlocks; // Initialize NUMA pages // if( numa ) @@ -525,7 +525,7 @@ void F1JobThread( F1GenJob* job ) // Gen the x that generated the y uint32* xBuffer = job->xBuffer; for( uint64 i = 0; i < entryCount; i++ ) - xBuffer[i] = x + i; + xBuffer[i] = (uint32)( x + i ); } @@ -777,9 +777,9 @@ uint64 MemPhase1::FpScan( const uint64 entryCount, const uint64* yBuffer, uint32 // This is an overflow if the last group ends @ k^32, if so, // then have it end just before that. if( entryCount == ENTRIES_PER_TABLE ) - lastJob.groupBoundaries[lastJob.groupCount] = entryCount-1; + lastJob.groupBoundaries[lastJob.groupCount] = (uint32)(entryCount-1); else - lastJob.groupBoundaries[lastJob.groupCount] = entryCount; + lastJob.groupBoundaries[lastJob.groupCount] = (uint32)entryCount; // double elapsed = TimerEnd( timer ); // Log::Line( " Finished scanning kBC groups in %.2lf seconds.", elapsed ); @@ -803,7 +803,7 @@ uint64 MemPhase1::FpScan( const uint64 entryCount, const uint64* yBuffer, uint32 { // ASSERT( group > prevGroup ); ASSERT( 0 ); - Fatal( "Invalid group sequence. Job: %u Idx: %lu, Ridx: %lu, Group: %lu", t, i, rIdx, group ); + Fatal( "Invalid group sequence. Job: %u Idx: %llu, Ridx: %llu, Group: %llu", t, i, rIdx, group ); } prevGroup = group; } @@ -826,7 +826,7 @@ uint64 MemPhase1::FpScan( const uint64 entryCount, const uint64* yBuffer, uint32 if( group != groupL ) { ASSERT( 0 ); - Fatal( "Group validation failed @ job %lu index: %lu. L: %lu R: %lu", i, j, groupL, group ); + Fatal( "Group validation failed @ job %llu index: %llu. L: %llu R: %llu", i, j, groupL, group ); } ASSERT( group == groupL ); } @@ -863,7 +863,7 @@ void FpScanThread( kBCJob* job ) { ASSERT( group > lastGroup ); - groupBoundaries[groupCount++] = i; + groupBoundaries[groupCount++] = (uint32)i; lastGroup = group; if( groupCount == maxGroups ) @@ -885,7 +885,7 @@ uint64 MemPhase1::FpPair( const uint64* yBuffer, kBCJob jobs[MAX_THREADS], { MemPlotContext& cx = _context; - const uint64 threadCount = cx.threadCount; + const uint32 threadCount = cx.threadCount; uint64 pairCount = 0; @@ -895,7 +895,7 @@ uint64 MemPhase1::FpPair( const uint64* yBuffer, kBCJob jobs[MAX_THREADS], const uint64 maxTotalpairs = cx.maxPairs; const uint64 maxPairsPerThread = maxTotalpairs / threadCount; - for( uint64 i = 0; i < threadCount; i++ ) + for( uint32 i = 0; i < threadCount; i++ ) { auto& job = jobs[i]; @@ -909,7 +909,7 @@ uint64 MemPhase1::FpPair( const uint64* yBuffer, kBCJob jobs[MAX_THREADS], // job.jobIdx = (uint32)i; } - cx.threadPool->RunJob( FpPairThread, jobs, (uint)threadCount ); + cx.threadPool->RunJob( FpPairThread, jobs, threadCount ); // Count the total pairs and copy the pair buffers // to the actual destination pair buffer. @@ -946,7 +946,7 @@ uint64 MemPhase1::FpPair( const uint64* yBuffer, kBCJob jobs[MAX_THREADS], }, jobs, threadCount, sizeof( kBCJob ) ); auto elapsed = TimerEnd( timer ); - Log::Line( " Finished pairing L/R groups in %.4lf seconds. Created %lu pairs.", elapsed, pairCount ); + Log::Line( " Finished pairing L/R groups in %.4lf seconds. Created %llu pairs.", elapsed, pairCount ); Log::Line( " Average of %.4lf pairs per group.", pairCount / (float64)groupCount ); ASSERT( pairCount <= ENTRIES_PER_TABLE ); diff --git a/src/memplot/MemPhase3.cpp b/src/memplot/MemPhase3.cpp index 040a91e4..3f247ab2 100644 --- a/src/memplot/MemPhase3.cpp +++ b/src/memplot/MemPhase3.cpp @@ -57,7 +57,7 @@ void MemPhase3::Run() double tElapsed = TimerEnd( tableTimer ); Log::Line( " Finished compressing tables %u and %u in %.2lf seconds", i+1, i+2, tElapsed ); - Log::Line( " Table %d now has %lu / %lu entries ( %.2lf%% ).", + Log::Line( " Table %d now has %llu / %llu entries ( %.2lf%% ).", i+1, newCount, rTableCount, (newCount / (double)rTableCount) * 100 ); } } diff --git a/src/memplot/MemPlotter.cpp b/src/memplot/MemPlotter.cpp index 3b558c7c..25b80907 100644 --- a/src/memplot/MemPlotter.cpp +++ b/src/memplot/MemPlotter.cpp @@ -73,7 +73,7 @@ MemPlotter::MemPlotter( const MemPlotConfig& cfg ) metaBuffer0 + metaBuffer1; - Log::Line( "Memory required: %lu GiB.", reqMem BtoGB ); + Log::Line( "Memory required: %llu GiB.", reqMem BtoGB ); if( availMemory < reqMem ) Log::Line( "Warning: Not enough memory available. Buffer allocation may fail." ); @@ -130,19 +130,20 @@ bool MemPlotter::Run( const PlotRequest& request ) FileStream* plotfile = new FileStream(); ASSERT( plotfile ); - for( int i = 0;; ) + for( int i = 0; i < PLOT_FILE_RETRIES; i++ ) { if( !plotfile->Open( request.outPath, FileMode::Create, FileAccess::Write, FileFlags::NoBuffering | FileFlags::LargeFile ) ) { - if( ++i > PLOT_FILE_RETRIES ) + if( i+1 >= PLOT_FILE_RETRIES ) { Log::Error( "Error: Failed to open plot output file at %s for writing after %d tries.", request.outPath, PLOT_FILE_RETRIES ); delete plotfile; return false; } + + continue; } - ASSERT( plotfile->IsOpen() ); break; } diff --git a/src/platform/linux/SysHost_Linux.cpp b/src/platform/linux/SysHost_Linux.cpp index 4c167b5e..f9ef1e39 100644 --- a/src/platform/linux/SysHost_Linux.cpp +++ b/src/platform/linux/SysHost_Linux.cpp @@ -35,6 +35,12 @@ size_t SysHost::GetAvailableSystemMemory() return (size_t)get_avphys_pages() * pageSize; } +//----------------------------------------------------------- + uint SysHost::GetLogicalCPUCount() + { + return (uint)get_nprocs(); + } + //----------------------------------------------------------- void* SysHost::VirtualAlloc( size_t size, bool initialize ) { @@ -124,46 +130,46 @@ bool SysHost::VirtualProtect( void* ptr, size_t size, VProtect flags ) } //----------------------------------------------------------- -uint64 SysHost::SetCurrentProcessAffinityMask( uint64 mask ) -{ - return SetCurrentThreadAffinityMask( mask ); -} - -//----------------------------------------------------------- -uint64 SysHost::SetCurrentThreadAffinityMask( uint64 mask ) -{ - pthread_t thread = pthread_self(); - - cpu_set_t cpuSet; - CPU_ZERO( &cpuSet ); - - if( mask == 0 ) - CPU_SET( 1, &cpuSet ); - else - { - for( uint i = 0; i < 64; i++ ) - { - if( mask & (1ull << i ) ) - CPU_SET( i+1, &cpuSet ); - } - } - - int r = pthread_setaffinity_np( thread, sizeof(cpu_set_t), &cpuSet ); - if( r != 0 ) - { - ASSERT( 0 ); - return 0; - } - - r = pthread_getaffinity_np( thread, sizeof(cpu_set_t), &cpuSet ); - if( r != 0 ) - { - ASSERT( 0 ); - return 0; - } - - return mask; -} +// uint64 SysHost::SetCurrentProcessAffinityMask( uint64 mask ) +// { +// return SetCurrentThreadAffinityMask( mask ); +// } + +// //----------------------------------------------------------- +// uint64 SysHost::SetCurrentThreadAffinityMask( uint64 mask ) +// { +// pthread_t thread = pthread_self(); + +// cpu_set_t cpuSet; +// CPU_ZERO( &cpuSet ); + +// if( mask == 0 ) +// CPU_SET( 1, &cpuSet ); +// else +// { +// for( uint i = 0; i < 64; i++ ) +// { +// if( mask & (1ull << i ) ) +// CPU_SET( i+1, &cpuSet ); +// } +// } + +// int r = pthread_setaffinity_np( thread, sizeof(cpu_set_t), &cpuSet ); +// if( r != 0 ) +// { +// ASSERT( 0 ); +// return 0; +// } + +// r = pthread_getaffinity_np( thread, sizeof(cpu_set_t), &cpuSet ); +// if( r != 0 ) +// { +// ASSERT( 0 ); +// return 0; +// } + +// return mask; +// } //----------------------------------------------------------- bool SysHost::SetCurrentThreadAffinityCpuId( uint32 cpuId ) diff --git a/src/threading/Thread.cpp b/src/platform/unix/Thread_Unix.cpp similarity index 80% rename from src/threading/Thread.cpp rename to src/platform/unix/Thread_Unix.cpp index 772a51e6..6c7b6f04 100644 --- a/src/threading/Thread.cpp +++ b/src/platform/unix/Thread_Unix.cpp @@ -1,11 +1,10 @@ -#include "Thread.h" -#include "../Util.h" -#include "../Globals.h" +#include "../../threading/Thread.h" +#include "../../Util.h" +#include "../../Globals.h" #include "SysHost.h" #include "util/Log.h" typedef void* (*PthreadFunc)( void* param ); -// typedef __start_routine PthreadFunc; //----------------------------------------------------------- Thread::Thread( size_t stackSize ) @@ -17,10 +16,10 @@ Thread::Thread( size_t stackSize ) // Align to 8 bytes stackSize = RoundUpToNextBoundary( stackSize, 8 ); -#if PLATFORM_IS_UNIX - _state.store( ThreadState::ReadyToRun, std::memory_order_release ); +#if PLATFORM_IS_UNIX + pthread_attr_t attr; int r = pthread_attr_init( &attr ); @@ -36,12 +35,15 @@ Thread::Thread( size_t stackSize ) r = pthread_mutex_init( &_launchMutex, NULL ); if( r ) Fatal( "pthread_mutex_init() failed." ); - r = pthread_create( &_threadId, &attr, (PthreadFunc)&Thread::ThreadStarter, this ); + r = pthread_create( &_threadId, &attr, (PthreadFunc)&Thread::ThreadStarterUnix, this ); if( r ) Fatal( "pthread_create() failed." ); r = pthread_attr_destroy( &attr ); if( r ) Fatal( "pthread_attr_destroy() failed." ); +#elif PLATFORM_IS_WINDOWS + + #else #error Not implemented #endif @@ -59,7 +61,7 @@ Thread::~Thread() if( !didExit ) { - // Thread shold have exited already + // Thread should have exited already #if PLATFORM_IS_UNIX pthread_cancel( _threadId ); @@ -77,10 +79,10 @@ Thread::~Thread() } //----------------------------------------------------------- -uint64 Thread::SetAffinity( uint64 affinity ) -{ - return SysHost::SetCurrentThreadAffinityMask( affinity ); -} +// uint64 Thread::SetAffinity( uint64 affinity ) +// { +// return SysHost::SetCurrentThreadAffinityMask( affinity ); +// } //----------------------------------------------------------- bool Thread::HasExited() const @@ -194,46 +196,37 @@ bool Thread::WaitForExit( long milliseconds ) // Starts up a thread. //----------------------------------------------------------- -void* Thread::ThreadStarter( Thread* t ) +void* Thread::ThreadStarterUnix( Thread* t ) { - // On linux, it suspends it until it is signalled to run. - #if PLATFORM_IS_UNIX - - int r = pthread_mutex_lock( &t->_launchMutex ); - if( r ) Fatal( "pthread_mutex_lock() failed." ); + // On Linux, it suspends it until it is signaled to run. + int r = pthread_mutex_lock( &t->_launchMutex ); + if( r ) Fatal( "pthread_mutex_lock() failed." ); - while( t->_state.load( std::memory_order_relaxed ) == ThreadState::ReadyToRun ) - { - r = pthread_cond_wait( &t->_launchCond, &t->_launchMutex ); - if( r ) Fatal( "pthread_cond_wait() failed." ); - break; - } - - r = pthread_mutex_unlock( &t->_launchMutex ); - if( r ) Fatal( "pthread_mutex_unlock() failed." ); + while( t->_state.load( std::memory_order_relaxed ) == ThreadState::ReadyToRun ) + { + r = pthread_cond_wait( &t->_launchCond, &t->_launchMutex ); + if( r ) Fatal( "pthread_cond_wait() failed." ); + break; + } - pthread_mutex_destroy( &t->_launchMutex ); - pthread_cond_destroy ( &t->_launchCond ); + r = pthread_mutex_unlock( &t->_launchMutex ); + if( r ) Fatal( "pthread_mutex_unlock() failed." ); - ZeroMem( &t->_launchMutex ); - ZeroMem( &t->_launchCond ); + pthread_mutex_destroy( &t->_launchMutex ); + pthread_cond_destroy ( &t->_launchCond ); - #else - #error Unimplemented - #endif + ZeroMem( &t->_launchMutex ); + ZeroMem( &t->_launchCond ); // Run the thread function t->_runner( t->_runParam ); // Thread has exited t->_state.store( ThreadState::Exited, std::memory_order_release ); - - #if PLATFORM_IS_UNIX - // TODO: Signal if waiting to be joined - pthread_exit( nullptr ); - #else - #error Unimplemented - #endif - + + // TODO: Signal if waiting to be joined + pthread_exit( nullptr ); + return nullptr; -} \ No newline at end of file +} + diff --git a/src/platform/win32/FileStream_Win32.cpp b/src/platform/win32/FileStream_Win32.cpp new file mode 100644 index 00000000..0bcf0966 --- /dev/null +++ b/src/platform/win32/FileStream_Win32.cpp @@ -0,0 +1,416 @@ +#include "io/FileStream.h" +#include "Util.h" +#include "util/Log.h" + +#include +#include +#pragma comment( lib, "Shlwapi.lib" ) + +const size_t BUF16_STACK_LEN = 1024; + +//bool GetFileClusterSize( wchar_t* filePath, size_t& outClusterSize ); +bool GetFileClusterSize( HANDLE hFile, size_t& outClusterSize ); + +wchar_t* Utf8ToUtf16( const char* utf8Str, wchar_t* stackBuffer16, const size_t stackBuf16Size ); + +//---------------------------------------------------------- +bool FileStream::Open( const char* path, FileMode mode, FileAccess access, FileFlags flags ) +{ + return Open( path, *this, mode, access, flags ); +} + +//---------------------------------------------------------- +bool FileStream::Open( const char* path, FileStream& file, FileMode mode, FileAccess access, FileFlags flags ) +{ + if( path == nullptr ) + return false; + + if( file.HasValidFD() ) + return false; + + + // Encode utf-8 path to wchar_t + wchar_t path16Stack[BUF16_STACK_LEN]; + + wchar_t* path16 = Utf8ToUtf16( path, path16Stack, BUF16_STACK_LEN ); + if( !path16 ) + return false; + + if( access == FileAccess::None ) + access = FileAccess::Read; + + const DWORD dwShareMode = FILE_SHARE_READ; + const DWORD dwCreationDisposition = mode == FileMode::Create ? CREATE_ALWAYS : + mode == FileMode::Open ? OPEN_ALWAYS : + OPEN_EXISTING; + DWORD dwFlags = FILE_ATTRIBUTE_NORMAL; + DWORD dwAccess = 0; + + if( IsFlagSet( flags, FileFlags::NoBuffering ) ) + dwFlags = FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH; + + if( IsFlagSet( access, FileAccess::Read ) ) + dwAccess = GENERIC_READ; + + if( IsFlagSet( access, FileAccess::Write ) ) + dwAccess |= GENERIC_WRITE; + + HANDLE fd = CreateFile( path16, dwAccess, dwShareMode, NULL, + dwCreationDisposition, dwFlags, NULL ); + + if( fd != INVALID_HANDLE_VALUE ) + { + // Get the block (cluster) size + size_t blockSize; + + if( !GetFileClusterSize( fd, blockSize ) ) + Log::Error( "Failed to obtain file block size. Defaulting to %llu, but writes may fail.", blockSize ); + + file._fd = fd; + file._blockSize = blockSize; + file._writePosition = 0; + file._readPosition = 0; + file._access = access; + file._flags = flags; + file._error = 0; + + // #TODO: Seek to end if appending? + } + else + { + // #TODO: Use GetLastError report error in utf8 + file. _error = (int)GetLastError(); + } + + if( path16 != path16Stack ) + free( path16 ); + + return fd != INVALID_HANDLE_VALUE; +} + +//----------------------------------------------------------- +void FileStream::Close() +{ + if( !HasValidFD() ) + return; + + #if _DEBUG + BOOL r = + #endif + + CloseHandle( _fd ); + + #if _DEBUG + ASSERT( r ); + #endif + + _fd = INVALID_HANDLE_VALUE; + _writePosition = 0; + _readPosition = 0; + _access = FileAccess::None; + _error = 0; + _blockSize = 0; +} + +//----------------------------------------------------------- +ssize_t FileStream::Read( void* buffer, size_t size ) +{ + ASSERT( buffer ); + + if( buffer == nullptr ) + return -1; + + if( !IsFlagSet( _access, FileAccess::Read ) ) + return -1; + + if( !HasValidFD() ) + return -1; + + if( size < 1 ) + return 0; + + DWORD bytesToRead = size > std::numeric_limits::max() ? + std::numeric_limits::max() : + (DWORD)size; + + if( IsFlagSet( _flags, FileFlags::NoBuffering ) ) + { + // #NOTE: See comment on Write() about this. + bytesToRead = (DWORD)( bytesToRead / _blockSize * _blockSize ); + } + + DWORD bytesRead = 0; + + // Cap size to 32-bit range + const BOOL r = ReadFile( _fd, buffer, bytesToRead, &bytesRead, NULL ); + + if( r ) + _readPosition += (size_t)bytesRead; + else + { + _error = (int)GetLastError(); + bytesRead = -1; + } + + return (ssize_t)bytesRead; +} + +//----------------------------------------------------------- +ssize_t FileStream::Write( const void* buffer, size_t size ) +{ + ASSERT( buffer ); + ASSERT( size ); + ASSERT( _fd ); + + if( buffer == nullptr ) + return -1; + + if( !IsFlagSet( _access, FileAccess::Write ) ) + return -1; + + if( !HasValidFD() ) + return -1; + + if( size < 1 ) + return 0; + + DWORD bytesToWrite = size > std::numeric_limits::max() ? + std::numeric_limits::max() : + (DWORD)size; + + if( IsFlagSet( _flags, FileFlags::NoBuffering ) ) + { + // We can only write in block sizes. But since the user may have + // specified a size greater than DWORD, our clamping it to + // DWORD's max can cause it to become not bounded to block size, + // even if the user's original size was block-bound. + // So let's limit this to a block size. + bytesToWrite = (DWORD)(bytesToWrite / _blockSize * _blockSize); + } + + DWORD bytesWritten = 0; + BOOL r = WriteFile( _fd, buffer, bytesToWrite, &bytesWritten, NULL ); + + if( r ) + _writePosition += (size_t)bytesWritten; + else + { + _error = (int)GetLastError(); + bytesWritten = -1; + } + + return bytesWritten; +} + +//---------------------------------------------------------- +bool FileStream::Reserve( ssize_t size ) +{ + // #TODO: Use SetFileValidData()? + // #See: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfilevaliddata + + return false; +} + +//---------------------------------------------------------- +bool FileStream::Seek( int64 offset, SeekOrigin origin ) +{ + if( !IsOpen() || !HasValidFD() ) + return false; + + DWORD whence; + switch( origin ) + { + case SeekOrigin::Begin : whence = FILE_BEGIN ; break; + case SeekOrigin::Current: whence = FILE_CURRENT; break; + case SeekOrigin::End : whence = FILE_END ; break; + default: return false; + } + + LARGE_INTEGER distanceToMove, newPosition; + distanceToMove.QuadPart = offset; + + const BOOL r = ::SetFilePointerEx( _fd, distanceToMove, &newPosition, whence ); + + if( !r ) + _error = GetLastError(); + + _writePosition = (size_t)newPosition.QuadPart; + _readPosition = (size_t)newPosition.QuadPart; + + return (bool)r; +} + +//----------------------------------------------------------- +bool FileStream::Flush() +{ + if( !IsOpen() || !HasValidFD() ) + return false; + + const BOOL r = FlushFileBuffers( _fd ); + + if( !r ) + _error = GetLastError(); + + return (bool)r; +} + +//----------------------------------------------------------- +bool FileStream::IsOpen() const +{ + return HasValidFD(); +} + +//----------------------------------------------------------- +bool FileStream::Exists( const char* path ) +{ + ASSERT( path ); + if( !path || !*path ) + return false; + + wchar_t stackBuffer[BUF16_STACK_LEN]; + + wchar_t* path16 = Utf8ToUtf16( path, stackBuffer, BUF16_STACK_LEN ); + if( !path16 ) + { + Log::Error( "FileStream::Exists() Failed to convert path to utf16." ); + return false; + } + + bool exists = true; + + const DWORD r = GetFileAttributesW( path16 ); + + if( r == INVALID_FILE_ATTRIBUTES ) + exists = false; + + if( path16 != stackBuffer ) + free( path16 ); + + return exists; +} + +//----------------------------------------------------------- +wchar_t* Utf8ToUtf16( const char* utf8Str, wchar_t* stackBuffer16, const size_t stackBuf16Size ) +{ + const size_t length8 = strlen( utf8Str ); + + if( length8 < 1 ) + return nullptr; + + if( length8 > std::numeric_limits::max() ) + { + Log::Error( "File path is too long." ); + return nullptr; + } + + + const int requiredLen16 = MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8Str, (int)length8, NULL, 0 ) + 1; + + if( requiredLen16 <= 1 ) + { + Log::Error( "Could not get encoded file path length." ); + return nullptr; + } + + wchar_t* str16 = nullptr; + + if( requiredLen16 <= stackBuf16Size ) + { + str16 = stackBuffer16; + } + else + { + str16 = (wchar_t*)malloc( sizeof( wchar_t ) * (size_t)requiredLen16 ); + if( !str16 ) + { + Log::Error( "Failed to allocate file path buffer." ); + return nullptr; + } + } + + const int numEncoded = MultiByteToWideChar( + CP_UTF8, MB_PRECOMPOSED, + utf8Str, (int)length8, + str16, requiredLen16 + ); + + ASSERT( numEncoded == requiredLen16-1 ); + + str16[numEncoded] = 0; + + return str16; +} + +//----------------------------------------------------------- +//bool GetFileClusterSize( wchar_t* filePath, size_t& outClusterSize ) +bool GetFileClusterSize( HANDLE hFile, size_t& outClusterSize ) +{ + outClusterSize = 4096; + + ASSERT( hFile != INVALID_HANDLE_VALUE ); + + FILE_STORAGE_INFO info = { 0 }; + const BOOL r = GetFileInformationByHandleEx( hFile, FileStorageInfo, &info, (DWORD)sizeof( info ) ); + + if( r ) + outClusterSize = info.PhysicalBytesPerSectorForPerformance; + + return (bool)r; + // + //ASSERT( filePath ); + + //// Get path to the device + //if (!PathStripToRootW( filePath ) ) + // return false; + // + //const size_t len = std::char_traits::length( filePath ); + + //// #TODO: Do this properly by copying to another buffer that we're sure has enough size + //memmove( filePath + 4, filePath, (len + 1) * sizeof( wchar_t ) ); + //filePath[0] = u'\\'; + //filePath[1] = u'\\'; + //filePath[2] = u'.' ; + //filePath[3] = u'\\'; + + //HANDLE hDevice = INVALID_HANDLE_VALUE; + + //// #See: https://docs.microsoft.com/en-us/windows/win32/devio/calling-deviceiocontrol + //hDevice = CreateFileW( filePath, // drive to open + // 0, // no access to the drive + // FILE_SHARE_READ | // share mode + // FILE_SHARE_WRITE, + // NULL, // default security attributes + // OPEN_EXISTING, // disposition + // 0, // file attributes + // NULL ); + + //if( hDevice == INVALID_HANDLE_VALUE ) + // return false; + + //STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR desc = { 0 }; + //DWORD bytesReturned; + + //STORAGE_PROPERTY_QUERY spq = { StorageAccessAlignmentProperty, PropertyStandardQuery }; + + //BOOL r = DeviceIoControl( + // hDevice, + // IOCTL_STORAGE_QUERY_PROPERTY, + // &spq, sizeof( spq ), + // &desc, sizeof( desc ), + // &bytesReturned, + // NULL ); + // + //// MS recommends the use the physical sector size + //// #See: https://docs.microsoft.com/en-us/windows/win32/fileio/file-buffering + //if( r ) + // outClusterSize = desc.BytesPerPhysicalSector; + //else + //{ + // const DWORD err = GetLastError(); + // Log::Error( "Error getting block size: %d (0x%x)", err ); + //} + + //CloseHandle( hDevice ); + + //return (bool)r; +} \ No newline at end of file diff --git a/src/platform/win32/SysHost_Win32.cpp b/src/platform/win32/SysHost_Win32.cpp index 47b8926c..d3ab683a 100644 --- a/src/platform/win32/SysHost_Win32.cpp +++ b/src/platform/win32/SysHost_Win32.cpp @@ -1,8 +1,70 @@ #include "SysHost.h" #include "Platform.h" #include "Util.h" +#include "util//Log.h" #include +#include +#include + +/* +* Based on source from libSodium: ref: https://github.com/jedisct1/libsodium/blob/master/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +* ISC License +* Copyright( c ) 2013 - 2020 +* Frank Denis +*/ +#define RtlGenRandom SystemFunction036 +extern "C" BOOLEAN NTAPI RtlGenRandom( PVOID RandomBuffer, ULONG RandomBufferLength ); +#pragma comment( lib, "advapi32.lib" ) + +// Helper structs to help us iterate these variable-length structs +template +class PocessorInfoIter +{ + using ProcInfo = SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; + + byte* _current; + const byte* _end ; + +public: + //----------------------------------------------------------- + inline PocessorInfoIter( SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* info, DWORD size ) + : _current( (byte*)info ) + , _end ( ((byte*)info) + size ) + {} + + //----------------------------------------------------------- + inline bool HasNext() const + { + return _current < _end; + } + + //----------------------------------------------------------- + inline T& Next() + { + ASSERT( this->HasNext() ); + + ProcInfo* info = (ProcInfo*)_current; + + T& r = *(T*)&info->Processor; + + _current += info->Size; + return r; + } +}; + +static GROUP_RELATIONSHIP* _procGroupInfo = nullptr; + + +//----------------------------------------------------------- +size_t SysHost::GetPageSize() +{ + SYSTEM_INFO info; + ::GetSystemInfo( &info ); + + const size_t pageSize = (size_t)info.dwPageSize; + return pageSize; +} //----------------------------------------------------------- size_t SysHost::GetTotalSystemMemory() @@ -14,6 +76,7 @@ size_t SysHost::GetTotalSystemMemory() if( !r ) return 0; + // #TODO: Return total virtual... We will let the user use a page file. return statex.ullTotalPhys; } @@ -27,9 +90,16 @@ size_t SysHost::GetAvailableSystemMemory() if( !r ) return 0; + // #TODO: Return total virtual... We will let the user use a page file. return statex.ullAvailPhys; } +//----------------------------------------------------------- +uint SysHost::GetLogicalCPUCount() +{ + return (uint)GetActiveProcessorCount( ALL_PROCESSOR_GROUPS ); +} + //----------------------------------------------------------- void* SysHost::VirtualAlloc( size_t size, bool initialize ) { @@ -43,8 +113,7 @@ void* SysHost::VirtualAlloc( size_t size, bool initialize ) if( ptr && initialize ) { - // Initialize memory - // (since physical pages are not allocated until the actual pages are accessed) + // Fault memory pages byte* page = (byte*)ptr; @@ -62,23 +131,381 @@ void* SysHost::VirtualAlloc( size_t size, bool initialize ) } //----------------------------------------------------------- -uint64 SysHost::SetCurrentProcessAffinityMask( uint64 mask ) +void SysHost::VirtualFree( void* ptr ) { - HANDLE hProcess = ::GetCurrentProcess(); + ASSERT( ptr ); + if( !ptr ) + return; - BOOL r = ::SetProcessAffinityMask( hProcess, mask ); - ASSERT( r ); + const BOOL r = ::VirtualFree( (LPVOID)ptr, 0, MEM_RELEASE ); + if( !r ) + { + const DWORD err = GetLastError(); + Log::Error( "VirtualFree() failed with error: %d", err ); + } +} - return r ? mask : 0; +//----------------------------------------------------------- +bool SysHost::VirtualProtect( void* ptr, size_t size, VProtect flags ) +{ + ASSERT( ptr ); + + // #TODO: Implement me + return true; } //----------------------------------------------------------- -uint64 SysHost::SetCurrentThreadAffinityMask( uint64 mask ) +// uint64 SysHost::SetCurrentProcessAffinityMask( uint64 mask ) +// { +// HANDLE hProcess = ::GetCurrentProcess(); + +// BOOL r = ::SetProcessAffinityMask( hProcess, mask ); +// ASSERT( r ); + +// return r ? mask : 0; +// } + +// //----------------------------------------------------------- +// uint64 SysHost::SetCurrentThreadAffinityMask( uint64 mask ) +// { +// HANDLE hThread = ::GetCurrentThread(); +// +// const uint64 oldMask = ::SetThreadAffinityMask( hThread, mask ); +// +// if( oldMask == 0 ) +// return 0; +// +// return mask; +// } + +//----------------------------------------------------------- +bool SysHost::SetCurrentThreadAffinityCpuId( uint32 cpuId ) { + ASSERT( cpuId < (uint)GetActiveProcessorCount( ALL_PROCESSOR_GROUPS ) ); + HANDLE hThread = ::GetCurrentThread(); - uint64 newMask = ::SetThreadAffinityMask( hThread, mask ); - ASSERT( newMask = mask ); + // #TODO: We might have to check for single-node system with more than 64 threads. + // If in NUMA, we need to find the correct process group given a cpuId + const NumaInfo* numa = GetNUMAInfo(); + if( numa ) + { + ASSERT( _procGroupInfo ); + + WORD processGroupId = 0; + + // Shave-out any process groups below the requested one + for( WORD i = 0; i < _procGroupInfo->ActiveGroupCount; i++ ) + { + const uint groupProcCount = _procGroupInfo->GroupInfo[i].ActiveProcessorCount; + if( cpuId < groupProcCount ) + { + processGroupId = i; + break; + } + + cpuId -= groupProcCount; + } + + // Move this thread to the target process group + GROUP_AFFINITY grpAffinity, prevGprAffinity; + + ZeroMem( &grpAffinity ); + grpAffinity.Mask = 1ull << cpuId; + grpAffinity.Group = processGroupId; + if( !SetThreadGroupAffinity( hThread, &grpAffinity, &prevGprAffinity ) ) + { + const DWORD err = GetLastError(); + Log::Error( "Error: Failed to set thread group affinity with error: %d (0x%x).", err, err ); + return false; + } + } + + const uint64 mask = 1ull << cpuId; + const uint64 oldMask = (uint64)::SetThreadAffinityMask( hThread, mask ); + + if( oldMask == 0 ) + { + const DWORD err = GetLastError(); + Log::Error( "Error: Failed to set thread affinity with error: %d (0x%x).", err, err ); + } + + return oldMask != 0; +} + +//----------------------------------------------------------- +void SysHost::InstallCrashHandler() +{ + // #TODO: Implement me +} + +//----------------------------------------------------------- +void SysHost::Random( byte* buffer, size_t size ) +{ + if( !RtlGenRandom( (PVOID)buffer, (ULONG)size ) ) + { + Fatal( "System entropy gen failure." ); + } +} + +// #SEE: https://docs.microsoft.com/en-us/windows/win32/procthread/numa-support +// #SEE: https://docs.microsoft.com/en-us/windows/win32/procthread/processor-groups +// #NOTE: This is not thread-safe on the first time is called +//----------------------------------------------------------- +const NumaInfo* SysHost::GetNUMAInfo() +{ + // #TODO: Check _WIN32_WINNT >= 0x0601 + // Build 20348 + // and support new NUMA method/API. + + static NumaInfo _info; + static NumaInfo* _pInfo = nullptr; + + if( !_pInfo ) + { + uint nodeCount = 0; + + if( !GetNumaHighestNodeNumber( (PULONG)&nodeCount ) ) + { + const DWORD err = GetLastError(); + Log::Error( "Warning: Failed to get NUMA info with error %d (0x%x).", err, err ); + return nullptr; + } + + // The above returns the highest node index (0-based), we want the count. + nodeCount++; + + if( nodeCount < 2 ) + return nullptr; + + ZeroMem( &_info ); + + uint procGroupCount = 0; + uint totalCpuCount = 0; + + // Get number of processor groups in this system + procGroupCount = (uint)GetActiveProcessorGroupCount(); + if( procGroupCount == 0 ) + { + const DWORD err = GetLastError(); + Fatal( "GetActiveProcessorGroupCount() failed with error: %d (0x%x).", err, err ); + } + + // Get the total number of active CPUs + totalCpuCount = (uint)GetActiveProcessorCount( ALL_PROCESSOR_GROUPS ); + if( totalCpuCount == 0 ) + { + const DWORD err = GetLastError(); + Fatal( "GetActiveProcessorCount() failed with error: %d (0x%x).", err, err ); + } + + // Allocate required buffers + _info.cpuIds = ( Span* )malloc( sizeof( Span ) * nodeCount ); + FatalIf( !_info.cpuIds, "Failed to allocate NUMA node buffer." ); + memset( _info.cpuIds, 0, sizeof( Span ) * nodeCount ); + + uint* cpuIds = (uint*)malloc( sizeof( uint ) * totalCpuCount ); + FatalIf( !cpuIds, "Failed to allocate CPU id buffer." ); + memset( cpuIds, 0, sizeof( uint ) * totalCpuCount ); + + + // Get nodes & process group information + DWORD nodeInfoLength = 0, procInfoLength = 0; + DWORD result = 0; + + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* nodeInfo = nullptr, *procInfo = nullptr; + + // Get node info size + if( GetLogicalProcessorInformationEx( RelationNumaNode, nullptr, &nodeInfoLength ) ) + Fatal( "Unexpected result from GetLogicalProcessorInformationEx( RelationNumaNode )." ); + + result = GetLastError(); + if( result != ERROR_INSUFFICIENT_BUFFER ) + Fatal( "GetLogicalProcessorInformationEx( RelationNumaNode, null ) with error: %d (0x%x).", result, result ); + + ASSERT( nodeInfoLength >= ( sizeof( DWORD ) + sizeof( LOGICAL_PROCESSOR_RELATIONSHIP ) ) ); + + + // Get process info size + if( GetLogicalProcessorInformationEx( RelationGroup, nullptr, &procInfoLength ) ) + Fatal( "Unexpected result from GetLogicalProcessorInformationEx( RelationGroup )." ); + + result = GetLastError(); + if( result != ERROR_INSUFFICIENT_BUFFER ) + Fatal( "GetLogicalProcessorInformationEx( RelationGroup, null ) with error: %d (0x%x).", result, result ); + + ASSERT( procInfoLength >= ( sizeof( DWORD ) + sizeof( LOGICAL_PROCESSOR_RELATIONSHIP ) ) ); + + // Allocate the buffers and fetch the actual info now + nodeInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)malloc( nodeInfoLength ); + procInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)malloc( procInfoLength ); + + if( !nodeInfo ) + Fatal( "Failed to allocate node info buffer." ); + if( !procInfo ) + Fatal( "Failed to allocate processor info buffer." ); + + if( !GetLogicalProcessorInformationEx( RelationNumaNode, nodeInfo, &nodeInfoLength ) ) + { + const DWORD err = GetLastError(); + Fatal( "GetLogicalProcessorInformationEx( RelationNumaNode ) failed with error: %d (0x%x).", err, err ); + } + + if( !GetLogicalProcessorInformationEx( RelationGroup, procInfo, &procInfoLength ) ) + { + const DWORD err = GetLastError(); + Fatal( "GetLogicalProcessorInformationEx( RelationGroup ) failed with error: %d (0x%x).", err, err ); + } + + ASSERT( procInfo->Size == procInfoLength ); // Only expect a single instance here + + + // Save an instance of process group info as we need to refer to it when setting thread affinity + _procGroupInfo = &procInfo->Group; + + // Get info from each node + for( PocessorInfoIter numaIter( nodeInfo, nodeInfoLength ); numaIter.HasNext(); ) + { + const NUMA_NODE_RELATIONSHIP& node = numaIter.Next(); + ASSERT( node.NodeNumber < nodeCount ); + ASSERT( node.GroupMask.Group < procInfo->Group.ActiveGroupCount ); + + const WORD targetGroupId = node.GroupMask.Group; + const PROCESSOR_GROUP_INFO& targetGroup = procInfo->Group.GroupInfo[targetGroupId]; + + // Find the starting cpuId for this group by + // adding all the active processors on the groups before ours + uint cpuBase = 0; + for( WORD i = 0; i < targetGroupId; i++ ) + cpuBase += procInfo->Group.GroupInfo[i].ActiveProcessorCount; + + // Save CPUids for this node + uint* nodeCpus = cpuIds; + for( BYTE i = 0; i < targetGroup.MaximumProcessorCount; i++ ) + { + if( targetGroup.ActiveProcessorMask & ( 1ull << i ) ) + *nodeCpus++ = cpuBase + i; + } + + ASSERT( (intptr_t)( nodeCpus - cpuIds ) == (intptr_t)targetGroup.ActiveProcessorCount ); + + // Save node info + _info.cpuIds[node.NodeNumber].length = targetGroup.ActiveProcessorCount; + _info.cpuIds[node.NodeNumber].values = cpuIds; + + cpuIds += targetGroup.ActiveProcessorCount; + ASSERT( cpuIds == nodeCpus ); + } + + // All done + _info.nodeCount = nodeCount; + _info.cpuCount = totalCpuCount; + _pInfo = &_info; + } + + return _pInfo; +} + +//----------------------------------------------------------- +void SysHost::NumaAssignPages( void* ptr, size_t size, uint node ) +{ + // #TODO: Implement me +} + +//----------------------------------------------------------- +bool SysHost::NumaSetThreadInterleavedMode() +{ + // Not a thing on windows + // #TODO: Remove this function + return false; +} + +//----------------------------------------------------------- +bool SysHost::NumaSetMemoryInterleavedMode( void* ptr, size_t size ) +{ + ASSERT( ptr && size ); + + ULONG nodeCount = 0; + + if( !GetNumaHighestNodeNumber( (PULONG)&nodeCount ) ) + { + const DWORD err = GetLastError(); + Log::Error( "Failed to get NUMA nodes to interleave memory with error %d (0x%x).", err, err ); + return false; + } + + nodeCount++; + + const size_t pageSize = GetPageSize(); + const size_t pageCount = size / pageSize; + + const size_t blockStride = pageSize * nodeCount; + const size_t blockCount = pageCount / nodeCount; + + const byte* pages = (byte*)ptr; + const byte* endPage = pages + pageCount * pageSize; + const byte* endBlock = pages + blockCount * blockStride; + + HANDLE gProcess = GetCurrentProcess(); + + DWORD dwNodes = (DWORD)nodeCount; + + while( pages < endBlock ) + { + for( DWORD i = 0; i < nodeCount; i++ ) + { + LPVOID r = VirtualAllocExNuma( + gProcess, + (LPVOID)pages, pageSize, + MEM_COMMIT, + PAGE_READWRITE, + i ); + + pages += pageSize; + if( !r ) + { + const DWORD err = GetLastError(); + Log::Error( "Failed to assigned memory to NUMA node with error: %d (0x%x).", err, err ); + return false; + } + } + } + + DWORD node = 0; + while( pages < endPage ) + { + LPVOID r = VirtualAllocExNuma( + gProcess, + (LPVOID)pages, pageSize, + MEM_COMMIT, + PAGE_READWRITE, + node++ ); + + if( !r ) + { + const DWORD err = GetLastError(); + Log::Error( "Failed to assigned memory to NUMA node with error: %d (0x%x).", err, err ); + return false; + } + + pages += pageSize; + } + + return true; +} + +//----------------------------------------------------------- +int SysHost::NumaGetNodeFromPage( void* ptr ) +{ + // #TODO: Implement me + // PSAPI_WORKING_SET_EX_INFORMATION info; + + // BOOL r = QueryWorkingSetEx( GetCurrentProcess(), (PVOID)&info, (DWORD)GetPageSize() ); + // if( !r ) + // { + // const DWORD err = GetLastError(); + // Log::Error( "Failed to call QueryWorkingSetEx with error: %d (0x%x).", err, err ); + // } - return newMask; + return -1; } \ No newline at end of file diff --git a/src/platform/win32/Thread_Win32.cpp b/src/platform/win32/Thread_Win32.cpp new file mode 100644 index 00000000..3f1dde1c --- /dev/null +++ b/src/platform/win32/Thread_Win32.cpp @@ -0,0 +1,127 @@ +#include "../../threading/Thread.h" +#include "../../Util.h" +#include "../../Globals.h" +#include "SysHost.h" +#include "util/Log.h" + +//----------------------------------------------------------- +Thread::Thread( size_t stackSize ) +{ + // Configure stack size + if( stackSize < 1024 * 4 ) + Fatal( "Thread stack size is too small." ); + + _state.store( ThreadState::ReadyToRun, std::memory_order_release ); + + _threadId = CreateThread( + NULL, + (SIZE_T)stackSize, + Thread::ThreadStarterWin, + (LPVOID)this, + CREATE_SUSPENDED, + nullptr ); + + if( _threadId == NULL ) + Fatal( "Failed to create thread." ); +} + +//----------------------------------------------------------- +Thread::Thread() : Thread( 8 MB ) {} + +//----------------------------------------------------------- +Thread::~Thread() +{ + const bool didExit = _state.load( std::memory_order_relaxed ) == ThreadState::Exited; + + if( !didExit ) + { + // Thread should have exited already, terminate it abruptly + Log::Error( "Warning: Thread did not exit properly." ); + TerminateThread( _threadId, 0 ); + } + + if( !CloseHandle( _threadId ) ) + Log::Error( "An error occurred when closing a thread." ); + + _threadId = NULL; +} + +//----------------------------------------------------------- +bool Thread::HasExited() const +{ + return _state.load( std::memory_order_relaxed ) == ThreadState::Exited; +} + +//----------------------------------------------------------- +void Thread::Run( ThreadRunner runner, void* param ) +{ + // Ensure we can actually start + ASSERT( runner ); + const bool canRun = _state.load( std::memory_order_relaxed ) == ThreadState::ReadyToRun; + + ASSERT( canRun ); + if( !canRun ) + return; + + // Change the thread state + ThreadState expected = ThreadState::ReadyToRun; + if( !_state.compare_exchange_strong( expected, ThreadState::Running, + std::memory_order_release, + std::memory_order_relaxed ) ) + { + // Another thread ran us first. + return; + } + + _runner = runner; + _runParam = param; + + // Start the thread + const DWORD r = ResumeThread( _threadId ); + if( r != 1 ) + Fatal( "Failed to resume thread %d.", _threadId ); +} + + +//----------------------------------------------------------- +void Thread::Sleep( long milliseconds ) +{ + ::Sleep( (DWORD)milliseconds ); +} + +//----------------------------------------------------------- +bool Thread::WaitForExit( long milliseconds ) +{ + ThreadState state = _state.load( std::memory_order_relaxed ); + if( state == ThreadState::Exited ) + return true; + + const DWORD r = WaitForSingleObject( _threadId, (DWORD)milliseconds ); + if( r != WAIT_TIMEOUT && r != WAIT_OBJECT_0 ) + { + Log::Error( "Thread %d wait for exit failed: %d", _threadId, GetLastError() ); + return false; + } + + return true; +} + +// Thread entry point +//----------------------------------------------------------- +DWORD Thread::ThreadStarterWin( LPVOID param ) +{ + ASSERT( param ); + + Thread* t = (Thread*)param; + ASSERT( t->_state == ThreadState::Running ); + + // Run the thread function + t->_runner( t->_runParam ); + + // Thread has exited + t->_state.store( ThreadState::Exited, std::memory_order_release ); + + // TODO: Signal if waiting to be joined + return 0; +} + diff --git a/src/test/test_numa_sort.cpp b/src/test/test_numa_sort.cpp index 5163736e..2189ba71 100644 --- a/src/test/test_numa_sort.cpp +++ b/src/test/test_numa_sort.cpp @@ -93,7 +93,7 @@ void RadixSortYNUMA( ThreadPool& pool, const uint pageCount = (uint)( (length * sizeof( uint64 )) / pageSize );// (uint)CDiv( length * sizeof( uint64 ), (uint64)pageSize ); const uint nodeCount = numa->nodeCount; const uint pagesPerNode = pageCount / nodeCount; - const uint pagesPerThread = pagesPerNode / numa->cpuIds->length; // #TODO: Only supports nodes with even number of CPUs + const uint pagesPerThread = (uint)(pagesPerNode / numa->cpuIds->length); // #TODO: Only supports nodes with even number of CPUs const uint blockPerPage = pageSize / blockSize; const uint threadCount = numa->cpuCount; @@ -213,7 +213,7 @@ void TestNumaSort( int argc, const char* argv[] ) Fatal( "Failed to interleave yTmpBuffer." ); // Fault pages - const size_t pageCount = CDiv( size, pageSize ); + const size_t pageCount = CDiv( size, (int)pageSize ); byte* pages = (byte*)yBuffer; byte* tmpPages = (byte*)yTmp; @@ -294,7 +294,7 @@ void TestYSort() const uint k = 30; const uint64 len = (1ull << k); - const uint threadCount = std::thread::hardware_concurrency(); + const uint threadCount = SysHost::GetLogicalCPUCount(); ThreadPool pool( threadCount, ThreadPool::Mode::Fixed ); @@ -454,7 +454,7 @@ void NumaRadixSortThread( NumaYSortJob* job ) const uint nodeCount = job->nodeCount; const uint node = job->node; - const uint pageSize = SysHost::GetPageSize(); + const uint pageSize = (uint)SysHost::GetPageSize(); const uint pageCount = job->pageCount; const uint pageStart = job->pageStart; const uint blocksPerPage = pageSize / 64; @@ -822,7 +822,7 @@ void FaultPageThread( FaultPageJob* job ) if( job->id == job->threadCount - 1 ) size += job->size - size * job->threadCount; - const size_t pageCount = CDiv( size, pageSize ); + const size_t pageCount = CDiv( size, (int)pageSize ); for( uint64 i = 0; i < pageCount; i++ ) { @@ -879,7 +879,7 @@ void GenChaChaThread( ChaChaJob* job ) ZeroMem( &chacha ); chacha8_keysetup( &chacha, job->key, 256, NULL ); - chacha8_get_keystream( &chacha, blockIdx, blockCount, (byte*)blocks ); + chacha8_get_keystream( &chacha, blockIdx, (uint)blockCount, (byte*)blocks ); const uint64 length = blocksPerThread * entriesPerBlock; diff --git a/src/threading/Semaphore.cpp b/src/threading/Semaphore.cpp index faf4c04b..10c418e8 100644 --- a/src/threading/Semaphore.cpp +++ b/src/threading/Semaphore.cpp @@ -6,11 +6,18 @@ //----------------------------------------------------------- Semaphore::Semaphore( int initialCount ) + #if PLATFORM_IS_WINDOWS + : _count( initialCount ) + #endif { #if PLATFORM_IS_UNIX int r = sem_init( &_id, 0, initialCount ); if( r != 0 ) Fatal( "sem_init() failed." ); + #elif PLATFORM_IS_WINDOWS + _id = CreateSemaphore( NULL,(LONG)initialCount, std::numeric_limits::max(), NULL ); + if( _id == NULL ) + Fatal( "CreateSemaphore() failed." ); #else #error Unimplemented #endif @@ -22,7 +29,10 @@ Semaphore::~Semaphore() #if PLATFORM_IS_UNIX int r = sem_destroy( &_id ); if( r != 0 ) - Fatal( "sem_destroy() failed." ); + Fatal( "sem_destroy() failed." ); + #elif PLATFORM_IS_WINDOWS + if( !CloseHandle( _id ) ) + Fatal( "CloseHandle( semaphore ) failed." ); #else #error Unimplemented #endif @@ -32,9 +42,13 @@ Semaphore::~Semaphore() void Semaphore::Wait() { #if PLATFORM_IS_UNIX - int r = sem_wait( &_id ); + const int r = sem_wait( &_id ); if( r != 0 ) Fatal( "sem_wait() failed." ); + #elif PLATFORM_IS_WINDOWS + const DWORD r = WaitForSingleObject( _id, INFINITE ); + if( r != WAIT_OBJECT_0 ) + Fatal( "PLATFORM_IS_WINDOWS( semaphore ) failed." ); #else #error Unimplemented #endif @@ -71,6 +85,9 @@ bool Semaphore::Wait( long milliseconds ) #elif PLATFORM_IS_MACOS // #TODO: Implement on macOS with condition variable return false; + #elif PLATFORM_IS_WINDOWS + const DWORD r = WaitForSingleObject( _id, (DWORD)milliseconds ); + return r == WAIT_OBJECT_0 || r == WAIT_TIMEOUT; #else #error Unimplemented #endif @@ -88,6 +105,8 @@ int Semaphore::GetCount() Fatal( "sem_getvalue() failed." ); return value; + #elif PLATFORM_IS_WINDOWS + return _count.load( std::memory_order::memory_order_release ); #else #error Unimplemented #endif @@ -99,7 +118,15 @@ void Semaphore::Release() #if PLATFORM_IS_UNIX int r = sem_post( &_id ); if( r != 0 ) - Fatal( "sem_post() failed." ); + Fatal( "sem_post() failed." ); + #elif PLATFORM_IS_WINDOWS + LONG prevCount; + BOOL r = ::ReleaseSemaphore( _id, 1, &prevCount ); + + if( !r ) + Fatal( "ReleaseSemaphore() failed." ); + + _count++; #else #error Unimplemented #endif diff --git a/src/threading/Semaphore.h b/src/threading/Semaphore.h index 86e5008d..8bc6c37e 100644 --- a/src/threading/Semaphore.h +++ b/src/threading/Semaphore.h @@ -1,5 +1,6 @@ #pragma once #include "Platform.h" +#include /// These are lightweight single-process semaphores. /// (As opposed to system-wide "named" semaphores) @@ -18,4 +19,8 @@ class Semaphore private: SemaphoreId _id; + +#if PLATFORM_IS_WINDOWS + std::atomic _count; +#endif }; \ No newline at end of file diff --git a/src/threading/Thread.h b/src/threading/Thread.h index 51940ba3..09f7282c 100644 --- a/src/threading/Thread.h +++ b/src/threading/Thread.h @@ -12,7 +12,7 @@ class Thread Thread(); ~Thread(); - static uint64 SetAffinity( uint64 affinity ); +// static uint64 SetAffinity( uint64 affinity ); // void SetName( const char* name ); void Run( ThreadRunner runner, void* param ); @@ -25,7 +25,14 @@ class Thread bool HasExited() const; private: - static void* ThreadStarter( Thread* thread ); + + #if PLATFORM_IS_UNIX + static void* ThreadStarterUnix( Thread* thread ); + #elif PLATFORM_IS_WINDOWS + static DWORD ThreadStarterWin( LPVOID ); + #else + #error Unimplemented + #endif private: ThreadId _threadId = 0; diff --git a/sync b/sync deleted file mode 100755 index 1be7936e..00000000 --- a/sync +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -# set -x -set -e - -_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -proj=bladebit -builds=builds - -function sync_proj() -{ - plat=$1 - - echo "syncing make & vscode $plat" >&2 - mkdir -p "$builds/$plat" - - psync -t make $proj "$plat" "$builds/$plat" - psync -t vscode $proj "$plat" $_dir -} - -sync_proj win32 -sync_proj linux -sync_proj macos -# sync_proj web - -echo "syncing visual studio win32" -psync -t vs $proj win32 "$_dir/${proj}.vcxproj" - -echo "All synced." -exit 0 \ No newline at end of file From 8bb92ebcbf6265bbafbbd0211ee889701ddcaa1b Mon Sep 17 00:00:00 2001 From: Harold Brenes Date: Thu, 30 Sep 2021 18:18:06 -0500 Subject: [PATCH 2/3] Added --memory and --memory-json cli options Added --memory and --memory-json cli options --- src/main.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a62f5189..7b62ef87 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -121,6 +121,11 @@ R"( This is useful when running multiple simultaneous instances of bladebit as you can manually assign thread affinity yourself when launching bladebit. + + --memory : Display system memory available, in bytes, and the + required memory to run Bladebit, in bytes. + + --memory-json : Same as --memory, but formats the output as json. --version : Display current version. )"; @@ -264,7 +269,7 @@ void ParseCommandLine( int argc, const char* argv[], Config& cfg ) const char* val = value(); int64 v = 0; - int r = sscanf( val, "%lli", &v ); + int r = sscanf( val, "%lld", &v ); if( r != 1 ) Fatal( "Invalid value for argument '%s'.", arg ); @@ -371,6 +376,31 @@ void ParseCommandLine( int argc, const char* argv[], Config& cfg ) { Log::SetVerbose( true ); } + else if( check( "--memory" ) ) + { + // #TODO: Get this value from Memplotter + const size_t requiredMem = 416ull GB; + const size_t availableMem = SysHost::GetAvailableSystemMemory(); + const size_t totalMem = SysHost::GetTotalSystemMemory(); + + Log::Line( "required : %llu", requiredMem ); + Log::Line( "total : %llu", totalMem ); + Log::Line( "available: %llu", availableMem ); + + exit( 0 ); + } + else if( check( "--memory-json" ) ) + { + // #TODO: Get this value from Memplotter + const size_t requiredMem = 416ull GB; + const size_t availableMem = SysHost::GetAvailableSystemMemory(); + const size_t totalMem = SysHost::GetTotalSystemMemory(); + + Log::Line( "{ \"required\": %llu, \"total\": %llu, \"available\": %llu }", + requiredMem, totalMem, availableMem ); + + exit( 0 ); + } else if( check( "--version" ) ) { Log::Line( BLADEBIT_VERSION_STR ); From 8dcd54bf527f7722e37007fcf7379d66fa962f54 Mon Sep 17 00:00:00 2001 From: Harold Brenes Date: Thu, 30 Sep 2021 18:24:23 -0500 Subject: [PATCH 3/3] Bumping version to 1.2.0 --- src/Version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Version.h b/src/Version.h index 4ac3e28e..7553d13c 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1,8 +1,8 @@ #pragma once #define BLADEBIT_VERSION_MAJ 1 -#define BLADEBIT_VERSION_MIN 1 -#define BLADEBIT_VERSION_REV 1 +#define BLADEBIT_VERSION_MIN 2 +#define BLADEBIT_VERSION_REV 0 #define BLADEBIT_VERSION \ ((uint64)BLADEBIT_VERSION_MAJ) << 32 \