CXL-DMSim is a full-system CXL disaggregated memory simulator based on gem5.
To build CXL-DMSim, you need to satisfy the dependencies of gem5 version 23.10. We recommend running on Ubuntu 20.04 or 22.04.
The main website can be found at gem5.org.
A good starting point is Introduction to gem5, and for more information about building the simulator and getting started, please see the Documentation and Tutorials.
sudo apt install build-essential git m4 scons zlib1g zlib1g-dev \
libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev \
python3-dev python-is-python3 libboost-all-dev pkg-config
git clone https://github.com/ferry-hhh/CXL-DMSim.git
When building CXL-DMSim, there are multiple binary types that can be created. Just like in gem5, the options are opt, fast, and debug. In general, the opt version is the best in most circumstances.
Additionally, CXL-DMSim currently only supports modeling of the x86 architecture.
Type the following command to build the simulator:
scons build/X86/gem5.opt -j`nproc`
Note that the -j
flag is optional and allows for parallelization of compilation with nproc
specifying the number of threads. A single-threaded compilation from scratch can take up to 2 hours on some systems. We therefore strongly advise allocating more threads if possible.
CXL-DMSim is a full-system simulator based on gem5. To start the full system, two files are required: a Linux Kernel and a Disk Image.
Both of these files can be created or compiled following the gem5 documentation, or downloaded from the gem5 resources repository.
Please check that the paths for Kernel
and disk_image
in configs/example/gem5_library/x86-cxl-run.py
correspond to the paths on your computer.
Enter the following command to start the full system. By default, it allocates CXL-ASIC Device memory to run the lmbench latency benchmark test. The results of the program execution are saved by default in m5out/board.pc.com_1.device
.
build/X86/gem5.opt configs/example/gem5_library/x86-cxl-run.py
For more configurable system component parameters, please refer to the gem5 standard library. You can also use x86-cxl-run.py
as a reference to customize your system configuration file.
Install m5term
.
m5term
allows users to connect to the simulated terminal provided by the full system. Follow these steps:
cd util/term
make
sudo install -o root -m 555 m5term /usr/local/bin
m5term localhost 3456
CXL Device is recognized as a CPU-less NUMA node in the system. We provide two ways to manage CXL memory allocation.
Via numactl
Users can allocate CXL memory using standard numactl commands, for example:
numactl --membind=1 --cpunodebind=0 ./lat_mem_rd -t -N 2 1024 64
This command will run the lat_mem_rd
program on CPU0, with memory allocation bound to NUMA node 1, which is the CXL memory in the system. You can also use options like interleave
and preferred
to mix DRAM and CXL memory.
Via mmap/memkind
The CXL device driver provides an mmap system call to allocate CXL memory.