Skip to content

Commit 2ad3eeb

Browse files
committed
doc: update readme II
1 parent e6b0302 commit 2ad3eeb

3 files changed

Lines changed: 213 additions & 150 deletions

File tree

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ownership of every path. The last matching pattern takes precedence, so a
2+
# narrower rule must appear below this one.
3+
4+
* @OmarDuran

INSTALL.md

Lines changed: 98 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Installing graphos
22

3-
graphos is a **header-only C++20 library**. There is nothing to compile to
4-
*use* it — installation copies headers and a CMake package so other projects
5-
can `find_package(graphos)`. The optional hardware-portability stack (RAJA,
6-
Umpire, CHAI) is only needed if you enable it.
3+
graphos is a **header-only C++20 library**. Nothing has to be compiled to use
4+
it: installing copies the headers and a CMake package so other projects can
5+
`find_package(graphos)`. The portability stack (RAJA, Umpire, CHAI) is needed
6+
only if you enable it.
77

8-
Requirements: **CMake ≥ 3.20** and a **C++20 compiler** (Apple Clang, Clang,
9-
or GCC). Nothing else for the default build.
8+
Requirements: **CMake ≥ 3.20** and a **C++20 compiler** (Apple Clang, Clang or
9+
GCC). Nothing else for the default build.
1010

1111
---
1212

@@ -30,9 +30,8 @@ ctest --test-dir build
3030
cmake --install build --prefix ~/opt/graphos
3131
```
3232

33-
Pick any prefix you like. Without `--prefix` the install goes to the
34-
configure-time `CMAKE_INSTALL_PREFIX` (default `/usr/local`, which needs
35-
`sudo`).
33+
Any prefix works. Without `--prefix` the install goes to the configure-time
34+
`CMAKE_INSTALL_PREFIX`, default `/usr/local`, which needs `sudo`.
3635

3736
### What gets installed
3837

@@ -61,7 +60,7 @@ cmake -S . -B build -DCMAKE_PREFIX_PATH=$HOME/opt/graphos
6160

6261
### Without CMake
6362

64-
graphos is header-only — add the include directory and C++20:
63+
Header-only, so the include directory and C++20 are enough:
6564

6665
```bash
6766
c++ -std=c++20 -I$HOME/opt/graphos/include my_program.cpp -o my_program
@@ -76,21 +75,26 @@ c++ -std=c++20 -I$HOME/opt/graphos/include my_program.cpp -o my_program
7675
| `GRAPHOS_ENABLE_RAJA` | `OFF` | `exec::forall`/scans dispatch through RAJA policies |
7776
| `GRAPHOS_ENABLE_UMPIRE` | `OFF` | `exec::Buffer` allocates from Umpire memory pools |
7877
| `GRAPHOS_ENABLE_CHAI` | `OFF` | Frozen-complex storage (`exec::Array`) uses `chai::ManagedArray` |
79-
| `GRAPHOS_FETCH_TPL` | `OFF` | Download+build RAJA/Umpire via FetchContent instead of `find_package` (development only; skips the install export, and CHAI is not fetchable this way) |
80-
| `CMAKE_INSTALL_PREFIX` | `/usr/local` | Install destination (or use `cmake --install build --prefix …`) |
81-
82-
Each `GRAPHOS_ENABLE_*` option locates its library with `find_package`, so
83-
the TPLs must be installed and discoverable (see the Spack section). The
84-
installed `graphosConfig.cmake` remembers which options were on and
85-
re-finds those dependencies for consumers automatically.
78+
| `GRAPHOS_FETCH_TPL` | `OFF` | Download and build RAJA/Umpire with FetchContent instead of `find_package`. Development only: it skips the install export, and CHAI cannot be fetched this way |
79+
| `GRAPHOS_BUILD_BENCH` | `ON` | Build `graphos_bench` |
80+
| `GRAPHOS_BUILD_PYTHON` | `OFF` | Build the `graphos._core` bindings into `python/graphos/` (fetches pybind11, pinned) |
81+
| `GRAPHOS_SANITIZE` | *(empty)* | Sanitizers for tests and bench, e.g. `address,undefined`. Top-level builds only |
82+
| `BUILD_TESTING` | `ON` | Standard CTest switch; `OFF` skips the test tree |
83+
| `CMAKE_INSTALL_PREFIX` | `/usr/local` | Install destination, or use `cmake --install build --prefix …` |
84+
85+
Each `GRAPHOS_ENABLE_*` option locates its library with `find_package`, so the
86+
TPLs must be installed and discoverable — see §4 and §5. The installed
87+
`graphosConfig.cmake` records which options were on and re-finds those
88+
dependencies for consumers.
8689

