Skip to content

Commit 3b79c3c

Browse files
authored
docs: Fix @example blocks in gpu_management.md (#1571)
* Fix `@example` blocks in gpu_management.md * Combine `@example` blocks in gpu_management.md
1 parent fa58661 commit 3b79c3c

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

docs/src/manual/gpu_management.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,32 @@ Automatic Backend Management is done by two simple functions: `cpu_device` and `
3131

3232
* [`cpu_device`](@ref): This is a simple function and just returns a `CPUDevice` object.
3333

34-
```@example gpu_management
35-
cdev = cpu_device()
36-
```
34+
```@example gpu_management
35+
cdev = cpu_device()
3736
38-
```@example gpu_management
39-
x_cpu = randn(Float32, 3, 2)
40-
```
37+
x_cpu = randn(Float32, 3, 2)
38+
```
4139

4240
* [`gpu_device`](@ref): This function performs automatic GPU device selection and returns
43-
an object.
44-
1. If no GPU is available, it returns a `CPUDevice` object.
45-
2. If a LocalPreferences file is present, then the backend specified in the file is used.
46-
To set a backend, use `Lux.gpu_backend!(<backend_name>)`. (a) If the trigger package
47-
corresponding to the device is not loaded, then a warning is displayed. (b) If no
48-
LocalPreferences file is present, then the first working GPU with loaded trigger
49-
package is used.
50-
51-
```@example gpu_management
52-
gdev = gpu_device()
53-
54-
x_gpu = x_cpu |> gdev
55-
```
56-
57-
```@example gpu_management
58-
(x_gpu |> cdev) ≈ x_cpu
59-
```
41+
an object.
42+
43+
1. If no GPU is available, it returns a `CPUDevice` object.
44+
45+
2. If a LocalPreferences file is present, then the backend specified in the file is used.
46+
To set a backend, use `Lux.gpu_backend!(<backend_name>)`. (a) If the trigger package
47+
corresponding to the device is not loaded, then a warning is displayed. (b) If no
48+
LocalPreferences file is present, then the first working GPU with loaded trigger
49+
package is used.
50+
51+
```@example gpu_management
52+
gdev = gpu_device()
53+
54+
x_gpu = x_cpu |> gdev
55+
```
56+
57+
```@example gpu_management
58+
(x_gpu |> cdev) ≈ x_cpu
59+
```
6060

6161
## Manual Backend Management
6262

0 commit comments

Comments
 (0)