Skip to content

Commit

Permalink
fix an issue where it fails to detect the number of cores on GitHub CI
Browse files Browse the repository at this point in the history
  • Loading branch information
1a1a11a committed Nov 22, 2023
1 parent 5eb9512 commit 892ff04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@ env:
BUILD_TYPE: Release

jobs:
# gcc7:
# name: bionic / gcc-7
# runs-on: ubuntu-18.04
# env:
# CC: gcc
# steps:
# - uses: actions/checkout@v2
# - name: Prepare1
# run: sudo apt install libglib2.0-dev libgoogle-perftools-dev build-essential cmake google-perftools
# - name: Prepare2
# run: bash scripts/setup.sh
# - name: Configure CMake
# run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
# - name: Build
# run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# - name: Run
# run: make test

# macos:
# name: macos / clang
# runs-on: macos-10.15
Expand All @@ -52,10 +34,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Prepare1
# run: sudo apt install -yqq libunwind-dev
# - name: Prepare2
# run: sudo apt install -yqq libglib2.0-dev libgoogle-perftools-dev build-essential cmake google-perftools
- name: Prepare
run: bash scripts/install_dependency.sh
- name: Configure CMake
Expand Down
7 changes: 6 additions & 1 deletion test/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <sys/sysinfo.h>

#include "../libCacheSim/include/libCacheSim.h"
#include "../libCacheSim/include/libCacheSim/prefetchAlgo.h"
Expand All @@ -26,7 +27,7 @@

#define DEFAULT_TTL (300 * 86400)

static inline unsigned int _n_cores() {
static inline unsigned int _n_cores0() {
unsigned int eax = 11, ebx = 0, ecx = 1, edx = 0;

asm volatile("cpuid"
Expand All @@ -37,6 +38,10 @@ static inline unsigned int _n_cores() {
return ebx;
}

static inline unsigned int _n_cores() {
return get_nprocs();
}

static void _detect_data_path(char *data_path, char *data_name) {
sprintf(data_path, "data/%s", data_name);
if (access(data_path, F_OK) != -1) return;
Expand Down

0 comments on commit 892ff04

Please sign in to comment.