8790
---
8891

8992
## 4. The portability stack via Spack
9093

9194
The repository ships a Spack environment ([spack.yaml](spack.yaml)) pinning
92-
RAJA, Umpire, and CHAI to the coordinated **2024.07** LLNL release line so
93-
the three agree on their shared dependencies (camp, BLT).
95+
RAJA, Umpire and CHAI to the coordinated **2024.07** LLNL release line, so the
96+
three agree on their shared dependencies (camp, BLT). If you would rather not
97+
use Spack, §5 builds the same line from source with one script.
9498

9599
### One-time Spack setup
96100

@@ -118,9 +122,9 @@ spack env activate .
118122
spack install
119123
```
120124

121-
This builds RAJA, Umpire, and CHAI (plus camp/BLT) and links them into a
122-
single **view** at `.spack-env/view/` inside the repo (git-ignored). First
123-
build takes a while; afterwards the environment is cached.
125+
This builds RAJA, Umpire and CHAI (with camp and BLT) and links them into a
126+
single **view** at `.spack-env/view/`, git-ignored. The first build is slow;
127+
afterwards the environment is cached.
124128

125129
### Build graphos against the stack
126130

@@ -142,9 +146,9 @@ ctest --test-dir build-portable
142146
cmake --install build-portable --prefix ~/opt/graphos
143147
```
144148

145-
Consumers of a portability-enabled install must also be able to find the
146-
TPLs — the simplest way is to configure them with the same
147-
`CMAKE_PREFIX_PATH` (view path first, then the graphos prefix):
149+
A consumer of a portability-enabled install must also find the TPLs. The
150+
simplest way is the same `CMAKE_PREFIX_PATH`, view first, then the graphos
151+
prefix:
148152

