Get Started with Intel® oneAPI Collective Communications Library
Get Started with Intel® oneAPI Collective Communications Library
Intel® oneAPI Collective Communications Library (oneCCL) is a scalable and high-performance communication library for Deep Learning (DL) and Machine Learning (ML) workloads. The library builds upon the ideas introduced in the Intel(R) Machine Learning Scaling Library, enhancing the design and API to encompass new features and use cases.
oneCCL exposes a collective API for scaling ML and DL workloads in multi-GPU distributed environments:
Commonly used collective operations found in ML and DL workloads such as ALLREDUCE, BROADCAST, ALLGATHER
Interoperability with SYCL from the Khronos Group
Integrated with PyTorch
The runtime implementation of the oneCCL library enables several optimizations, including:
Asynchronous progress for compute communication overlap
Dedication of one or more cores to ensure optimal network use
Support for low-precision data types
The following are the required steps to get started with using the oneCCL library:
Install oneCCL
Set the Environment Variables
Install oneCCL
The oneCCL library is available as a stand-alone product and as part of the Intel® oneAPI Base Toolkit.
Prerequisites
See oneCCL System Requirements to learn about hardware and software requirements for oneCCL.
Download and install the library using one of the following options:
Set the Environment variables
After installing oneCCL, set the environment variables:
To load oneCCL package, run:
To load all installed oneAPI components, run:
You can also modify the oneCCL setup by using two flags when sourcing the vars.sh script:
ccl-configuration=[cpu_gpu_dpcpp/cpu] - Allows to choose between a SYCL-based version represented by cpu_gpu_dpcpp (default) and a CPU version, which does not require SYCL runtime libraries.
ccl-bundled-mpi=[yes|no] - Controls if Intel(R) MPI is used or not. Default value is yes.
To use Intel(R) MPI, run:
oneCCL uses a bundled IMPI implementation, possibly overriding a user-supplied setup.
To use an MPI implementation different from Intel(R) MPI, such as MPICH, run:
For more information about setvars.sh, see Use the setvars and oneapi-vars Scripts with Linux*.
After the environment variable setup is complete, you can build and execute an example.
Build and Run a Sample Application
The following example demonstrates how to use the oneCCL API to perform an ALLREDUCE communication operation on SYCL Unified Shared Memory (USM).
Prerequisites
oneCCL with SYCL support is installed and oneCCL environment is set up (see installation instructions)
Intel® MPI Library is installed and MPI environment is set up
Steps
Create an example.cpp file in your project.
Copy the following code in the file.
Use the icpx C++ compiler with the -fsycl option to build the sample:
Run the sample:
Where <parameters> represents optional mpiexec parameters, such as node count, processes per node, hosts, and so on.
A successful execution indicates that the operation has been completed. If you encounter an error, make sure the oneCCL environment is configured correctly.
Integrate oneCCL
If you want to improve the performance and scalability of your application, you can integrate oneCCL into your project. You can use the pkg-config tool to simplify the process of integrating oneCCL into your project and handling its dependencies.
Compile and Build Applications with pkg-config
The pkg-config tool is widely used to simplify building software with library dependencies. It provides command line options for compiling and linking applications to a library. Intel® oneAPI Collective Communications Library provides pkg-config metadata files for this tool starting with the oneCCL 2021.4 release.
The oneCCL pkg-config metadata files cover both configurations of oneCCL: with and without SYCL support.
Compile
To compile a test sample.cpp program with oneCCL, run:
--cflags provides the include path to the API directory:
The output:
--libs provides the oneCCL library name, all other dependencies (such as SYCL and MPI), and the search path to find it:
The output:
Additional Information
Notices and Disclaimers
Intel technologies may require enabled hardware, software or service activation.
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.
No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.
The products described may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.