WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit b6ba524

Browse files
committed
fix compilation accross kernel
1 parent 7e6e9ce commit b6ba524

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3471
-1400
lines changed

.github/workflows/cmake.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ env:
1010
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
1111
BUILD_TYPE: Release
1212

13+
14+
1315
jobs:
1416
build:
1517
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
@@ -21,20 +23,40 @@ jobs:
2123
- uses: actions/checkout@v3
2224

2325
- name: Install dependencies
24-
run: sudo apt install llvm-dev clang libbpf-dev libclang-dev libcxxopts-dev libfmt-dev librange-v3-dev
26+
run: sudo apt install llvm-dev clang libbpf-dev libclang-dev python3-pip gcc-13 g++-13 ninja-build && git submodule update --init --recursive
2527

26-
- name: Install Custom dependencies
27-
run: wget http://launchpadlibrarian.net/605552811/libbpf0_0.8.0-1_amd64.deb && wget http://launchpadlibrarian.net/605552807/libbpf-dev_0.8.0-1_amd64.deb && sudo dpkg -i ./libbpf0_0.8.0-1_amd64.deb && sudo dpkg -i ./libbpf-dev_0.8.0-1_amd64.deb
28-
29-
- name: Sed Current uncompiled include file
30-
run: sudo sed -i 's/NL_SET_ERR_MSG_MOD/\/\/NL_SET_ERR_MSG_MOD/g' /usr/src/linux-headers-`uname -r`/include/net/flow_offload.h
28+
- name: Install conan
29+
working-directory: ${{github.workspace}}
30+
run: pip3 install conan && conan profile detect && mkdir build && cd build && cp ../conanfile.txt . && CC=gcc-13 CXX=g++-13 conan install . -s compiler.cppstd=gnu23
3131

3232
- name: Configure CMake
3333
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
3434
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
35-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
35+
run: cmake -B ${{github.workspace}}/build -GNinja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/build/build/${{env.BUILD_TYPE}}/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
3636

3737
- name: Build
3838
# Build your program with the given configuration
3939
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
4040

41+
- name: Create Release
42+
id: create_release
43+
uses: actions/create-release@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
46+
with:
47+
tag_name: main
48+
release_name: Release main
49+
body: |
50+
Changes in this Release
51+
- First Change
52+
- Second Change
53+
draft: false
54+
prerelease: false
55+
56+
- name: Upload Assets to Release with a wildcard
57+
uses: csexton/release-asset-action@v2
58+
with:
59+
pattern: "build/CXLMemSim"
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
release-url: ${{ steps.create_release.outputs.upload_url }}
62+

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@ benchmarks*
88
Makefile
99
*.o
1010
py_smdk_pkg
11-
lib
11+
lib
12+
CMakePresets.json
13+
.cmake
14+
CMakeUserPresets.json
15+
*~
16+
voltdb
17+
foo
18+
CMakeFiles

.gitmodules

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[submodule "workloads/memcached-ycsb"]
2+
path = workloads/memcached-ycsb
3+
url = https://github.com/SlugLab/YCSB/
4+
[submodule "workloads/memcached"]
5+
path = workloads/memcached
6+
url = https://github.com/memcached/memcached
7+
[submodule "workloads/gapbs"]
8+
path = workloads/gapbs
9+
url = https://github.com/victoryang00/gapbs
10+
[submodule "script/perfmon"]
11+
path = script/perfmon
12+
url = https://github.com/intel/perfmon
13+
[submodule "workloads/vectordb"]
14+
path = workloads/vectordb
15+
url = https://github.com/jina-ai/vectordb

CMakeLists.txt

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
cmake_minimum_required(VERSION 3.11.0)
2-
project(CXL-MEM-Simulator VERSION 0.1.0)
2+
project(CXLMemSim VERSION 0.1.0)
3+
set(CMAKE_CXX_STANDARD 23)
4+
5+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
6+
add_compile_options (-fdiagnostics-color=always)
7+
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
8+
add_compile_options (-fcolor-diagnostics)
9+
endif ()
10+
11+
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
312

413
find_package(cxxopts REQUIRED)
514
find_package(fmt REQUIRED)
6-
find_package(range-v3 REQUIRED)
715
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
816

