@@ -98,10 +98,26 @@ The following command installs the `flag_gems` package in an editable mode,
9898while enabling the C++ extensions using the ` CMAKE_ARGS ` environment variable:
9999
100100``` shell
101- CMAKE_ARGS=" -DFLAGGEMS_BUILD_C_EXTENSIONS=ON" \
102- pip install --no-build-isolation - v -e .
101+ CMAKE_ARGS=" -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DCMAKE_BUILD_TYPE=Release " \
102+ pip install -v -e .
103103```
104104
105+ > [ !TIP]
106+ > It is recommended to explicitly set ` -DCMAKE_BUILD_TYPE=Release ` .
107+ > Without an explicit build type, neither ` libtriton_jit ` nor FlagGems's
108+ > own C++ code will be built with compiler optimizations targeted at the
109+ > selected platform (` -O3 -DNDEBUG ` etc.), which makes the C++ wrapper
110+ > execution noticeably slower and drags down the overall performance of
111+ > the C++ wrapped operators.
112+
113+ > [ !NOTE]
114+ > If the build fails (e.g. dependency conflicts or pip cannot locate an
115+ > already-installed PyTorch), add ` --no-build-isolation ` to the
116+ > ` pip install ` command so that pip reuses the PyTorch and the build
117+ > dependencies from ` requirements_<backend>.txt ` already installed in
118+ > your environment. See [ §4.2 Build isolation] ( #build-isolation ) for
119+ > more details.
120+
105121The above command builds for the default ** CUDA** backend. To build for
106122a different backend or to enable the pointwise dynamic C++ module,
107123pass the corresponding CMake options. Below are examples for each
@@ -110,34 +126,33 @@ supported platform:
110126** NVIDIA CUDA (with pointwise dynamic C++ support)**
111127
112128``` shell
113- CMAKE_ARGS=" -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DFLAGGEMS_BUILD_POINTWISE_DYNAMIC_CPP=ON " \
114- pip install --no-build-isolation - v -e .
129+ CMAKE_ARGS=" -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DCMAKE_BUILD_TYPE=Release " \
130+ pip install -v -e .
115131```
116132
117133** Iluvatar CoreX (IX)**
118134
119135``` shell
120136export LIBRARY_PATH=< corex-install-dir> /lib64:$LIBRARY_PATH
121-
122- CMAKE_ARGS=" -DFLAGGEMS_BACKEND=IX -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DFLAGGEMS_BUILD_CTESTS=ON - DCMAKE_BUILD_TYPE=Release" \
123- pip install --no-build-isolation - v -e .
137+ # export LIBRARY_PATH=/usr/local/corex/lib64:$LIBRARY_PATH
138+ CMAKE_ARGS=" -DFLAGGEMS_BACKEND=IX -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DCMAKE_BUILD_TYPE=Release" \
139+ pip install -v -e .
124140```
125141
126142** Moore Threads (MUSA)**
127143
128144``` shell
129145export MUSA_HOME=< musa-install-dir>
130-
131- LD_PRELOAD=$CONDA_PREFIX /lib/libittnotify.so \
132- pip install --no-build-isolation -v -e . \
133- --config-settings=cmake.args=" -DFLAGGEMS_BACKEND=MUSA;-DFLAGGEMS_BUILD_C_EXTENSIONS=ON;-DFLAGGEMS_BUILD_CTESTS=ON"
146+ # export MUSA_HOME=/usr/local/musa-xxx
147+ CMAKE_ARGS=" -DFLAGGEMS_BACKEND=MUSA -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DCMAKE_BUILD_TYPE=Release" \
148+ pip install -e .
134149```
135150
136151** Huawei Ascend (NPU)**
137152
138153``` shell
139- CMAKE_ARGS=" -DFLAGGEMS_BACKEND=NPU -DFLAGGEMS_BUILD_C_EXTENSIONS=ON" \
140- pip install --no-build-isolation - e .
154+ CMAKE_ARGS=" -DFLAGGEMS_BACKEND=NPU -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DCMAKE_BUILD_TYPE=Release " \
155+ pip install -e .
141156```
142157
143158Note that the above commands install the
@@ -306,5 +321,5 @@ with external *Triton JIT* installed at `/usr/local/lib/libtriton_jit`:
306321
307322``` shell
308323CMAKE_ARGS=" -DFLAGGEMS_BUILD_C_EXTENSIONS=ON -DFLAGGEMS_USE_EXTERNAL_TRITON_JIT=ON -DTritonJIT_ROOT=/usr/local/lib/libtriton_jit" \
309- pip install --no-build-isolation - v -e .
324+ pip install -v -e .
310325```
0 commit comments