Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4b3c82f

Browse files
Merge pull request #192 from eclipse/ab_20190911_cpu
Add CPU/AVX page
2 parents fd32420 + a15a791 commit 4b3c82f

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

‎cpu.md‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
title: CPU and AVX
3+
short_title: CPU
4+
description: CPU and AVX support in ND4J/Deeplearning4j
5+
layout: default
6+
redirect_from: "/cpu"
7+
---
8+
9+
# ND4J - CPU (nd4j-native) AVX Configuration
10+
11+
### What is AVX, and why does it matter?
12+
13+
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.
14+
15+
Note that AVX only applies to nd4j-native (CPU) backend for x86 devices, not GPUs and not ARM/PPC devices.
16+
17+
Why AVX matters: performance. You want to use the version of ND4J compiled with the highest level of AVX supported by your system.
18+
19+
20+
AVX support for different CPUs - summary:
21+
* Most modern x86 CPUs: AVX2 is supported
22+
* Some high-end server CPUs: AVX512 may be supported
23+
* Old CPUs (pre 2012) and low power x86 (Atom, Celeron): No AVX support (usually)
24+
25+
AVX is backward compatible, so for example it's possible run a generic x86 or AVX2 binary on a system supporting AVX512.
26+
However it is not possible to run
27+
28+
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:
29+
```
30+
o.n.l.c.n.CpuNDArrayFactory - *********************************** CPU Feature Check Warning ***********************************
31+
o.n.l.c.n.CpuNDArrayFactory - Warning: Initializing ND4J with Generic x86 binary on a CPU with AVX/AVX2 support
32+
o.n.l.c.n.CpuNDArrayFactory - Using ND4J with AVX/AVX2 will improve performance. See deeplearning4j.org/cpu for more details
33+
o.n.l.c.n.CpuNDArrayFactory - Or set environment variable ND4J_IGNORE_AVX=true to suppress this warning
34+
o.n.l.c.n.CpuNDArrayFactory - ************************************************************************************************
35+
```
36+
37+
38+
### Configuring AVX in ND4J/DL4J
39+
40+
As noted earlier, for best performance you should use the version of ND4J that matches your CPU's supported AVX level.
41+
42+
ND4J defaults configuration (when just including the nd4j-native or nd4j-native-platform dependencies without maven classifier configuration):
43+
* 1.0.0-beta5 and earlier: "generic x86" (no AVX) is the default for nd4j/nd4j-platform dependencies
44+
* Current snapshots and later versions of ND4J: AVX2 is the default
45+
46+
47+
To configure AVX2 and AVX512, you need to specify a classifier for the appropriate architecture.
48+
49+
The following binaries (nd4j-native classifiers) are provided for x86 architectures:
50+
* Generic x86 (no AVX): `linux-x86_64`, `windows-x86_64`, `macosx-x86_64`
51+
* AVX2: `linux-x86_64-avx2`, `windows-x86_64-avx2`, `macosx-x86_64-avx2`
52+
* AVX512: `linux-x86_64-avx512`
53+
54+
55+
**Example: Configuring AVX2 on Windows (Maven pom.xml)**
56+
```
57+
<dependency>
58+
<groupId>org.nd4j</groupId>
59+
<artifactId>nd4j-native</artifactId>
60+
<version>${nd4j.version}</version>
61+
</dependency>
62+
63+
<dependency>
64+
<groupId>org.nd4j</groupId>
65+
<artifactId>nd4j-native</artifactId>
66+
<version>${nd4j.version}</version>
67+
<classifier>windows-x86_64-avx2</classifier>
68+
</dependency>
69+
```
70+
71+
72+
**Example: Configuring AVX512 on Linux (Maven pom.xml)**
73+
```
74+
<dependency>
75+
<groupId>org.nd4j</groupId>
76+
<artifactId>nd4j-native</artifactId>
77+
<version>${nd4j.version}</version>
78+
</dependency>
79+
80+
<dependency>
81+
<groupId>org.nd4j</groupId>
82+
<artifactId>nd4j-native</artifactId>
83+
<version>${nd4j.version}</version>
84+
<classifier>linux-x86_64-avx512</classifier>
85+
</dependency>
86+
```
87+
88+
Note that you need *both* nd4j-native dependencies - with and without the classifier.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /