Intel® Data Analytics Acceleration Library (Intel® DAAL) provides a Java API and the ease-of-use for Java programmers. This article discusses how to build and run applications with the Eclipse IDE (one of the most popular Java IDEs). The procedures outlined in this article should also be applicable to other Java IDEs.
If you want to build and run Java applications from the command line, see instructions from Getting Started with Intel Data Analytics Acceleration Library.
Import Intel DAAL Java Packages
To make Intel DAAL classes and methods available to your application, we need to import necessary Intel DAAL packages. For example,
import com.intel.daal.algorithms.pca.*; import com.intel.daal.data_management.data.NumericTable; import com.intel.daal.data_management.data_source.FileDataSource; import com.intel.daal.data_management.data_source.DataSource; import com.intel.daal.services.*;
Configure Java Build Path
Java build path configuration can be accessed from Properties (right-clicking the project name).
- Step 1. Make sure the Intel DAAL Java native library is included as part of source by setting "Native library location" to the directory containing JavaAPI.dll. The picture below shows an example on Windows. On Linux or OS X, set it to the directory containing JavaAPI.so.
- Step 2. Make sure the Libraries tab contains daal.jar on the build path, as shown below.
Configure Run/Debug Settings
Run/Debug settings are also accessible from project Properties.
- Step 1. Create a new launch configuration and give it a name.
- Step 2. In the Edit Configuration pop-up window, make sure the Main class on the Main tab is properly set.
- Step 3. Still in the Edit Configuration pop-up window, go to the Classpath tab and make sure daal.jar is included.
- Step 4. At last, go to the Environment tab and add a Path environment variable and set its value to be the directories containing, respectively, DAAL runtime library, OpenMP runtime library, and Intel TBB runtime library. Here's an example on Windows:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\daal;
C:\Program Files (x86)\IntelSWTools\\compilers_and_libraries\windows\redist\intel64_win\compiler;
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\tbb\vc_mt
Note on Linux and OS X, the environment variable to be added should be LD_LIBRARY_PATH; and similarly its value should be the paths containing the DAAL runtime library, the OpenMP runtime library, and the Intel TBB runtime library.
Make sure Append environment to native environment is selected, and click Apply to save the changes.
These are the settings specifically necessary for using Intel DAAL in our Java project. We should now be able to build, run, and debug our project from within Eclipse. Refer to the online documentation to learn more about Intel DAAL.