Skip to content

Commit 2c97811

Browse files
authored
Apply suggestions from code review
1 parent b7bdf98 commit 2c97811

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

DifferentiationInterface/docs/src/explanation/operators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ op(f, prep, backend, x, [t]) # fast because it skips preparation
117117

118118
!!! warning
119119
The `prep` object is the last argument before `backend` and it is always mutated, regardless of the bang `!` in the operator name.
120-
As a consequence preparation is **not thread safe** and sharing `prep` object between threads may lead to undefined behavior. If you need to run differentiation concurrently, prepare separate `prep` objects for each thread.
120+
As a consequence, preparation is **not thread-safe** and sharing `prep` objects between threads may lead to unexpected behavior. If you need to run differentiation concurrently, prepare separate `prep` objects for each thread.
121121

122122
### Reusing preparation
123123

DifferentiationInterface/src/docstrings.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ function docstring_prepare(operator; samepoint=false, inplace=false)
2525
The preparation result `prep` is only reusable as long as the arguments to `$operator` do not change type or size, and the function and backend themselves are not modified.
2626
Otherwise, preparation becomes invalid and you need to run it again.
2727
In some settings, invalid preparations may still give correct results (e.g. for backends that require no preparation), but this is not a semantic guarantee and should not be relied upon.
28+
2829
!!! danger
29-
The preparation result `prep` is **not thread safe**. Sharing it between threads may lead to undefined behavior. If you need to run differentiations concurrently, prepare separate `prep` objects for each thread.
30+
The preparation result `prep` is **not thread-safe**. Sharing it between threads may lead to unexpected behavior. If you need to run differentiations concurrently, prepare separate `prep` objects for each thread.
3031
3132
When `strict=Val(true)` (the default), type checking is enforced between preparation and execution (but size checking is left to the user).
3233
While your code may work for different types by setting `strict=Val(false)`, this is not guaranteed by the API and can break without warning.

0 commit comments

Comments
 (0)