You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wiki/python/ESTIMATOR_GUIDE.md
+28-18Lines changed: 28 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,24 +162,34 @@ Internally, all arrays should be converted to `CumlArray` as much as possible si
162
162
163
163
### Host and Device Arrays
164
164
165
-
Beginning with version 23.02, cuML provides support for executing at least
166
-
some algorithms either on CPU or on GPU. Therefore, `CumlArray` objects can
167
-
now be backed by either host or device memory.
168
-
169
-
To ensure that arrays used by algorithms are backed by the correct memory
170
-
type, two new global settings were introduced: `device_type` (`'cpu'` or
171
-
`'gpu'`) and `memory_type` (`'host'` or `'device'`). The former indicates
172
-
what sort of computational device will be used to execute an algorithm while
173
-
the latter indicates where arrays should be stored if not otherwise
174
-
specified. If the `device_type` is updated to a value incompatible with the
175
-
current `memory_type`, the `memory_type` will be changed to something
176
-
compatible with `device_type`, but the reverse is not true. This allows for
177
-
e.g. allocating an array where results will ultimately be stored even if the
178
-
actual computation will take place on a different device.
179
-
180
-
New array output types were also introduced to take advantage of these
181
-
settings by deferring where appropriate to the globally-set memory type. Read
182
-
on for more details on how to take advantage of these types.
165
+
cuML provides flexible memory management through the `CumlArray` class, which can store data in either device-accessible or host-accessible memory. This flexibility allows for efficient data handling and computation.
166
+
167
+
To control where arrays are stored, the `memory_type` setting determines where arrays are stored by default. This setting can be configured through:
168
+
169
+
1. Global settings:
170
+
```python
171
+
import cuml
172
+
cuml.global_settings.memory_type ='device'# For device-accessible memory
173
+
```
174
+
175
+
2. Context managers:
176
+
```python
177
+
with cuml.using_memory_type('device'):
178
+
# Arrays created here will use device-accessible memory
179
+
pass
180
+
```
181
+
182
+
3. Individual estimator settings:
183
+
```python
184
+
estimator = MyEstimator(output_mem_type='device')
185
+
```
186
+
187
+
The memory type settings allow for efficient data management:
188
+
- Use device-accessible memory for GPU-accelerated computations
189
+
- Use host-accessible memory for data that needs to be accessed by the CPU
190
+
- Let cuML handle memory transfers automatically when needed
191
+
192
+
New array output types were introduced to take advantage of these settings by deferring to the globally-set memory type. Read on for more details on how to take advantage of these types.
0 commit comments