Compare commits
1 Commits
master
...
size-t-mac
Author | SHA1 | Date | |
---|---|---|---|
|
9d920f58c3 |
88
.github/workflows/build-alpine.yml
vendored
88
.github/workflows/build-alpine.yml
vendored
@@ -1,88 +0,0 @@
|
|||||||
name: Build Alpine Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
PKG_VERSION: "2.2.0"
|
|
||||||
PKG_RELEASE: "1"
|
|
||||||
ABSEIL_VERSION: "20230125.3"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-alpine:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: node:current-alpine
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Install Git
|
|
||||||
run: |
|
|
||||||
apk add --no-cache git
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Install Alpine Packaging Dependencies
|
|
||||||
run: |
|
|
||||||
apk update
|
|
||||||
apk add alpine-sdk cmake clang llvm linux-headers zlib-dev zlib-static openssl-dev openssl-libs-static musl-dev
|
|
||||||
|
|
||||||
- name: Build Static Abseil
|
|
||||||
run: |
|
|
||||||
git clone https://github.com/abseil/abseil-cpp.git
|
|
||||||
cd abseil-cpp
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
|
||||||
-DABSL_BUILD_TESTING=OFF \
|
|
||||||
-DABSL_USE_GOOGLETEST_HEAD=OFF \
|
|
||||||
-DCMAKE_CXX_STANDARD=17 \
|
|
||||||
-DBUILD_SHARED_LIBS=OFF \
|
|
||||||
..
|
|
||||||
make -j$(nproc)
|
|
||||||
make install
|
|
||||||
|
|
||||||
- name: Build cpu-check Alpine Package
|
|
||||||
run: |
|
|
||||||
mkdir -p alpine_build && cd alpine_build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DUSE_CLANG=ON \
|
|
||||||
-DBUILD_STATIC=ON \
|
|
||||||
..
|
|
||||||
make
|
|
||||||
# Create package metadata
|
|
||||||
mkdir -p pkg/APKBUILD
|
|
||||||
cat > pkg/APKBUILD/APKBUILD << EOF
|
|
||||||
# Contributor: Maintainer <maintainer@example.com>
|
|
||||||
# Maintainer: Maintainer <maintainer@example.com>
|
|
||||||
pkgname=cpu-check
|
|
||||||
pkgver=${{ env.PKG_VERSION }}
|
|
||||||
pkgrel=${{ env.PKG_RELEASE }}
|
|
||||||
pkgdesc="CPU validation and stress testing tool"
|
|
||||||
url="https://github.com/google/cpu-check"
|
|
||||||
arch="x86_64"
|
|
||||||
license="Apache-2.0"
|
|
||||||
depends=""
|
|
||||||
makedepends="cmake clang llvm linux-headers zlib-dev zlib-static openssl-dev openssl-libs-static musl-dev"
|
|
||||||
source=""
|
|
||||||
options="!check"
|
|
||||||
EOF
|
|
||||||
make apk
|
|
||||||
|
|
||||||
- name: Upload cpu-check Alpine Package
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: cpu-check-alpine
|
|
||||||
path: alpine_build/*.apk
|
|
||||||
|
|
||||||
- name: Upload to Gitea Alpine Package Registry
|
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
run: |
|
|
||||||
apk add --no-cache curl
|
|
||||||
curl --user "eric:df299a6e592a8bd829d018b7816e76d03756408d" \
|
|
||||||
--upload-file alpine_build/cpu-check-${{ env.PKG_VERSION }}-r${{ env.PKG_RELEASE }}.apk \
|
|
||||||
"https://git.ericxliu.me/api/packages/eric/alpine/v3.17/main"
|
|
85
.github/workflows/build-debian.yml
vendored
85
.github/workflows/build-debian.yml
vendored
@@ -1,85 +0,0 @@
|
|||||||
name: Build Debian Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
PKG_VERSION: "2.2.0"
|
|
||||||
PKG_RELEASE: "1"
|
|
||||||
ABSEIL_VERSION: "20230125.3"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-debian:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y build-essential cmake clang checkinstall zlib1g-dev musl-tools libstdc++-11-dev libgcc-11-dev libc6-dev
|
|
||||||
|
|
||||||
- name: Build Static Abseil
|
|
||||||
run: |
|
|
||||||
git clone https://github.com/abseil/abseil-cpp.git
|
|
||||||
cd abseil-cpp
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
|
||||||
-DABSL_BUILD_TESTING=OFF \
|
|
||||||
-DABSL_USE_GOOGLETEST_HEAD=OFF \
|
|
||||||
-DCMAKE_CXX_STANDARD=17 \
|
|
||||||
-DBUILD_SHARED_LIBS=OFF \
|
|
||||||
..
|
|
||||||
make -j$(nproc)
|
|
||||||
make install
|
|
||||||
ldconfig
|
|
||||||
|
|
||||||
- name: Configure the project
|
|
||||||
run: |
|
|
||||||
mkdir build; cd build
|
|
||||||
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DUSE_CLANG=ON \
|
|
||||||
-DBUILD_STATIC=ON \
|
|
||||||
..
|
|
||||||
|
|
||||||
- name: Build the project
|
|
||||||
run: |
|
|
||||||
cd build
|
|
||||||
make
|
|
||||||
|
|
||||||
- name: Create Debian Package
|
|
||||||
run: |
|
|
||||||
cd build
|
|
||||||
sudo checkinstall --pkgname=cpu-check \
|
|
||||||
--pkgversion=${{ env.PKG_VERSION }} \
|
|
||||||
--pkgrelease=${{ env.PKG_RELEASE }} \
|
|
||||||
--maintainer="maintainer@example.com" \
|
|
||||||
--requires="" \
|
|
||||||
--default \
|
|
||||||
--pakdir=. \
|
|
||||||
--backup=no \
|
|
||||||
--deldoc=yes \
|
|
||||||
--deldesc=yes \
|
|
||||||
--delspec=yes \
|
|
||||||
make install
|
|
||||||
|
|
||||||
- name: Upload Debian Package
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: cpu-check-deb
|
|
||||||
path: build/*.deb
|
|
||||||
|
|
||||||
- name: Upload to Gitea Package Registry
|
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
run: |
|
|
||||||
curl --user "eric:df299a6e592a8bd829d018b7816e76d03756408d" \
|
|
||||||
--upload-file build/cpu-check_${{ env.PKG_VERSION }}-${{ env.PKG_RELEASE }}_amd64.deb \
|
|
||||||
"https://git.ericxliu.me/api/packages/eric/debian/pool/bionic/main/upload"
|
|
43
.gitignore
vendored
43
.gitignore
vendored
@@ -1,43 +0,0 @@
|
|||||||
# CMake build directories
|
|
||||||
build/
|
|
||||||
CMakeFiles/
|
|
||||||
CMakeCache.txt
|
|
||||||
cmake_install.cmake
|
|
||||||
compile_commands.json
|
|
||||||
CTestTestfile.cmake
|
|
||||||
Testing/
|
|
||||||
_deps/
|
|
||||||
|
|
||||||
# Compiled files
|
|
||||||
*.o
|
|
||||||
*.obj
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
*.app
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# IDE specific files
|
|
||||||
.vscode/
|
|
||||||
.idea/
|
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
Makefile
|
|
||||||
*.make
|
|
||||||
*.cmake
|
|
||||||
!CMakeLists.txt
|
|
||||||
|
|
||||||
# Dependencies
|
|
||||||
_deps/
|
|
||||||
vcpkg_installed/
|
|
||||||
|
|
||||||
# Debug symbols
|
|
||||||
*.pdb
|
|
||||||
*.dSYM/
|
|
||||||
|
|
||||||
# Generated documentation
|
|
||||||
docs/_build/
|
|
@@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 3.2)
|
cmake_minimum_required (VERSION 3.2)
|
||||||
project (cpu_check VERSION 2.2.0 LANGUAGES C CXX)
|
project (cpu_check VERSION 20181130 LANGUAGES C CXX)
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
# Use clang/llvm by default.
|
# Use clang/llvm by default.
|
||||||
@@ -136,12 +136,3 @@ target_link_libraries(silkscreen utils)
|
|||||||
target_link_libraries(cpu_check avx compressor crc32c crypto fvt_controller hasher malign_buffer pattern_generator silkscreen utils)
|
target_link_libraries(cpu_check avx compressor crc32c crypto fvt_controller hasher malign_buffer pattern_generator silkscreen utils)
|
||||||
|
|
||||||
install (TARGETS cpu_check DESTINATION bin)
|
install (TARGETS cpu_check DESTINATION bin)
|
||||||
|
|
||||||
# Alpine package target
|
|
||||||
add_custom_target(apk
|
|
||||||
COMMAND mkdir -p "${CMAKE_BINARY_DIR}/pkg/usr/bin"
|
|
||||||
COMMAND cp "${CMAKE_BINARY_DIR}/cpu_check" "${CMAKE_BINARY_DIR}/pkg/usr/bin/"
|
|
||||||
COMMAND cd "${CMAKE_BINARY_DIR}" && tar -czf "cpu-check-${PROJECT_VERSION}-r$ENV{PKG_RELEASE}.apk" -C pkg .
|
|
||||||
DEPENDS cpu_check
|
|
||||||
COMMENT "Creating Alpine package"
|
|
||||||
)
|
|
||||||
|
6
avx.cc
6
avx.cc
@@ -102,7 +102,7 @@ std::string Avx::Avx256(int rounds) {
|
|||||||
x[2] = _mm256_mul_pd(minus_four, a[2]);
|
x[2] = _mm256_mul_pd(minus_four, a[2]);
|
||||||
x[3] = _mm256_mul_pd(minus_four, a[3]);
|
x[3] = _mm256_mul_pd(minus_four, a[3]);
|
||||||
}
|
}
|
||||||
for (int k = 1; k < 4; k++) {
|
for (int k = 0; k < 4; k++) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (gross_x[k][i] != gross_x[k][0]) {
|
if (gross_x[k][i] != gross_x[k][0]) {
|
||||||
return "avx256 pd";
|
return "avx256 pd";
|
||||||
@@ -140,7 +140,7 @@ std::string Avx::Avx256FMA(int rounds) {
|
|||||||
x[2] = _mm256_mul_pd(minus_four, a[2]);
|
x[2] = _mm256_mul_pd(minus_four, a[2]);
|
||||||
x[3] = _mm256_mul_pd(minus_four, a[3]);
|
x[3] = _mm256_mul_pd(minus_four, a[3]);
|
||||||
}
|
}
|
||||||
for (int k = 1; k < 4; k++) {
|
for (int k = 0; k < 4; k++) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (gross_x[k][i] != gross_x[k][0]) {
|
if (gross_x[k][i] != gross_x[k][0]) {
|
||||||
return "avx256 pd";
|
return "avx256 pd";
|
||||||
@@ -182,7 +182,7 @@ std::string Avx::Avx512(int rounds) {
|
|||||||
x[3] = _mm512_mul_pd(minus_four, a[3]);
|
x[3] = _mm512_mul_pd(minus_four, a[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int k = 1; k < 4; k++) {
|
for (int k = 0; k < 4; k++) {
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
if (gross_x[k][i] != gross_x[k][0]) {
|
if (gross_x[k][i] != gross_x[k][0]) {
|
||||||
return "avx512 pd";
|
return "avx512 pd";
|
||||||
|
@@ -444,8 +444,9 @@ Worker::Choices Worker::MakeChoices(BufferSet *b) {
|
|||||||
Json("hash", c.hasher->Name()), ", ",
|
Json("hash", c.hasher->Name()), ", ",
|
||||||
Json("copy", MalignBuffer::ToString(c.copy_method)), ", ",
|
Json("copy", MalignBuffer::ToString(c.copy_method)), ", ",
|
||||||
Json("memset", c.use_repstos ? "rep;sto" : "memset"), ", ",
|
Json("memset", c.use_repstos ? "rep;sto" : "memset"), ", ",
|
||||||
JsonBool("madvise", c.madvise), ", ", Json("size", c.buf_size), ", ",
|
JsonBool("madvise", c.madvise), ", ",
|
||||||
Json("pid", pid_), ", ", Json("round", round_), ", ", c.hole.ToString());
|
Json("size", static_cast<uint64_t>(c.buf_size)), ", ", Json("pid", pid_),
|
||||||
|
", ", Json("round", round_), ", ", c.hole.ToString());
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@@ -15,13 +15,12 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "fvt_controller.h"
|
#include "fvt_controller.h"
|
||||||
|
|
||||||
|
#include <error.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <system_error> // for std::system_error
|
|
||||||
#include <cerrno> // for errno
|
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
@@ -127,12 +127,7 @@ void MalignBuffer::InitializeMemoryForSanitizer(char *addr, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const size_t MalignBuffer::kPageSize = sysconf(_SC_PAGESIZE);
|
const size_t MalignBuffer::kPageSize = sysconf(_SC_PAGESIZE);
|
||||||
#ifdef _SC_LEVEL1_DCACHE_LINESIZE
|
|
||||||
const size_t MalignBuffer::kCacheLineSize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
|
const size_t MalignBuffer::kCacheLineSize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
|
||||||
#else
|
|
||||||
// Default to 64 bytes which is common on x86_64
|
|
||||||
const size_t MalignBuffer::kCacheLineSize = 64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string MalignBuffer::ToString(CopyMethod m) {
|
std::string MalignBuffer::ToString(CopyMethod m) {
|
||||||
switch (m) {
|
switch (m) {
|
||||||
@@ -240,8 +235,8 @@ std::string MalignBuffer::Syndrome(const MalignBuffer &that) const {
|
|||||||
std::string MalignBuffer::CorruptionSyndrome(const MalignBuffer &that) const {
|
std::string MalignBuffer::CorruptionSyndrome(const MalignBuffer &that) const {
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
if (size() != that.size()) {
|
if (size() != that.size()) {
|
||||||
s << Json("unequalSizeThis", size()) << ", "
|
s << Json("unequalSizeThis", static_cast<uint64_t>(size())) << ", "
|
||||||
<< Json("unequalSizeThat", that.size());
|
<< Json("unequalSizeThat", static_cast<uint64_t>(that.size()));
|
||||||
return s.str();
|
return s.str();
|
||||||
}
|
}
|
||||||
bool failed_memcmp = memcmp(data(), that.data(), that.size());
|
bool failed_memcmp = memcmp(data(), that.data(), that.size());
|
||||||
|
@@ -28,8 +28,8 @@ class MalignBuffer {
|
|||||||
public:
|
public:
|
||||||
struct PunchedHole {
|
struct PunchedHole {
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
size_t start = 0;
|
uint64_t start = 0;
|
||||||
size_t length = 0;
|
uint64_t length = 0;
|
||||||
unsigned char v = 0x53;
|
unsigned char v = 0x53;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -72,8 +72,8 @@ absl::Status Silkscreen::CheckMySlots(int tid, uint64_t round) const {
|
|||||||
const char v = *data(k);
|
const char v = *data(k);
|
||||||
if (v == expected) continue;
|
if (v == expected) continue;
|
||||||
error_count++;
|
error_count++;
|
||||||
last_error = absl::StrCat(Json("position", k), ", ", Json("is", v), ", ",
|
last_error = absl::StrCat(Json("position", static_cast<uint64_t>(k)), ", ",
|
||||||
Json("expected", expected));
|
Json("is", v), ", ", Json("expected", expected));
|
||||||
}
|
}
|
||||||
if (slot_count(tid) != slots_read) {
|
if (slot_count(tid) != slots_read) {
|
||||||
last_error = absl::StrCat(Json("read", slots_read), ", ",
|
last_error = absl::StrCat(Json("read", slots_read), ", ",
|
||||||
|
Reference in New Issue
Block a user