917
execute_process(COMMAND uname -r OUTPUT_VARIABLE arch OUTPUT_STRIP_TRAILING_WHITESPACE)
10-
set(LINUX_SOURCE /lib/modules/${arch}/build/)
11-
set(CMAKE_CXX_FLAGS "-Wall -g -pthread -lrt -rdynamic")
12-
set(CMAKE_CXX_STANDARD 23)
13-
14-
add_executable(CXL-MEM-Simulator ${SOURCE_FILES})
15-
16-
include_directories(CXL-MEM-Simulator include)
17-
target_link_libraries(CXL-MEM-Simulator cxxopts::cxxopts fmt::fmt range-v3::range-v3 elf bpf)
18+
set(CMAKE_CXX_FLAGS "-Wall -fPIC -pthread -ldl -lrt -mavx512f -mpreferred-stack-boundary=4 -g -O0")
1819

19-
function(bpf prefix)
20-
add_custom_target(${prefix}_bpf ALL
21-
COMMAND clang --target=bpf -nostdinc -S -I/usr/include/linux -I${CMAKE_SOURCE_DIR}/include -I${LINUX_SOURCE}/arch/x86/include -I/usr/include -I${LINUX_SOURCE}/arch/x86/include/uapi -I${LINUX_SOURCE}/arch/x86/include/generated -I${LINUX_SOURCE}/arch/x86/include/generated/uapi -I${LINUX_SOURCE}/include -I${LINUX_SOURCE}/include/uapi -I${LINUX_SOURCE}/include/generated/uapi -I${LINUX_SOURCE}/tools/testing/selftests/bpf -include ${LINUX_SOURCE}/include/linux/kconfig.h -D__KERNEL__ -D__ASM_SYSREG_H -D__BPF_TRACING__ -D__TARGET_ARCH_x86 -Wno-implicit-function-declaration -O3 -emit-llvm -g -c ${CMAKE_SOURCE_DIR}/src/${prefix}.c -o ${CMAKE_BINARY_DIR}/${prefix}.ll
22-
COMMAND llc -march=bpf -filetype=obj -o ${CMAKE_BINARY_DIR}/${prefix}.o ${CMAKE_BINARY_DIR}/${prefix}.ll
23-
)
24-
add_dependencies(CXL-MEM-Simulator ${prefix}_bpf)
25-
endfunction()
20+
add_executable(CXLMemSim ${SOURCE_FILES} src/main.cc)
2621

27-
bpf(collectmmap)
22+
include_directories(CXLMemSim include ${cxxopts_INCLUDE_DIR} ${fmt_INCLUDE_DIR})
23+
target_link_libraries(CXLMemSim fmt::fmt cxxopts::cxxopts)
2824

29-
add_subdirectory(microbench)
25+
add_library(CXLMemSimHook SHARED src/module.cc)
26+
add_executable(CXLMemSimSock ${SOURCE_FILES} src/sock.cc)
27+
target_link_libraries(CXLMemSimSock fmt::fmt cxxopts::cxxopts)

