### Set Up oneMKL Environment (Windows) Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/get-started/build-and-run-examples.rst Executes the oneMKL environment setup batch file, required for static linking of oneDAL examples. ```batch call mkl/latest/env/vars.bat ``` -------------------------------- ### Set Up oneMKL Environment (Linux) Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/get-started/build-and-run-examples.rst Sources the oneMKL environment setup script, which is necessary for static linking of oneDAL examples. ```bash source mkl/latest/env/vars.sh ``` -------------------------------- ### Copy Examples Directory Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/get-started/build-and-run-examples.rst Copies the DPCPP examples from the oneDAL installation directory to a writable location. This is necessary because the examples may create temporary files during execution. ```bash cp –r ./examples/oneapi/dpc ${WRITABLE_DIR} ``` -------------------------------- ### Build and Run oneDAL C++ Samples with ASAN (Linux) Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md This comprehensive snippet demonstrates building oneDAL C++ samples with ASAN enabled, creating the necessary ASAN runtime symlink, and running a specific example with verbose output. It includes setting compiler flags, CMake configuration, and execution commands. ```shell cd daal/latest/examples/daal/cpp mkdir -p build cd build CC=icx CXX=icpx CXXFLAGS="-fsanitize=address" LDFLAGS="-shared-libasan" cmake .. make -j$(nproc) ln -s $(clang -print-file-name=libclang_rt.asan-x86_64.so) libclang_rt.asan.so ONEDAL_VERBOSE=1 ./_cmake_results/intel_intel64_so/adaboost_dense_batch ``` -------------------------------- ### Install 'make' utility on Windows using MSYS2 Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Instructions for installing the 'make' utility on Windows systems using the MSYS2 package manager. This is a prerequisite for manual installation on Windows if 'make' is not already available. ```bash pacman -S msys/make ``` -------------------------------- ### Run oneDAL C++ Samples (Windows) Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Execute compiled oneDAL C++ samples on Windows using `mpiexec`. Similar to Linux, you specify the number of processes and the example executable path. ```shell mpiexec -n {num_processes} ./_cmake_results/{platform_name}/{example} ``` -------------------------------- ### Build and Run Examples (Windows) Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/get-started/build-and-run-examples.rst Compiles and runs oneDAL examples on Windows using DPCPP. This process includes setting the compiler, generating NMake Makefiles with CMake, and then building the examples. Static linking is enabled by setting DONEDAL_LINK=static. ```batch # Navigate to examples directory and build examples cd /examples/oneapi/dpc set CC=icx set CXX=icx cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DEXAMPLES_LIST=svm_two_class_thunder # This would generate makefiles for all svm examples matching passed name nmake # This will compile and run generated svm examples cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DONEDAL_LINK=static # This wouldgenerate make for static version nmake # This will compile and run all the examples ``` -------------------------------- ### Run oneDAL C++ Samples (Linux) Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Execute compiled oneDAL C++ samples on Linux using `mpirun`. You need to specify the number of processes and the path to the compiled example executable. ```shell mpirun -n {num_processes} ./_cmake_results/{platform_name}/{example} ``` -------------------------------- ### Set up Intel oneMKL Environment (Linux) Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Configures environment variables for Intel(R) oneMKL on Linux. This is needed if oneMKL was not included in the general oneAPI setup. ```bash source /opt/intel/oneapi/mkl/latest/env/vars.sh ``` -------------------------------- ### Build and Run Examples (Linux) Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/get-started/build-and-run-examples.rst Compiles and runs oneDAL examples on Linux using DPCPP. It involves setting the compiler, generating Makefiles with CMake, and then building the examples. Static linking can be enabled by setting DONEDAL_LINK=static. ```bash # Navigate to examples directory and build examples cd /examples/oneapi/dpc export CC=icx export CXX=icpx or export CXX=icx cmake -G "Unix Makefiles" -DEXAMPLES_LIST=svm_two_class_thunder # This would generate makefiles for all svm examples matching passed name make # This will compile and run generated svm examples cmake -G "Unix Makefiles" -DONEDAL_LINK=static # This wouldgenerate make for static version make # This will compile and run all the examples ``` -------------------------------- ### Gradient Boosted Trees Regression C++ (CPU) Batch Example Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/daal/algorithms/gradient_boosted_trees/gradient-boosted-trees-regression.rst Provides a C++ example for batch processing with Gradient Boosted Trees Regression on CPU using the default dense method. This example demonstrates the practical application of the algorithm in a C++ environment. ```cpp #include "gradient_boosted_trees/gbt_reg_dense_batch.cpp" ``` -------------------------------- ### L-BFGS C++ Examples Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/daal/algorithms/optimization-solvers/solvers/lbfgs.rst Provides links to C++ examples for using the L-BFGS algorithm in batch processing mode. ```APIDOC ## L-BFGS C++ Examples ### Description These examples demonstrate how to use the L-BFGS algorithm for batch processing on CPU. ### Examples - **Dense Batch Processing**: - `lbfgs_dense_batch.cpp` - `lbfgs_opt_res_dense_batch.cpp` ``` -------------------------------- ### L-BFGS Python Examples Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/daal/algorithms/optimization-solvers/solvers/lbfgs.rst Provides links to Python examples for using the L-BFGS algorithm in batch processing mode. ```APIDOC ## L-BFGS Python Examples ### Description These examples demonstrate how to use the L-BFGS algorithm with the `daal4py` library for batch processing. ### Examples - **Batch Processing**: - `lbfgs_cr_entr_loss.py` - `lbfgs_mse.py` ``` -------------------------------- ### Install oneDAL using Conda Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/installation.rst Installs the oneDAL development package using the Conda package manager from the conda-forge channel. This is a convenient way to get the library for Conda environments. ```bash conda install -c conda-forge dal-devel ``` -------------------------------- ### Makefile Include Example Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/contribution/cpu_features.rst Demonstrates how to include architecture-specific makefiles into the main Makefile. This allows for modular build system configuration. ```makefile include dev/make/function_definitions/32e.mk include dev/make/function_definitions/$(PLAT).mk ``` -------------------------------- ### GNU Compiler Options for Architectures Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/contribution/cpu_features.rst Shows example compiler options for different CPU architectures using the GNU compiler, as defined in the `gnu.32e.mk` file. These options are crucial for CPU-specific optimizations. ```makefile p4_OPT.gnu = $(-Q)march=nocona mc3_OPT.gnu = $(-Q)march=corei7 avx2_OPT.gnu = $(-Q)march=haswell skx_OPT.gnu = $(-Q)march=skylake ``` -------------------------------- ### C++ Naming Conventions: Constant Example Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/contribution/coding_guide.rst Provides an example of how to name constants in C++. Constants should be declared using `const` and follow the camelCase naming convention, starting with a lowercase letter. ```cpp const int daysInAWeek = 7; ``` -------------------------------- ### C++ Naming Conventions: Type Examples Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/contribution/coding_guide.rst Demonstrates the naming conventions for C++ type names, including classes, structs, typedefs, and enums. These names should start with a capital letter and use CamelCase without underscores. ```cpp // Type examples: class MyClass; struct MyStruct; typedef int MyType; enum MyEnum; ``` -------------------------------- ### Build oneDAL MySQL C++ Samples (macOS) Source: https://github.com/uxlfoundation/onedal/blob/main/samples/daal/cpp/mysql/README.md Builds the oneDAL MySQL C++ samples on macOS. Requires selecting the correct architecture (libintel64 or dylibintel64) and compiler (intel, gnu, or clang). The command generates output in a directory like `_results/intel_intel64_a`. ```bash cd /cpp/mysql make {libintel64|dylibintel64} compiler={intel|gnu|clang} mode=build ``` -------------------------------- ### Create ASAN Runtime Symlink on Linux Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Creates a symbolic link to the ASAN runtime library, which is required when running examples compiled with ASAN. This command finds the correct ASAN library path using `clang` and links it as `libclang_rt.asan.so`. ```shell ln -s $(clang -print-file-name=libclang_rt.asan-x86_64.so) libclang_rt.asan.so ``` -------------------------------- ### C++ Naming Conventions: Variable and Function Examples Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/contribution/coding_guide.rst Illustrates the naming conventions for local variables and functions in C++. Variables should be camelCase starting with a lowercase letter, and functions follow the same pattern. Ambiguous abbreviations and removed letters are discouraged. ```cpp // Variable example: int numBlocks; // Function example: addTableEntry(); deleteTable(); // Not recommended examples: int n; int nerr; int nCompConns; int wgcConnections; int pcReader; int cstmrId; ``` -------------------------------- ### Set up oneAPI Base Toolkit Environment (Linux) Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Sets up environment variables for all oneAPI components (Compilers, oneMKL, oneTBB) using a single script, typically installed via the oneAPI Base Toolkit. ```bash source /opt/intel/oneapi/setvars.sh ``` -------------------------------- ### Set Up Environment Variables (Windows) Source: https://github.com/uxlfoundation/onedal/blob/main/docs/source/get-started/build-and-run-examples.rst Sets up the required environment variables for oneDAL on Windows by executing either 'vars.bat' or 'setvars.bat'. ```batch call /env/vars.bat ``` ```batch call setvars.bat ``` -------------------------------- ### Set up Intel DPC++ Compiler Environment (Windows) Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Initializes environment variables for the Intel DPC++/C++ Compiler on Windows. This is necessary for using Intel's compilers. ```batch call "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat" ``` -------------------------------- ### Install OpenBLAS Backend with Conda Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Installs the OpenBLAS library from conda-forge, which can be used as a reference computational backend for oneDAL. This option is used with `BACKEND_CONFIG=ref`. ```shell conda install -y -c conda-forge \ blas=*=*openblas* openblas ``` -------------------------------- ### Set up oneTBB Environment (Windows) Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Sets up environment variables for oneAPI Threading Building Blocks (oneTBB) on Windows. This step is optional if oneTBB is already configured via setvars.sh. ```batch call "C:\Program Files (x86)\Intel\oneAPI\tbb\latest\env\vars.bat" intel64 ``` -------------------------------- ### Install OpenMP ILP64 OpenBLAS Variant Source: https://github.com/uxlfoundation/onedal/blob/main/INSTALL.md Installs a specific variant of OpenBLAS that uses OpenMP for threading and supports the ILP64 interface. This is an optional configuration for the BLAS/LAPACK backend. ```shell conda install -y -c conda-forge \ blas=*=*openblas* openblas-ilp64=*=*openmp* ```