Skip to content

Commit 7b3624f

Browse files
committed
Clean up
1 parent 06f8b65 commit 7b3624f

13 files changed

Lines changed: 61 additions & 52 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ jobs:
2020
- name: Configure CMake
2121
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
2222
- name: Build
23-
run: |
24-
cores=$(sysctl -n hw.ncpu)
25-
ninja -C ${{github.workspace}}/build -j$((cores + 1))
23+
run: ninja -C ${{github.workspace}}/build
2624
- name: Test
2725
working-directory: ${{github.workspace}}/build
28-
run: |
29-
cores=$(sysctl -n hw.ncpu)
30-
ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel $cores
26+
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel
3127

3228
ubuntu:
3329
runs-on: ubuntu-latest
@@ -42,15 +38,12 @@ jobs:
4238
-DCMAKE_C_FLAGS="-fsanitize=leak" \
4339
-DCMAKE_CXX_FLAGS="-fsanitize=leak"
4440
- name: Build
45-
run: |
46-
cores=$(nproc)
47-
ninja -C ${{github.workspace}}/build -j$((cores + 1))
41+
run: ninja -C ${{github.workspace}}/build
4842
- name: Test with LSan
4943
working-directory: ${{github.workspace}}/build
5044
run: |
5145
export ASAN_OPTIONS="detect_leaks=1:halt_on_error=1:verbosity=1"
52-
cores=$(nproc)
53-
ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel $cores
46+
ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel
5447
5548
selfhosted:
5649
runs-on: self-hosted
@@ -59,11 +52,7 @@ jobs:
5952
- name: Configure CMake
6053
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_GLCACHE=on -DENABLE_LRB=on
6154
- name: Build
62-
run: |
63-
cores=$(nproc)
64-
ninja -C ${{github.workspace}}/build -j$((cores + 1))
55+
run: ninja -C ${{github.workspace}}/build
6556
- name: Test
6657
working-directory: ${{github.workspace}}/build
67-
run: |
68-
cores=$(nproc)
69-
ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel $cores
58+
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ Please see [install.md](/doc/install.md) for instructions on how to install the
118118
### Build libCacheSim
119119
cmake recommends **out-of-source build**, so we do it in a new directory:
120120
```bash
121+
# Prerequisites: Install Ninja build system
122+
# Ubuntu/Debian: sudo apt install ninja-build
123+
# macOS: brew install ninja
124+
# CentOS/RHEL: sudo yum install ninja-build
125+
121126
git clone https://github.com/1a1a11a/libCacheSim
122127
pushd libCacheSim
123128
mkdir _build && cd _build

doc/install.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
## Install dependency
22

3-
libCacheSim uses [cmake](https://cmake.org/) build system and has a few dependencies:
3+
libCacheSim uses [cmake](https://cmake.org/) build system with [Ninja](https://ninja-build.org/) generator and has a few dependencies:
44
[glib](https://developer.gnome.org/glib/)
55
[tcmalloc](https://github.com/google/tcmalloc),
66
[zstd](https://github.com/facebook/zstd).
77

88
### Install dependency on Ubuntu
99

10-
#### Install glib, tcmalloc and cmake
10+
#### Install glib, tcmalloc, cmake and ninja
1111

1212
```bash
13-
sudo apt install libglib2.0-dev libgoogle-perftools-dev cmake
13+
sudo apt install libglib2.0-dev libgoogle-perftools-dev cmake ninja-build
1414
```
1515

1616
#### Install zstd
@@ -22,8 +22,8 @@ wget https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz
2222
tar xvf zstd-1.5.0.tar.gz
2323
pushd zstd-1.5.0/build/cmake/
2424
mkdir _build && cd _build/
25-
cmake .. && make -j
26-
sudo make install
25+
cmake -G Ninja .. && ninja
26+
sudo ninja install
2727
popd
2828
```
2929

@@ -33,8 +33,8 @@ popd
3333
git clone --recursive https://github.com/dmlc/xgboost
3434
pushd xgboost
3535
mkdir _build && cd _build
36-
cmake .. && make -j
37-
sudo make install
36+
cmake -G Ninja .. && ninja
37+
sudo ninja install
3838
popd
3939
```
4040

@@ -44,8 +44,8 @@ popd
4444
git clone --recursive https://github.com/microsoft/LightGBM
4545
pushd LightGBM
4646
mkdir _build && cd _build
47-
cmake .. && make -j
48-
sudo make install
47+
cmake -G Ninja .. && ninja
48+
sudo ninja install
4949
popd
5050
```
5151

