Skip to content

Commit cead513

Browse files
authored
Document ulimit and cmake usage (infiniflow#1123)
Document ulimit and cmake usage. Close infiniflow#912 Issue link:infiniflow#912 ### Type of change - [x] Documentation Update
1 parent 6094a9f commit cead513

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

docs/build_from_source.md

+22-7
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,23 @@ Infinity can only be compiled natively on Linux. If your operating system is not
1414

1515
## Prerequisites
1616

17-
A RAM of 16GB is advised to properly build the project. If your machine does not have that much memory capacity, ensure that there is a minimum of 6GB of RAM and limit the number of ninja parallel compilation jobs to one:
17+
Build the whole project, especially the link stage, requires much RAM. The host may become unresponsive due to the very slow kernel oom killer. To lessen the chances of it happening, it is recommended to install [earlyoom](https://github.com/rfjakob/earlyoom). Furthermore, you need to tell cmake to limit the concurrent link process:
1818

19-
```shell
20-
ninja -j1
21-
```
19+
`-DCMAKE_JOB_POOL_LINK:STRING=link_pool -DCMAKE_JOB_POOLS:STRING=link_pool=2`
20+
21+
The recommended `link_pool` size is:
22+
23+
- 1 for 6GB
24+
- 2 for 16GB
25+
- 3 for 32GB
26+
27+
The `CMAKE_BUILD_TYPE` (cmake build type) can be one of:
28+
29+
- `Debug`: no inline, with symbol info, with address sanitize, normally ~10x slower than `RelWithDebInfo` and `Release`. This aims daily development.
30+
- `RelWithDebInfo`: optimize with `-O2`, with symbol info. This aims performance analysis.
31+
- `Release`: optimize with `-O3`, without symbol info. The built one executables are much smaller than `RelWithDebInfo`. This aims [project releases](https://github.com/infiniflow/infinity/releases).
32+
33+
Following procedures use `Debug`. Change it as you need.
2234

2335
## Build from source on Linux using Docker
2436

@@ -36,13 +48,14 @@ git clone https://github.com/infiniflow/infinity.git
3648
cd infinity && mkdir build
3749
TZ=$(readlink -f /etc/localtime | awk -F '/zoneinfo/' '{print $2}')
3850
docker run -d --name infinity_build --network=host -e TZ=$TZ -v $PWD:/infinity infiniflow/infinity_builder:ubuntu2310
39-
docker exec infinity_build bash -c "cd /infinity/build && cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON .. && ninja"
51+
docker exec infinity_build bash -c "cd /infinity/build && cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON .. && cmake --build ."
4052
```
4153

4254
### Step3 Start up the Infinity server
4355

4456
```shell
4557
sudo mkdir -p /var/infinity && sudo chown -R $USER /var/infinity
58+
ulimit -n 500000
4659
./cmake-build-debug/src/infinity
4760
```
4861

@@ -84,13 +97,14 @@ cd infinity && mkdir cmake-build-debug && cd cmake-build-debug
8497
export CC=/usr/bin/clang-17
8598
export CXX=/usr/bin/clang++-17
8699
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON ..
87-
ninja
100+
cmake --build .
88101
```
89102

90103
### Step4 Start up the Infinity server
91104

92105
```shell
93106
sudo mkdir -p /var/infinity && sudo chown -R $USER /var/infinity
107+
ulimit -n 500000
94108
./cmake-build-debug/src/infinity
95109
```
96110

@@ -127,12 +141,13 @@ cd infinity && mkdir cmake-build-debug && cd cmake-build-debug
127141
export CC=/usr/bin/clang-17
128142
export CXX=/usr/bin/clang++-17
129143
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON ..
130-
ninja
144+
cmake --build .
131145
```
132146

133147
### Step4 Start up Infinity server
134148

135149
```shell
136150
sudo mkdir -p /var/infinity && sudo chown -R $USER /var/infinity
151+
ulimit -n 500000
137152
./cmake-build-debug/src/infinity
138153
```

0 commit comments

Comments
 (0)