|
2 | 2 | title: CPU and AVX
|
3 | 3 | short_title: CPU
|
4 | 4 | description: CPU and AVX support in ND4J/Deeplearning4j
|
5 |
| -layout: default |
| 5 | +layout: redirect |
| 6 | +redirectTo: https://deeplearning4j.konduit.ai/config/backends/cpu |
6 | 7 | ---
|
7 | 8 |
|
8 |
| -# ND4J - CPU (nd4j-native) AVX Configuration |
| 9 | +The documentation has moved to a new location. You will be automatically redirected. |
| 10 | + |
| 11 | +[Go to CPU and AVX without waiting for the redirect](https://deeplearning4j.konduit.ai/config/backends/cpu) |
9 | 12 |
|
10 |
| -### What is AVX, and why does it matter? |
11 |
| - |
12 |
| -AVX (Advanced Vector Extensions) is a set of CPU instructions for accelerating numerical computations. See [Wikipedia](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) for more details. |
13 |
| - |
14 |
| -Note that AVX only applies to nd4j-native (CPU) backend for x86 devices, not GPUs and not ARM/PPC devices. |
15 |
| - |
16 |
| -Why AVX matters: performance. You want to use the version of ND4J compiled with the highest level of AVX supported by your system. |
17 |
| - |
18 |
| - |
19 |
| -AVX support for different CPUs - summary: |
20 |
| -* Most modern x86 CPUs: AVX2 is supported |
21 |
| -* Some high-end server CPUs: AVX512 may be supported |
22 |
| -* Old CPUs (pre 2012) and low power x86 (Atom, Celeron): No AVX support (usually) |
23 |
| - |
24 |
| -Note that CPUs supporting later versions of AVX include all earlier versions also. This means it's possible run a generic x86 or AVX2 binary on a system supporting AVX512. |
25 |
| -However it is not possible to run binaries built for later versions (such as avx512) on a CPU that doesn't have support for those instructions. |
26 |
| - |
27 |
| -Note on current snapshots (and in future releases, after 1.0.0-beta5) you may get a warning as follows, if AVX is not configured optimally: |
28 |
| -``` |
29 |
| -o.n.l.c.n.CpuNDArrayFactory - *********************************** CPU Feature Check Warning *********************************** |
30 |
| -o.n.l.c.n.CpuNDArrayFactory - Warning: Initializing ND4J with Generic x86 binary on a CPU with AVX/AVX2 support |
31 |
| -o.n.l.c.n.CpuNDArrayFactory - Using ND4J with AVX/AVX2 will improve performance. See deeplearning4j.org/cpu for more details |
32 |
| -o.n.l.c.n.CpuNDArrayFactory - Or set environment variable ND4J_IGNORE_AVX=true to suppress this warning |
33 |
| -o.n.l.c.n.CpuNDArrayFactory - ************************************************************************************************ |
34 |
| -``` |
35 |
| - |
36 |
| - |
37 |
| -### Configuring AVX in ND4J/DL4J |
38 |
| - |
39 |
| -As noted earlier, for best performance you should use the version of ND4J that matches your CPU's supported AVX level. |
40 |
| - |
41 |
| -ND4J defaults configuration (when just including the nd4j-native or nd4j-native-platform dependencies without maven classifier configuration): |
42 |
| -* 1.0.0-beta5 and earlier: "generic x86" (no AVX) is the default for nd4j/nd4j-platform dependencies |
43 |
| -* Current snapshots and later versions of ND4J: AVX2 is the default |
44 |
| - |
45 |
| - |
46 |
| -To configure AVX2 and AVX512, you need to specify a classifier for the appropriate architecture. |
47 |
| - |
48 |
| -The following binaries (nd4j-native classifiers) are provided for x86 architectures: |
49 |
| -* Generic x86 (no AVX): `linux-x86_64`, `windows-x86_64`, `macosx-x86_64` |
50 |
| -* AVX2: `linux-x86_64-avx2`, `windows-x86_64-avx2`, `macosx-x86_64-avx2` |
51 |
| -* AVX512: `linux-x86_64-avx512` |
52 |
| - |
53 |
| - |
54 |
| -**Example: Configuring AVX2 on Windows (Maven pom.xml)** |
55 |
| -``` |
56 |
| -<dependency> |
57 |
| - <groupId>org.nd4j</groupId> |
58 |
| - <artifactId>nd4j-native</artifactId> |
59 |
| - <version>${nd4j.version}</version> |
60 |
| -</dependency> |
61 |
| -
|
62 |
| -<dependency> |
63 |
| - <groupId>org.nd4j</groupId> |
64 |
| - <artifactId>nd4j-native</artifactId> |
65 |
| - <version>${nd4j.version}</version> |
66 |
| - <classifier>windows-x86_64-avx2</classifier> |
67 |
| -</dependency> |
68 |
| -``` |
69 |
| - |
70 |
| - |
71 |
| -**Example: Configuring AVX512 on Linux (Maven pom.xml)** |
72 |
| -``` |
73 |
| -<dependency> |
74 |
| - <groupId>org.nd4j</groupId> |
75 |
| - <artifactId>nd4j-native</artifactId> |
76 |
| - <version>${nd4j.version}</version> |
77 |
| -</dependency> |
78 |
| -
|
79 |
| -<dependency> |
80 |
| - <groupId>org.nd4j</groupId> |
81 |
| - <artifactId>nd4j-native</artifactId> |
82 |
| - <version>${nd4j.version}</version> |
83 |
| - <classifier>linux-x86_64-avx512</classifier> |
84 |
| -</dependency> |
85 |
| -``` |
86 |
| - |
87 |
| -Note that you need *both* nd4j-native dependencies - with and without the classifier. |
| 13 | + |
0 commit comments