@@ -57,7 +57,7 @@ using [homebrew](https://brew.sh/) as an example. While the first line is necess
5757
- /usr/local/include/glib-2.0/glib/gtypes.h:34:10: fatal error: 'glibconfig.h' file not found
5858

5959
```bash
60-
brew install cmake glib google-perftools
60+
brew install cmake ninja glib google-perftools
6161
brew install argp-standalone
6262
brew install pkg-config
6363
```

doc/memory_usage_profiling.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Profiling Memory Usage in CacheSim with Massif
22

33
## 1. Introduction
4-
This guide explains how to analyze memory usage in the `cachesim` project using Valgrind's **massif** tool and identifies critical memory overhead areas as potential optimization targets. The workflow consists of the following steps:
4+
This guide explains how to analyze memory usage in the `cachesim` project using Valgrind's **massif** tool and identifies critical memory overhead areas as potential optimization targets. The workflow consists of the following steps:
55

66
- Heap memory profiling
77
- Identifying memory hotspots
@@ -15,8 +15,8 @@ This guide explains how to analyze memory usage in the `cachesim` project using
1515
```sh
1616
# Compile with debug symbols
1717
mkdir _build && cd _build
18-
cmake .. -DCMAKE_BUILD_TYPE=Debug
19-
make -j
18+
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug
19+
ninja
2020
```
2121

2222
2. Run `massif` for a specific algorithm (e.g., S3-FIFO):
@@ -38,7 +38,7 @@ The generated report primarily includes a bar chart of memory usage (with instru
3838

3939
```sh
4040
MB
41-
519.4^ :
41+
519.4^ :
4242
|#:::::::::::::@::::::::::::::::@::@@::::::::::::::::::::::::@::@::@::@::
4343
|#::: :: :: :::@: ::::: : ::: ::@::@ ::: :: : : ::::::: :::::@::@::@::@::
4444
|#::: :: :: :::@: ::::: : ::: ::@::@ ::: :: : : ::::::: :::::@::@::@::@::
@@ -76,22 +76,22 @@ The generated report primarily includes a bar chart of memory usage (with instru
7676
| | | ->24.74% (134,217,728B) 0x40880A: create_cache (cache_init.h:132)
7777
| | | ->24.74% (134,217,728B) 0x40970B: parse_cmd (cli_parser.c:343)
7878
| | | ->24.74% (134,217,728B) 0x406FFD: main (main.c:18)
79-
| | |
79+
| | |
8080
| | ->24.74% (134,217,728B) 0x4238C0: S3FIFO_init (S3FIFO.c:118)
8181
| | | ->24.74% (134,217,728B) 0x40880A: create_cache (cache_init.h:132)
8282
| | | ->24.74% (134,217,728B) 0x40970B: parse_cmd (cli_parser.c:343)
8383
| | | ->24.74% (134,217,728B) 0x406FFD: main (main.c:18)
84-
| | |
84+
| | |
8585
| | ->24.74% (134,217,728B) 0x423921: S3FIFO_init (S3FIFO.c:125)
8686
| | ->24.74% (134,217,728B) 0x40880A: create_cache (cache_init.h:132)
8787
| | ->24.74% (134,217,728B) 0x40970B: parse_cmd (cli_parser.c:343)
8888
| | ->24.74% (134,217,728B) 0x406FFD: main (main.c:18)
89-
| |
89+
| |
9090
| ->24.74% (134,217,728B) 0x4236BB: S3FIFO_init (S3FIFO.c:81)
9191
| ->24.74% (134,217,728B) 0x40880A: create_cache (cache_init.h:132)
9292
| ->24.74% (134,217,728B) 0x40970B: parse_cmd (cli_parser.c:343)
9393
| ->24.74% (134,217,728B) 0x406FFD: main (main.c:18)
94-
|
94+
|
9595
->00.84% (4,541,568B) in 1+ places, all below ms_print's threshold (01.00%)
9696
```
9797
@@ -105,7 +105,7 @@ The above report indicates that the memory usage of S3-FIFO remains nearly const
105105
106106
### 3.1. Memory Usage of Various Algorithms
107107
108-
We conducted tests using the `wiki_2019t` workload (available at [CMU's dataset repository](https://ftp.pdl.cmu.edu/pub/datasets/twemcacheWorkload/cacheDatasets/wiki/)) to evaluate the memory usage of various algorithms with a cache size of 1GB.
108+
We conducted tests using the `wiki_2019t` workload (available at [CMU's dataset repository](https://ftp.pdl.cmu.edu/pub/datasets/twemcacheWorkload/cacheDatasets/wiki/)) to evaluate the memory usage of various algorithms with a cache size of 1GB.
109109

110110

111111
| Algorithm | Peak Memory Usage (MB) | Observations |

dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN bash ./scripts/install_libcachesim.sh
2121

2222

2323
WORKDIR /libCacheSim/_build/
24-
# RUN cmake -DSUPPORT_ZSTD_TRACE=on .. && make -j && sudo make install
24+
# RUN cmake -G Ninja -DSUPPORT_ZSTD_TRACE=on .. && ninja && sudo ninja install
2525

2626

2727
WORKDIR /libCacheSim/_build/bin/
@@ -40,9 +40,9 @@ WORKDIR /libCacheSim/_build/bin/
4040
# sudo docker run -v /local/data/path:/data -it 1a1a11a/libcachesim:latest bash
4141

4242
# docker install instructions can be found at https://docs.docker.com/engine/install/
43-
# for ubuntu:
44-
#
45-
# sudo apt-get update && sudo apt-get install -yqq ca-certificates curl gnupg;
43+
# for ubuntu:
44+
#
45+
# sudo apt-get update && sudo apt-get install -yqq ca-certificates curl gnupg;
4646
# sudo install -m 0755 -d /etc/apt/keyrings && \
4747
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
4848
# sudo chmod a+r /etc/apt/keyrings/docker.gpg
@@ -51,5 +51,3 @@ WORKDIR /libCacheSim/_build/bin/
5151
# "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
5252
# sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
5353
# sudo apt update && sudo apt-get install -yqq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
54-
55-

example/cacheCluster/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ This illustrate how to build a cache cluster using consistent hashing.
55
Please install libCacheSim first.
66
Then you can run the following in this directory
77
```bash
8+
# Prerequisites: Install Ninja build system if not already available
9+
# Ubuntu/Debian: sudo apt install ninja-build
10+
# macOS: brew install ninja
11+
812
mkdir _build;
913
cd _build;
1014
cmake -G Ninja ..;

example/cacheHierarchy/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ It outputs the L2 miss ratio curve.
99

1010
## Build
1111
```bash
12+
# Prerequisites: Install Ninja build system if not already available
13+
# Ubuntu/Debian: sudo apt install ninja-build
14+
# macOS: brew install ninja
15+
1216
mkdir _build/;
1317
cd _build/;
1418
cmake -G Ninja ../;

example/cacheSimulator/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ See [main.c](main.c) for a complete example.
1919

2020
### Build
2121
```bash
22+
# Prerequisites: Install Ninja build system if not already available
23+
# Ubuntu/Debian: sudo apt install ninja-build
24+
# macOS: brew install ninja
25+
2226
mkdir _build;
2327
cd _build;
2428
cmake -G Ninja ..;

example/cacheSimulatorConcurrent/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ This example also shows how to use a csv reader to read a csv trace.
1010

1111
### Build
1212
```bash
13+
# Prerequisites: Install Ninja build system if not already available
14+
# Ubuntu/Debian: sudo apt install ninja-build
15+
# macOS: brew install ninja
16+
1317
mkdir _build;
1418
cd _build;
1519
cmake -G Ninja ..;

example/plugin_v2/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ This example demonstrates how to create a plugin for libCacheSim using the v2 ho
1313
To compile the plugin into a shared library:
1414

1515
```bash
16+
# Prerequisites: Install Ninja build system if not already available
17+
# Ubuntu/Debian: sudo apt install ninja-build
18+
# macOS: brew install ninja
19+
1620
mkdir build
1721
cd build
1822
cmake -G Ninja ..

0 commit comments

Comments
 (0)