README.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# CXL.mem Simulator
2-
The epoch design of this project is mostly refering to [mes](https://github.com/takahiro-hirofuchi/mesmeric-emulator), the novelty is use pebs to construct the topology and calculate the hierachy latency based on this. See the [talk](https://docs.google.com/file/d/1bZi2rbB-u5xMw_YET726gb2s9QuxMZJE/edit?usp=docslist_api&filetype=mspresentation)
2+
The CXL.mem simulator is to use the target latency for simulating the CPU perspective taking ROB and different cacheline state's into panelty from the application level.
33

44
## Prerequisite
55
```bash
66
$ uname -a
7-
Linux gpu01 5.19.0-29-generic #30-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 4 12:14:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
8-
$ sudo apt install llvm-dev clang libbpf-dev libclang-dev libcxxopts-dev libfmt-dev librange-v3-dev
7+
Linux banana 6.4.0+ #86 SMP PREEMPT_DYNAMIC Fri Jul 28 23:49:33 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
8+
$ echo 0 | sudo tee /sys/devices/system/node/node1/cpu*/online >/dev/null 2>&1
99
```
1010
## User input
1111
```bash
12-
LOGV=1 ./CXL-MEM-Simulator -t ./microbench/many_calloc -i 5 -c 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
12+
LOGV=1 ./CXL-MEM-Simulator -t ./microbench/ld -i 5 -c 0,2 -d 85 -b 10,10 -l 100,100 -c 100,100 -w 85.5,86.5,87.5,85.5,86.5,87.5,88. -o "(1,(2,3))"
1313
```
1414
1. -t Target: The path to the executable
1515
2. -i Interval: The epoch of the simulator, the parameter is in milisecond
1616
3. -c CPUSet: The core id to run the executable and the rest will be `setaffinity` to one other core
17-
4. -d Dram Latency: The current platform's DRAM latency, default is 85ns
17+
4. -d Dram Latency: The current platform's DRAM latency, default is 85ns # mark that bw in the remote
1818
5. -b, -l Bandwidth, Latency: Both use 2 input in the vector, first for read, second for write
1919
6. -c Capacity: The capacity of the memory with first be local, remaining accordingly to the input vector.
2020
7. -w Weight: Use the heuristic to calculate the bandwidth
@@ -30,16 +30,3 @@ LOGV=1 ./CXL-MEM-Simulator -t ./microbench/many_calloc -i 5 -c 0,1,2,3,4,5,6,7,8
3030
3
3131
```
3232
9. env LOGV stands for logs level that you can see.
33-
## Limitation
34-
The pebs requires no larger than 5 `perf_open_event` attached to certain PID, so I limit the bpf program to munmap(kprobe) and sbrk(kprobe/kretprobe), you can configure them. For multiple process application, I need to first SIGSTOP the process and `send/recv` back the PID information. For client and server application, I need to SIGSTOP/SIGCONT on both client and server simultaneously, which is not implemented yet.
35-
36-
## Cite
37-
```bash
38-
@article{yangyarch23,
39-
title={CXLMemSim: A pure software simulated CXL.mem for performance characterization},
40-
author={Yiwei Yang, Pooneh Safayenikoo, Jiacheng Ma, Tanvir Ahmed Khan, Andrew Quinn},
41-
journal={arXiv preprint arXiv:2303.06153},
42-
booktitle={The fifth Young Architect Workshop (YArch'23)},
43-
year={2023}
44-
}
45-
```

artifact/build_and_run_all.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

artifact/compare_with_gem5.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

artifact/gen_workloads.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# anns
3+
# monetdb
4+
# pointer_chasing lmbench3
5+
# wrf stream
6+
# mlc
7+
# gromacs
8+
# smdk's
9+
10+
git clone https://github.com/scott-beamer/gapbs.git
11+
cd gapbs
12+
make benchmark
13+
14+
wget https://files.rcsb.org/download/4i4f.pdb

artifact/mlc-sapphirerapids.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Intel(R) Memory Latency Checker - v3.10
2+
*** Unable to modify prefetchers (try executing 'modprobe msr')
3+
*** So, enabling random access for latency measurements
4+
Measuring idle latencies for random access (in ns)...
5+
Numa node Numa node
6+
Numa node 0 1
7+
0 106.3 437.5
8+
9+
Measuring Peak Injection Memory Bandwidths for the system
10+
Bandwidths are in MB/sec (1 MB/sec = 1,000,000 Bytes/sec)
11+
Using all the threads from each core if Hyper-threading is enabled
12+
Using traffic with the following read-write ratios
13+
ALL Reads : 28611.9
14+
3:1 Reads-Writes : 25057.1
15+
2:1 Reads-Writes : 25078.0
16+
1:1 Reads-Writes : 23965.9
17+
Stream-triad like: 24943.3
18+
19+
Measuring Memory Bandwidths between nodes within system
20+
Bandwidths are in MB/sec (1 MB/sec = 1,000,000 Bytes/sec)
21+
Using all the threads from each core if Hyper-threading is enabled
22+
Using Read-only traffic type
23+
Numa node Numa node
24+
Numa node 0 1
25+
0 28612.0 19216.8
26+
27+
Measuring Loaded Latencies for the system
28+
Using all the threads from each core if Hyper-threading is enabled
29+
Using Read-only traffic type
30+
Inject Latency Bandwidth
31+
Delay (ns) MB/sec
32+
==========================
33+
00000 370.12 28393.2
34+
00002 369.29 28435.4
35+
00008 378.41 28490.5
36+
00015 354.32 28414.2
37+
00050 313.07 28323.0
38+
00100 238.51 28010.5
39+
00200 125.13 14566.0
40+
00300 119.69 10232.0
41+
00400 116.76 7905.3
42+
00500 115.33 6500.4
43+
00700 113.89 4858.3
44+
01000 113.03 3594.6
45+
01300 112.57 2906.9
46+
01700 112.09 2363.9
47+
02500 111.51 1798.9
48+
03500 111.21 1520.8
49+
05000 110.77 1193.2
50+
09000 110.38 922.3
51+
20000 110.14 735.6
52+
53+
Measuring cache-to-cache transfer latency (in ns)...
54+
Local Socket L2->L2 HIT latency 67.3
55+
Local Socket L2->L2 HITM latency 67.5

0 commit comments

Comments
 (0)