Skip to content

Commit 1498470

Browse files
committed
Add release notes and update documentation
1 parent da17bb2 commit 1498470

File tree

7 files changed

+208
-151
lines changed

7 files changed

+208
-151
lines changed

.readthedocs.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-20.04
11+
tools:
12+
python: "3.9"
13+
# You can also specify other tool versions:
14+
# nodejs: "16"
15+
# rust: "1.55"
16+
# golang: "1.17"
17+
18+
# Build documentation in the docs/ directory with Sphinx
19+
sphinx:
20+
configuration: doc/conf.py
21+
22+
# If using Sphinx, optionally build your docs in additional formats such as PDF
23+
formats:
24+
- pdf

CONTRIBUTING.rst

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,31 @@ developed primarily by a group of U.S. Department of Energy subcontractors, our
1010
goal is to increase community involvement and integration over time. We welcome
1111
your contributions!
1212

13-
.. note:: This document is a work in progress.
13+
14+
Copyright
15+
---------
16+
17+
All submissions to the Celeritas project are automatically licensed under the
18+
terms of [the project copyright](COPYRIGHT) as formalized by the [GitHub terms
19+
of service](https://docs.github.com/en/github/site-policy/github-terms-of-service#6-contributions-under-repository-license).
20+
21+
22+
Development prerequisites
23+
-------------------------
24+
25+
To meet the :ref:`formatting` requirements described in the development guide,
26+
make sure that `clang-format`_ is installed on your development
27+
Run ``scripts/dev/install-commit-hooks.sh`` to to install a git post-commit hook
28+
that will amend each commit with clang-format updates if necessary.
29+
30+
A mostly consistent set of decorations (separators, Doxygen comment structure,
31+
etc.) are used throughout the code, so try to make new files look like existing
32+
ones. Use the ``celeritas-gen.py`` script (in the ``scripts/dev`` directory) to
33+
generate skeletons for new files, and use existing source code as a guide to
34+
how to structure the decorations.
35+
36+
.. _clang-format: https://clang.llvm.org/docs/ClangFormat.html
37+
1438

1539
Pull request process
1640
--------------------
@@ -48,11 +72,12 @@ For example, some of the configurations currently fail due to disk space issues.
4872
Since there are few enough merge requests these days, only Maintainers may
4973
commit a merge.
5074

75+
5176
Ownership and Authorship
5277
------------------------
5378

54-
The person who writes a line of code is its author. However, Celeritas is a
55-
collaborative project with collective ownership: as much as possible, there
56-
should be a shared responsibility for the code. If the code is reviewed
57-
according to the guidelines above, at least two people should always be
58-
comfortable modifying any piece of code.
79+
The person who writes a line of code is its author but not its owner.
80+
Celeritas is a collaborative project with collective ownership: as much as
81+
possible, there should be a shared responsibility for the code.
82+
If the code is reviewed according to the guidelines above, at least two people
83+
should always be comfortable modifying any piece of code.

README.md

Lines changed: 27 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,13 @@ The Celeritas project implements HEP detector physics on GPU accelerator
44
hardware with the ultimate goal of supporting the massive computational
55
requirements of LHC-HL upgrade.
66

7-
# Installation and development
7+
# Installation
88

9-
This project requires external dependencies to build with full functionality.
10-
However, any combination of these requirements can be omitted to enable
11-
limited development on personal machines with fewer available components.
12-
13-
- [CUDA](https://developer.nvidia.com/cuda-toolkit): on-device computation
14-
- an MPI implementation (such as [Open MPI](https://www.open-mpi.org)): distributed-memory parallelism
15-
- [ROOT](https://root.cern): I/O
16-
- [nljson](https://github.com/nlohmann/json): simple text-based I/O for
17-
diagnostics and program setup
18-
- [VecGeom](https://gitlab.cern.ch/VecGeom/VecGeom): on-device navigation of GDML-defined detector geometry
19-
- [Geant4](https://geant4.web.cern.ch/support/download): preprocessing physics data for a problem input
20-
- [G4EMLOW](https://geant4.web.cern.ch/support/download): EM physics model data
21-
- [HepMC3](http://hepmc.web.cern.ch/hepmc/): Event input
22-
- [SWIG](http://swig.org): limited set of Python wrappers for analyzing input
23-
data
24-
25-
Build/test dependencies are:
26-
27-
- [CMake](https://cmake.org): build system
28-
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html): formatting enforcement
29-
- [GoogleTest](https://github.com/google/googletest): test harness
9+
This project requires external dependencies such as CUDA to build with full
10+
functionality. However, any combination of these requirements can be omitted
11+
to enable limited development on personal machines with fewer available
12+
components. See [the infrastructure documentation](doc/infrastructure.rst) for
13+
details on installing.
3014

3115
## Installing with Spack
3216

@@ -35,32 +19,19 @@ includes numerous scientific packages, including those used in HEP. An included
3519
Spack "environment" (at `scripts/dev/env/celeritas-{platform}.yaml`) defines
3620
the required prerequisites for this project.
3721

38-
The script at `scripts/dev/install-spack.sh` provides a "one-button solution"
39-
to installing and activating the Spack prerequisites for building Celeritas.
40-
Alternatively, you can manually perform the following steps:
41-
- Clone Spack following its [getting started instructions](https://spack.readthedocs.io/en/latest/getting_started.html)
42-
- Add CUDA to your `$SPACK_ROOT/etc/spack/packages.yaml` file
43-
- Run `spack env create celeritas scripts/dev/env/celeritas-linux.yaml` (or
44-
replace `linux` with `darwin` if running on a mac); then `spack -e
45-
celeritas concretize` and `spack -e celeritas install`
46-
- Run and add to your startup environment profile `spack env activate
47-
celeritas`
48-
- Configure Celeritas by creating a build directory and running CMake (or
49-
`ccmake` for an interactive prompt for configuring options).
22+
- Clone Spack following its [getting started instructions][1]
23+
- To install with CUDA, run `spack external find cuda` and
24+
`spack install celeritas +cuda cuda_arch=<ARCH>`, where `<ARCH>` is the
25+
numeric portion of the [CUDA architecture flags][2]
5026

51-
An example file for a `packages.yaml` that defines an externally installed CUDA
52-
on a system with an NVIDIA GPU that has architecture capability 3.5 is thus:
53-
```yaml
54-
packages:
55-
cuda:
56-
paths:
57-
[email protected]: /usr/local/cuda-10.2
58-
buildable: False
59-
all:
60-
variants: cuda_arch=35
61-
```
27+
[1](https://spack.readthedocs.io/en/latest/getting_started.html)
28+
[2](https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/)
6229

63-
## Configuring and building Celeritas
30+
## Configuring and building Celeritas manually
31+
32+
The spack environment at [dev/scripts.yaml](dev/scripts.yaml) lists the full
33+
dependencies used by the CI for building, testing, and documenting. Install
34+
those dependencies via spack or independently, then configure Celeritas.
6435

6536
To configure Celeritas, assuming the dependencies you want are located in the
6637
`CMAKE_PREFIX_PATH` search path, and other environment variables such as `CXX`
@@ -71,57 +42,16 @@ $ cd build && cmake ..
7142
$ make
7243
```
7344

74-
Ideally you will build Celeritas with all dependencies to gain the full
75-
functionality of the code, but there are circumstances in which you may not
76-
have all the dependencies or features available. By default, the CMake code in
77-
Celeritas queries available packages and sets several `CELERITAS_USE_{package}`
78-
options based on what it finds, so you have a good chance of successfully
79-
configuring Celeritas on the first go. Two optional components,
80-
`CELERITAS_BUILD_<DEMOS|TESTS>`, will error in the configure if their required
81-
components are missing, but they will update the CMake cache variable so that
82-
the next configure will succeed (but with that component disabled).
83-
84-
For a slightly more advanced but potentially simpler setup, you can use the
85-
CMake presets provided by Celeritas via the `CMakePresets.json` file for CMake
86-
3.21 and higher:
87-
```console
88-
$ cmake --preset=default
89-
```
90-
The three main options are "minimal", "default", and "full", which all set
91-
different expectations for available dependencies.
92-
93-
If you want to add your own set of custom options and flags, create a
94-
`CMakeUserPresets.json` file or, if you are a developer, create a preset at
95-
`scripts/cmake-presets/${HOSTNAME%%.*}.json` and call `scripts/build.sh
96-
{preset}` to create the symlink, configure the preset, build, and test. See
97-
[the scripts readme](scripts/README.md) for more details.
98-
99-
If your CMake version is too old, you may get an unhelpful message:
100-
```
101-
CMake Error: Could not read presets from celeritas: Unrecognized "version" field
102-
```
103-
which is just a poor way of saying the version in the `CMakePresets.json` file
104-
is newer than that version knows how to handle.
105-
106-
## Commit hooks
107-
108-
Run `scripts/dev/install-commit-hooks.sh` to install a git post-commit hook
109-
that will amend each commit with clang-format updates if necessary.
110-
111-
## Contributing
112-
113-
See the [development wiki
114-
page](https://github.com/celeritas-project/celeritas/wiki/Development) for
115-
guidelines and best practices for code in the project.
45+
# Development
11646

117-
The [code design
118-
page](https://github.com/celeritas-project/celeritas/wiki/Code-design) outlines
119-
the basic physics design philosophy and classes, and [the layout of some
120-
algorithms and
121-
classes](https://github.com/celeritas-project/celeritas-docs/tree/master/graphs)
122-
are available on the `celeritas-docs` repo.
47+
See the [contribution guide](CONTRIBUTING.rst) for the contribution process,
48+
and [the development guidelines](doc/appendices/development.rst) for further
49+
details on coding in Celeritas.
12350

124-
All submissions to the Celeritas project are automatically licensed under the
125-
terms of [the project copyright](COPYRIGHT) as formalized by the [GitHub terms
126-
of service](https://docs.github.com/en/github/site-policy/github-terms-of-service#6-contributions-under-repository-license).
51+
# Documentation
12752

53+
The full code documentation (including API descriptions) is available by
54+
setting the `CELERITAS_BUILD_DOCS=ON` configuration option. A mostly complete
55+
version of the [Celeritas
56+
documentation](https://celeritas.readthedocs.io/en/latest/) is hosted on
57+
`readthedocs.io`.

doc/appendices/development.rst

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@
88
Development Guide
99
*****************
1010

11+
The agility, extensibility, and performance of Celeritas depend strongly on
12+
software infrastructure and best practices. This appendix describes how to
13+
modify and extend the codebase.
14+
15+
.. include:: ../../CONTRIBUTING.rst
16+
17+
18+
Code development guidelines
19+
===========================
20+
21+
These are a list of recommendations when writing new code.
1122

12-
Guiding principles
13-
==================
1423

1524
Maximize encapsulation
1625
----------------------
@@ -43,7 +52,7 @@ Applications:
4352
Examples:
4453

4554
- Random number sampling: write a unit sphere sampling functor instead of
46-
replicating a polar-to-cartesian transform in a thousand places.
55+
replicating a polar-to-Cartesian transform in a thousand places.
4756
- Cell IDs: Opaque IDs add type safety so that you can't accidentally convert a
4857
cell identifier into a double or switch a cell and material ID. It also makes
4958
code more readable of course.
@@ -52,23 +61,27 @@ Examples:
5261
Maximize code reuse
5362
-------------------
5463

55-
No explanation needed.
64+
Duplicating code means potentially duplicating bugs, duplicating the amount of
65+
work needed when refactoring, and missing optimizations.
5666

5767

5868
Minimize compile time
5969
---------------------
6070

6171
Code performance is important but so is developer time. When possible,
6272
minimize the amount of code touched by NVCC. (NVCC's error output is also
63-
rudimentary compared to modern clang/gcc, so that's another reason to prefer
73+
rudimentary compared to modern clang/GCC, so that's another reason to prefer
6474
them compiling your code.)
6575

76+
6677
Prefer single-state classes
6778
---------------------------
6879

6980
As much as possible, make classes "complete" and valid after calling the
70-
constructor. Don't have a series of functions that have to be called in a
71-
specific order to put the class in a workable state. (And when it is not possible, code must be put in place to automatically detect (and warn the developer) if the specific order is not respected).
81+
constructor. Try to avoid "finalize" functions that have to be called in a
82+
specific order to put the class in a workable state. If a finalize function
83+
*is* used, implement assertions to detect and warn the developer if the
84+
required order is not respected.
7285

7386
When a class has a single function (especially if you name that function
7487
``operator()``), its usage is obvious. The reader also doesn't have to know
@@ -78,6 +91,7 @@ When you have a class that needs a lot of data to start in a valid state, use a
7891
``struct`` of intuitive objects to pass the data to the class's constructor.
7992
The constructor can do any necessary validation on the input data.
8093

94+
8195
Learn from the pros
8296
-------------------
8397

@@ -97,9 +111,9 @@ Test thoroughly
97111
Functions should use programmatic assertions whenever assumptions are made:
98112

99113
- Use the ``CELER_EXPECT(x)`` assertion macro to test preconditions about
100-
incoming data or initial internal states
114+
incoming data or initial internal states.
101115
- Use ``CELER_ASSERT(x)`` to express an assumption internal to a function (e.g.,
102-
"this index is not out of range of the array")
116+
"this index is not out of range of the array").
103117
- Use ``CELER_ENSURE(x)`` to mark expectations about data being returned from a
104118
function and side effects resulting from the function.
105119

@@ -118,6 +132,7 @@ Implementation detail classes (in the ``celeritas::detail`` namespace, in
118132
testing the detail classes is a good way to simplify edge case testing compared
119133
to testing the higher-level code.
120134

135+
121136
Style guidelines
122137
================
123138

@@ -132,6 +147,8 @@ became the style standard for the GPU-enabled Monte Carlo code `Shift`_.
132147
.. _Tom Evans: https://github.com/tmdelellis
133148
.. _Shift: https://doi.org/10.1016/j.anucene.2019.01.012
134149

150+
.. _formatting:
151+
135152
Formatting
136153
----------
137154

@@ -141,11 +158,15 @@ code windows to be open side-by-side. Generally, statements longer than 80
141158
columns should be broken into sub-expressions for improved readability anyway
142159
-- the ``auto`` keyword can help a lot with this.
143160

161+
Run ``scripts/dev/install-commit-hooks.sh`` to to install a git post-commit hook
162+
that will amend each commit with clang-format updates if necessary.
163+
144164
There's a certain amount of decorations (separators, Doxygen comment structure,
145165
etc.) that is standard throughout the code. Use the ``celeritas-gen.py`` script
146166
(in the ``scripts/dev`` directory) to generate skeletons for new files, and use
147167
existing source code as a guide to how to structure the decorations.
148168

169+
149170
Symbol names
150171
------------
151172

@@ -161,14 +182,15 @@ verb. For example::
161182
ModelEvaluator evaluate_something(parameters...);
162183
auto result = evaluate_something(arguments...);
163184

164-
There are many opportunities to use `OpaqueId` in GPU code to indicate
185+
There are many opportunities to use ``OpaqueId`` in GPU code to indicate
165186
indexing into particular vectors. To maintain consistency, we let an
166-
index into a vector of `Foo` have a corresponding OpaqueId type::
187+
index into a vector of ``Foo`` have a corresponding ``OpaqueId`` type::
167188

168189
using FooId = OpaqueId<Foo>;
169190

170-
and ideally be defined either immediately after `Foo` or in a `Types.hh` file.
171-
Some OpaqueId types may have only a "symbolic" corresponding type, in which case
191+
and ideally be defined either immediately after ``Foo`` or in a
192+
:file:`Types.hh` file. Some ``OpaqueId`` types may have only a "symbolic"
193+
corresponding type, in which case
172194
a tag struct can be be defined inline::
173195

174196
using BarId = OpaqueId<struct Bar>;
@@ -208,6 +230,7 @@ Some files have special extensions:
208230
- ``.test.cc`` are unit test executables corresponding to the main ``.cc``
209231
file. These should only be in the main ``/test`` directory.
210232

233+
211234
Device compilation
212235
------------------
213236

@@ -260,6 +283,7 @@ Use scoped enumerations (``enum class``) where possible (named like classes) so
260283
their values can safely be named like member variables (lowercase with
261284
underscores).
262285

286+
263287
Function arguments and return values
264288
------------------------------------
265289

@@ -321,6 +345,7 @@ with the standard library. (It's also possible to have ``template <typename``
321345
where ``typename`` *doesn't* mean a class: namely,
322346
``template <typename U::value_type Value>``.)
323347

348+
324349
Data management
325350
===============
326351

@@ -378,7 +403,3 @@ View
378403
mass of a particle (constant, set by the model) and the speed (variable,
379404
depends on particle track state).
380405

381-
382-
.. include:: ../../CONTRIBUTING.rst
383-
384-

0 commit comments

Comments
 (0)