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
A comprehensive list can be found in the [DaphneLib API reference](/doc/DaphneLib/APIRef.md#daphnecontext).
134
+
A comprehensive list can be found in the [DaphneLib API reference](/doc/DaphneLib/APIRef.md#daphnecontext-api-reference).
135
135
136
136
## Building Complex Computations
137
137
@@ -241,6 +241,10 @@ If the result of the computation in DAPHNE is a matrix, `compute()` returns a `n
241
241
242
242
So far, DaphneLib can exchange data with numpy, pandas, TensorFlow, and PyTorch.
243
243
By default, the data transfer is via shared memory (and in many cases zero-copy).
244
+
Numpy and pandas are *required* dependencies for DaphneLib, so they should anyway be installed.
245
+
TensorFlow and PyTorch are *optional*for DaphneLib;if these libraries are not installed, DaphneLib cannot exchange data with them, but all remaining features still work.
246
+
In case you run DAPHNE inside the [`daphne-dev` container](/doc/GettingStarted.md), please note that TensorFlow and PyTorch are *not* included in the `daphne-dev` container due to their large footprint.
247
+
Please follow the [instructions](/doc/development/InstallPythonLibsInContainer.md) on installing Python libraries in the `daphne-dev` container if you need them.
Copy file name to clipboardExpand all lines: doc/Extensions.md
+30-4Lines changed: 30 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,9 +173,12 @@ make
173
173
### Step 3: Using a Kernel Extension
174
174
175
175
The kernels in a kernel extension can be used either automatically by DAPHNE or manually by the user.
176
-
Automatic use is currently restricted to the selection of the kernel based on result/argument data/value types, but in the future we plan to support custom cost models as well.
177
-
Besides that, the manual employment of custom kernels is very useful for experimentation, e.g., to see the impact of the kernel in the context of a larger integrated data analysis pipeline.
178
-
To this end, DaphneDSL [compiler hints](/doc/DaphneDSL/LanguageRef.md#compiler-hints) tell DAPHNE to use a specific kernel, even though DAPHNE's optimizing compiler may not choose the kernel, otherwise.
176
+
The manual use has precedence over the automatic use.
177
+
178
+
#### Manual Use of Custom Kernels
179
+
180
+
The manual employment of custom kernels is very useful for experimentation, e.g., to see the impact of a particular kernel at a certain point of a larger integrated data analysis pipeline.
181
+
To this end, DaphneDSL [compiler hints](/doc/DaphneDSL/LanguageRef.md#compiler-hints) tell DAPHNE to use a specific kernel in a specific place, even though DAPHNE's optimizing compiler may not choose the kernel, otherwise.
179
182
180
183
*Running example:*
181
184
@@ -205,7 +208,7 @@ s = sum::mySumSeq(X);
205
208
print(s);
206
209
```
207
210
208
-
We execute this script with the following command, whereby the argument `--kernel-ext`specified the kernel catalog JSON file of the extension to use:
211
+
We execute this script with the following command, whereby the argument `--kernel-ext`specifies the kernel catalog JSON file of the extension to use:
The automatic use of custom kernels is currently restricted to the selection of a kernel based on its result/argument data/value types and its priority level.
233
+
In the future we plan to support custom cost models as well.
234
+
235
+
*Running example:*
236
+
237
+
Continuing the running example from above, we can make DAPHNE use the custom kernels `mySumSeq()` or `mySumSIMD()` even without a manual kernel hint by specifying a suitable *priority* when registering the `myKernels` extension with DAPHNE.
238
+
239
+
Priority levels can optionally be specified with the `--kernel-ext` command line argument by appending a colon (`:`) followed by the priority as an integer.
240
+
The default priority of `0` is used for all built-in kernels and for extension kernels in case no priority is specified.
241
+
When registering a kernel extension, the given priority is assigned to *all* kernels provided by the extension.
242
+
When multiple kernels are applicable for an operation based on the combination of argument/result data/value types as well as the backend, DAPHNE chooses the kernel with the highest priority.
243
+
If there are multiple kernels with the highest priority, it is not specified which of them is used.
244
+
245
+
By registering a kernel extension with a priority greater than zero, one can enforce that the kernels provided by the extension are always preferred over the built-in ones whenever they are applicable.
246
+
For instance, the following command registers the `myKernels` extension with a priority of `1`.
247
+
As the `myKernels` extension provides two kernels for the same operation, argument/result types, and backend, we cannot tell, based on priorities, which of these kernels will be used, but we can be sure that the built-in kernel will not be employed.
The development container image already contains all necessary dependencies of a DAPHNE development environment as well as a useful initialization of environment variables etc., such that you don't need to worry about these things and can have a productive start.
128
+
The development container image already contains all necessary (¹) dependencies of a DAPHNE development environment as well as a useful initialization of environment variables etc., such that you don't need to worry about these things and can have a productive start.
***Hint:** You may want to choose another image tag based on your platform and needs, e.g., `latest_X86-64_CUDA` (for GPU support) or `latest_ARMV8_BASE` (for ARM support).*
138
138
139
+
***Hint:** (¹) TensorFlow and PyTorch are *optional* for DaphneLib and *not included* in the `daphne-dev`container due to their footprint of several gigabytes. Please follow the [instructions](/doc/development/InstallPythonLibsInContainer.md) on installing Python libraries in the `daphne-dev` container if you need these libraries.*
140
+
139
141
**Enter the container**, which should finally print something like the following (where `xyz` is your user name on your system, and the password and IP address may vary):
Licensed under the Apache License, Version 2.0 (the "License");
5
+
you may not use this file except in compliance with the License.
6
+
You may obtain a copy of the License at
7
+
8
+
http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+
Unless required by applicable law or agreed to in writing, software
11
+
distributed under the License is distributed on an "AS IS" BASIS,
12
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+
See the License for the specific language governing permissions and
14
+
limitations under the License.
15
+
-->
16
+
17
+
# Installing Python Libraries in the `daphne-dev` Container
18
+
19
+
The `daphne-dev` container (see [GettingStarted](/doc/GettingStarted.md)) already contains all *required* dependencies for running DAPHNE. However, there can be reasons to install additional Python libraries inside the container, e.g.:
20
+
21
+
1.**To use/test DaphneLib's data exchange with TensorFlow and PyTorch.**
22
+
DaphneLib, DAPHNE's Python API, supports the efficient data exchange with widely-used Python libraries like numpy, pandas, TensorFlow, and PyTorch.
23
+
Numpy and pandas are required for DaphneLib.
24
+
Thus, they are already installed in the `daphne-dev` container.
25
+
In contrast to that, TensorFlow and PyTorch are optional for DaphneLib; if these libraries are not installed on the system, DaphneLib cannot exchange data with them, but all remaining features still work.
26
+
Likewise, the test cases related to the data exchange with TensorFlow and PyTorch will only run if these libraries are installed.
27
+
As TensorFlow and PyTorch would increase the `daphne-dev` container size by several gigabytes, they are *not* included in the container.
28
+
1.**To add support for additional Python libraries in DaphneLib.**
29
+
For instance, while implementing efficient data exchange with these additional libraries.
30
+
1.**To build integrated data analysis pipelines involving additional Python libraries.**
31
+
For instance, for experiments.
32
+
33
+
## Installing Additional Python Libraries
34
+
35
+
Additional Python libraries are best installed in a *Python virtual environment* inside the `daphne-dev` container.
36
+
To that end, execute the following commands inside the container:
37
+
38
+
**Create a Python virtual environment and activate it:**
39
+
40
+
```bash
41
+
sudo apt update
42
+
sudo apt install python3.12-venv
43
+
python3 -m venv daphne-venv
44
+
source daphne-venv/bin/activate
45
+
```
46
+
47
+
Here, we call the virtual environment `daphne-venv`.
48
+
Feel free to choose a different name.
49
+
50
+
**Install the desired Python libraries using `pip`:**
51
+
52
+
For instance, if you want to use/test DaphneLib's efficient data transfer with widely-used Python libraries like numpy, pandas, TensorFlow, and PyTorch, install the following libraries.
53
+
Feel free to install any library you like.
54
+
55
+
```bash
56
+
pip install numpy pandas tensorflow torch
57
+
```
58
+
59
+
The libraries you install that way will be stored in the `daphne-venv` directory on the host and, thus, keep existing after you shut down the container.
60
+
61
+
## Don't Forget
62
+
63
+
Every time you enter the `daphne-dev` container, make sure to activate the Python virtual environment again:
0 commit comments