149153
```bash
150154
cmake -S . -B build "-DCMAKE_PREFIX_PATH=/path/to/graphos-repo/.spack-env/view;$HOME/opt/graphos"
@@ -163,9 +167,59 @@ CUDA on an H100:
163167
164168
(`+rocm amdgpu_target=gfx90a` for AMD.) Then `spack install` again.
165169

170+
Note that no device execution policy exists yet — building the stack with
171+
`+cuda` prepares the dependencies, but `exec::forall` still dispatches to host
172+
policies. See the Roadmap in [README.md](README.md).
173+
174+
---
175+
176+
## 5. The portability stack from source (no Spack)
177+
178+
[scripts/build_tpls.sh](scripts/build_tpls.sh) builds the same 2024.07 line —
179+
camp, RAJA, Umpire, CHAI — into one prefix, using only git and CMake:
180+
181+
```bash
182+
scripts/build_tpls.sh /opt/graphos-tpl
183+
```
184+
185+
camp is built first and the other three are pointed at it, so the prefix holds
186+
one camp rather than three that happen to match. `JOBS`, `TPL_VERSION` and
187+
`RAJA_OPENMP` override the defaults.
188+
189+
Then configure graphos against it exactly as with the Spack view:
190+
191+
```bash
192+
cmake -S . -B build-portable -DCMAKE_BUILD_TYPE=Release \
193+
-DGRAPHOS_ENABLE_RAJA=ON -DGRAPHOS_ENABLE_UMPIRE=ON -DGRAPHOS_ENABLE_CHAI=ON \
194+
-DCMAKE_PREFIX_PATH=/opt/graphos-tpl
195+
```
196+
197+
The CI workflow and the container call this same script, so all three build
198+
the stack one way. Editing the script invalidates the CI cache, which is why
199+
the cache key is its hash.
200+
166201
---
167202

168-
## 5. Troubleshooting
203+
## 6. The container
204+
205+
[Dockerfile](Dockerfile) runs the whole thing from a bare image, in the four
206+
stages the CI workflow uses:
207+
208+
```bash
209+
docker build -t graphos . # every stage
210+
docker build -t graphos --target tested . # stop after ctest
211+
docker build -t graphos --build-arg ENABLE_TPL=OFF . # the no-TPL path
212+
```
213+
214+
The stages are separate so a failure names its phase — `tpls` is a
215+
third-party problem, `library` is ours, `tested` is a behaviour change, and
216+
`consumer` means the install exports are wrong although everything built and
217+
passed. The final image carries the install at `/opt/graphos` with
218+
`CMAKE_PREFIX_PATH` already set.
219+
220+
---
221+
222+
## 7. Troubleshooting
169223

170224
**`find_package(graphos)` fails** — pass the install prefix:
171225
`-DCMAKE_PREFIX_PATH=$HOME/opt/graphos` when configuring the consumer.
@@ -174,12 +228,11 @@ CUDA on an H100:
174228
the TPLs are not discoverable. Activate the Spack environment or pass
175229
`-DCMAKE_PREFIX_PATH=<repo>/.spack-env/view`.
176230

177-
**Two Spack installations fighting each other** (e.g. one from Homebrew and
178-
a `~/spack` clone): they share `~/.spack` config but speak different config
179-
dialects, which surfaces as parse errors like
180-
`a single spec was requested, but parsed more than one`. Pick one — check
181-
`which spack` and `spack --version`, and invoke the one you mean by full
182-
path (`~/spack/bin/spack …`) or fix your `PATH`.
231+
**Two Spack installations in conflict** (say one from Homebrew and a
232+
`~/spack` clone): they share `~/.spack` but read different config dialects,
233+
which surfaces as `a single spec was requested, but parsed more than one`.
234+
Choose one — check `which spack` and `spack --version`, then invoke it by full
235+
path or fix `PATH`.
183236

184237
**Bootstrap error `No module named 'clingo.ast'`** — the binary-cached
185238
concretizer does not match your Python. The most reliable fix is installing
@@ -189,11 +242,10 @@ clingo directly into the Python Spack runs on (bypasses bootstrap entirely):
189242
$(spack python -c "import sys; print(sys.executable)") -m pip install clingo
190243
```
191244

192-
**macOS: builds fail instantly with an empty log** (`make: no such file`) —
193-
Apple's `/usr/bin/make` is the ancient 3.81 and Homebrew installs GNU make
194-
as `gmake` only, while Spack invokes `<prefix>/bin/make`. Install
195-
`brew install make`, create a shim providing the `make` name, and register
196-
it:
245+
**macOS: builds fail immediately with an empty log** (`make: no such file`) —
246+
Apple ships make 3.81 and Homebrew installs GNU make as `gmake` only, while
247+
Spack invokes `<prefix>/bin/make`. Install `brew install make`, then shim the
248+
`make` name and register it:
197249

198250
```bash
199251
mkdir -p ~/.spack/shims/bin && ln -sf /opt/homebrew/bin/gmake ~/.spack/shims/bin/make
@@ -236,6 +288,12 @@ AppleClang and the fmt ≤ 11.0 this Umpire line pins. The bundled
236288
[spack.yaml](spack.yaml) sets `umpire ~fmt_header_only` for this reason;
237289
keep that variant if you edit the environment.
238290

239-
**Install export was skipped** — you configured with `GRAPHOS_FETCH_TPL=ON`.
240-
That mode is for development; install builds must find the TPLs via
241-
`find_package` (the Spack view).
291+
**Install export was skipped** — the build was configured with
292+
`GRAPHOS_FETCH_TPL=ON`, which is a development mode. An install build must
293+
find the TPLs through `find_package`: the Spack view (§4) or the source prefix
294+
(§5).
295+
296+
**The Python bindings fail to build with overload errors** — pybind11 is
297+
pinned in `python/CMakeLists.txt` for this reason. `GIT_TAG stable` is a
298+
moving tag and advanced to 3.x, whose stricter overload deduction breaks the
299+
bindings with no change on this side. Keep the pin.

0 commit comments

Comments
 (0)