This section presents some recommendations to get the most from DL4J when training on Spark. Let's start with some considerations about memory configuration. It is important to understand how DL4J manages memory first. This framework is built upon the ND4J scientific library (written in C++). ND4J utilizes off-heap memory management—this means that the memory allocated for INDArrays isn't on the JVM heap, as happens for Java objects, but it is allocated outside the JVM. This kind of memory management allows for the efficient use of high-performance native code for numerical operations and it is also necessary for efficient operations with CUDA (https://developer.nvidia.com/cuda-zone) when running on GPUs.
This way, ...