Skip to content

Commit

Permalink
Intel(R) oneAPI Collective Communications Library (oneCCL) 2021.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ksenyako committed Mar 26, 2024
1 parent 4b2c810 commit 1ca9012
Show file tree
Hide file tree
Showing 240 changed files with 27,909 additions and 7,229 deletions.
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ set(CCL_INSTALL_KERNELS "${CMAKE_INSTALL_PREFIX}/lib/ccl/kernels")
# setup dependency directories
set(DEPS_DIR "${PROJECT_SOURCE_DIR}/deps")

set(MPI_INCLUDE_DIR "${DEPS_DIR}/mpi/include/")
set(MPI_LIB_DIR "${DEPS_DIR}/mpi/lib/")
if ("${MPI_DIR}" STREQUAL "")
set(MPI_INCLUDE_DIR "${DEPS_DIR}/mpi/include/")
set(MPI_LIB_DIR "${DEPS_DIR}/mpi/lib/")
else()
set(MPI_INCLUDE_DIR "${MPI_DIR}/include/")
set(MPI_LIB_DIR "${MPI_DIR}/lib/")
endif()
message(STATUS "MPI_INCLUDE_DIR: ${MPI_INCLUDE_DIR}")
message(STATUS "MPI_LIB_DIR: ${MPI_LIB_DIR}")

Expand Down Expand Up @@ -302,8 +307,8 @@ file(GLOB spv_kernels "${PROJECT_SOURCE_DIR}/src/kernels/kernels.spv")
endif()

set(CCL_MAJOR_VERSION "2021")
set(CCL_MINOR_VERSION "11")
set(CCL_UPDATE_VERSION "2")
set(CCL_MINOR_VERSION "12")
set(CCL_UPDATE_VERSION "0")
set(CCL_PRODUCT_STATUS "Gold")
string(TIMESTAMP CCL_PRODUCT_BUILD_DATE "%Y-%m-%dT %H:%M:%SZ")
get_vcs_properties("git")
Expand Down Expand Up @@ -335,13 +340,12 @@ if (ENABLE_MPI_TESTS)
add_subdirectory(examples/benchmark)
add_subdirectory(examples/common)
add_subdirectory(examples/cpu)
if (BUILD_CONFIG)
add_subdirectory(examples/pt2pt)
if (BUILD_CONFIG)
add_subdirectory(examples/external_launcher)
endif()
if (CCL_ENABLE_SYCL)
add_subdirectory(examples/sycl)
#TODO: add cpu support
add_subdirectory(examples/pt2pt)
endif()
endif()
if (BUILD_FT)
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ oneCCL is part of [oneAPI](https://oneapi.io).
- [Installation](#installation)
- [Usage](#usage)
- [Launching Example Application](#launching-example-application)
- [Using external MPI](#using-external-mpi)
- [Setting workers affinity](#setting-workers-affinity)
- [Automatic setup](#automatic-setup)
- [Explicit setup](#explicit-setup)
Expand Down Expand Up @@ -73,6 +74,19 @@ Use the command:
$ source <install_dir>/env/setvars.sh
$ mpirun -n 2 <install_dir>/examples/benchmark/benchmark
```

#### Using external mpi

The ccl-bundled-mpi flag in vars.sh can take values "yes" or "no" to control if bundled Intel MPI should be used or not. Current default is "yes", which means that oneCCL temporarily overrides the mpi implementation in use.

In order to suppress the behavior and use user-supplied or system-default mpi use the following command *instead* of sourcing `setvars.sh`:

```bash
$ source <install_dir>/env/vars.sh --ccl-bundled-mpi=no
```

The mpi implementation will not be overridden. Please note that, in this case, user needs to assure the system finds all required mpi-related binaries.

### Setting workers affinity

There are two ways to set worker threads (workers) affinity: [automatically](#setting-affinity-automatically) and [explicitly](#setting-affinity-explicitly).
Expand Down
14 changes: 11 additions & 3 deletions cmake/setvars.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ fi

WORK_DIR=$(get_script_path "${vars_script_name:-}")
CCL_ROOT="$(cd "${WORK_DIR}"/../; pwd -P)"; export CCL_ROOT
export I_MPI_ROOT="${CCL_ROOT}"
export I_MPI_ROOT="${CCL_ROOT}/opt/mpi"
export SETVARS_CALL=1

source ${CCL_ROOT}/env/vars.sh ${1:-}

Expand All @@ -104,5 +105,12 @@ then
else
PATH="${CCL_ROOT}/bin:${PATH}"; export PATH
fi
LD_LIBRARY_PATH=$(prepend_path "${I_MPI_ROOT}/opt/mpi/libfabric/lib" "${LD_LIBRARY_PATH:-}") ; export LD_LIBRARY_PATH
FI_PROVIDER_PATH="${I_MPI_ROOT}/opt/mpi/libfabric/lib/prov:/usr/lib64/libfabric"; export FI_PROVIDER_PATH
LD_LIBRARY_PATH=$(prepend_path "${I_MPI_ROOT}/libfabric/lib" "${LD_LIBRARY_PATH:-}") ; export LD_LIBRARY_PATH
FI_PROVIDER_PATH="${I_MPI_ROOT}/libfabric/lib/prov:/usr/lib64/libfabric"; export FI_PROVIDER_PATH

CPATH=$(prepend_path "${I_MPI_ROOT}/include" "${CPATH:-}"); export CPATH
LD_LIBRARY_PATH=$(prepend_path "${I_MPI_ROOT}/lib" "${LD_LIBRARY_PATH:-}") ; export LD_LIBRARY_PATH
LIBRARY_PATH=$(prepend_path "${I_MPI_ROOT}/lib" "${LIBRARY_PATH:-}"); export LIBRARY_PATH
PATH="${I_MPI_ROOT}/bin:${PATH}"; export PATH

unset -v SETVARS_CALL
35 changes: 35 additions & 0 deletions cmake/vars.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#
# shellcheck shell=sh

DEFAULT_BUNDLED_MPI="yes"

get_script_path() (
script="$1"
while [ -L "$script" ] ; do
Expand Down Expand Up @@ -112,3 +114,36 @@ CPATH=$(prepend_path "${CCL_ROOT}/include" "${CPATH:-}"); export CPATH
CMAKE_PREFIX_PATH=$(prepend_path "${CCL_ROOT}/lib/cmake/oneCCL" "${CMAKE_PREFIX_PATH:-}"); export CMAKE_PREFIX_PATH
LIBRARY_PATH=$(prepend_path "${CCL_ROOT}/lib" "${LIBRARY_PATH:-}"); export LIBRARY_PATH
LD_LIBRARY_PATH=$(prepend_path "${CCL_ROOT}/lib" "${LD_LIBRARY_PATH:-}"); export LD_LIBRARY_PATH

args=$*
for arg in $args
do
case "$arg" in
--ccl-bundled-mpi=*)
ccl_bundled_mpi="${arg#*=}"
;;
esac
done

if [ -z "${SETVARS_CALL:-}" ] ; then
if [ -z "${ccl_bundled_mpi:-}" ]; then
ccl_bundled_mpi="${DEFAULT_BUNDLED_MPI}"
elif [ "$ccl_bundled_mpi" != "yes" ] && [ "$ccl_bundled_mpi" != "no" ]; then
echo ":: WARNING: ccl_bundled_mpi=${ccl_bundled_mpi} is unrecognized."
echo ":: ccl_bundled_mpi will be set to ${DEFAULT_BUNDLED_MPI}"
ccl_bundled_mpi="${DEFAULT_BUNDLED_MPI}"
fi

if [ "$ccl_bundled_mpi" = "yes" ] ; then
export I_MPI_ROOT="${CCL_ROOT}/opt/mpi"
CPATH=$(prepend_path "${I_MPI_ROOT}/include" "${CPATH:-}"); export CPATH
LD_LIBRARY_PATH=$(prepend_path "${I_MPI_ROOT}/lib" "${LD_LIBRARY_PATH:-}") ; export LD_LIBRARY_PATH
LIBRARY_PATH=$(prepend_path "${I_MPI_ROOT}/lib" "${LIBRARY_PATH:-}"); export LIBRARY_PATH
PATH="${I_MPI_ROOT}/bin:${PATH}"; export PATH
fi
else
if [ ! -z "${ccl_bundled_mpi:-}" ]; then
echo ":: WARNING: ccl_bundled_mpi was specified for setvars.sh script"
echo ":: ccl_bundled_mpi is only supported by direct call vars.sh, ignoring"
fi
fi
114 changes: 91 additions & 23 deletions deps/hwloc/include/hwloc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2023 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2020 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
Expand Down Expand Up @@ -263,6 +263,11 @@ typedef enum {
* This is the smallest object representing Memory resources,
* it cannot have any child except Misc objects.
* However it may have Memory-side cache parents.
*
* NUMA nodes may correspond to different kinds of memory
* (DRAM, HBM, CXL-DRAM, etc.). When hwloc is able to guess
* that kind, it is specified in the subtype field of the object.
* See also \ref attributes_normal in the main documentation.
*
* There is always at least one such object in the topology
* even if the machine is not NUMA.
Expand Down Expand Up @@ -338,6 +343,12 @@ typedef enum {

HWLOC_OBJ_DIE, /**< \brief Die within a physical package.
* A subpart of the physical package, that contains multiple cores.
*
* Some operating systems (e.g. Linux) may expose a single die per package
* even if the hardware does not support dies at all. To avoid showing
* such non-existing dies, the corresponding hwloc backend may filter them out.
* This is functionally equivalent to ::HWLOC_TYPE_FILTER_KEEP_STRUCTURE
* being enforced.
*/

HWLOC_OBJ_TYPE_MAX /**< \private Sentinel value */
Expand Down Expand Up @@ -656,33 +667,48 @@ union hwloc_obj_attr_u {
/** \brief PCI Device specific Object Attributes */
struct hwloc_pcidev_attr_s {
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
unsigned short domain; /* Only 16bits PCI domains are supported by default */
unsigned short domain; /**< \brief Domain number (xxxx in the PCI BDF notation xxxx:yy:zz.t).
* Only 16bits PCI domains are supported by default. */
#else
unsigned int domain; /* 32bits PCI domain support break the library ABI, hence it's disabled by default */
unsigned int domain; /**< \brief Domain number (xxxx in the PCI BDF notation xxxx:yy:zz.t).
* 32bits PCI domain support break the library ABI, hence it's disabled by default. */
#endif
unsigned char bus, dev, func;
unsigned short class_id;
unsigned short vendor_id, device_id, subvendor_id, subdevice_id;
unsigned char revision;
float linkspeed; /* in GB/s */
unsigned char bus; /**< \brief Bus number (yy in the PCI BDF notation xxxx:yy:zz.t). */
unsigned char dev; /**< \brief Device number (zz in the PCI BDF notation xxxx:yy:zz.t). */
unsigned char func; /**< \brief Function number (t in the PCI BDF notation xxxx:yy:zz.t). */
unsigned short class_id; /**< \brief The class number (first two bytes, without the prog_if). */
unsigned short vendor_id; /**< \brief Vendor ID (xxxx in [xxxx:yyyy]). */
unsigned short device_id; /**< \brief Device ID (yyyy in [xxxx:yyyy]). */
unsigned short subvendor_id; /**< \brief Sub-Vendor ID. */
unsigned short subdevice_id; /**< \brief Sub-Device ID. */
unsigned char revision; /**< \brief Revision number. */
float linkspeed; /**< \brief Link speed in GB/s.
* This datarate is the currently configured speed of the entire PCI link
* (sum of the bandwidth of all PCI lanes in that link).
* It may change during execution since some devices are able to
* slow their PCI links down when idle.
*/
} pcidev;
/** \brief Bridge specific Object Attributes */
struct hwloc_bridge_attr_s {
union {
struct hwloc_pcidev_attr_s pci;
struct hwloc_pcidev_attr_s pci; /**< \brief PCI attribute of the upstream part as a PCI device. */
} upstream;
hwloc_obj_bridge_type_t upstream_type;
hwloc_obj_bridge_type_t upstream_type; /**< \brief Upstream Bridge type. */
union {
struct {
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
unsigned short domain; /* Only 16bits PCI domains are supported by default */
unsigned short domain; /**< \brief Domain number the downstream PCI buses.
* Only 16bits PCI domains are supported by default. */
#else
unsigned int domain; /* 32bits PCI domain support break the library ABI, hence it's disabled by default */
unsigned int domain; /**< \brief Domain number the downstream PCI buses.
* 32bits PCI domain support break the library ABI, hence it's disabled by default */
#endif
unsigned char secondary_bus, subordinate_bus;
unsigned char secondary_bus; /**< \brief First PCI bus number below the bridge. */
unsigned char subordinate_bus; /**< \brief Highest PCI bus number below the bridge. */
} pci;
} downstream;
hwloc_obj_bridge_type_t downstream_type;
hwloc_obj_bridge_type_t downstream_type; /**< \brief Downstream Bridge type. */
unsigned depth;
} bridge;
/** \brief OS Device specific Object Attributes */
Expand Down Expand Up @@ -1872,6 +1898,10 @@ HWLOC_DECLSPEC int hwloc_free(hwloc_topology_t topology, void *addr, size_t len)
* \note -1 is returned and errno is set to \c ENOSYS on platforms that do not
* support this feature.
*
* \note The PID will not actually be used until hwloc_topology_load().
* If the corresponding process exits in the meantime, hwloc will ignore the PID.
* If another process reuses the PID, the view of that process will be used.
*
* \return 0 on success, -1 on error.
*/
HWLOC_DECLSPEC int hwloc_topology_set_pid(hwloc_topology_t __hwloc_restrict topology, hwloc_pid_t pid);
Expand Down Expand Up @@ -1935,15 +1965,20 @@ HWLOC_DECLSPEC int hwloc_topology_set_synthetic(hwloc_topology_t __hwloc_restric
* \note On success, the XML component replaces the previously enabled
* component (if any), but the topology is not actually modified until
* hwloc_topology_load().
*
* \note If an invalid XML input file is given, the error may be reported
* either here or later by hwloc_topology_load() depending on the XML library
* used by hwloc.
*/
HWLOC_DECLSPEC int hwloc_topology_set_xml(hwloc_topology_t __hwloc_restrict topology, const char * __hwloc_restrict xmlpath);

/** \brief Enable XML based topology using a memory buffer (instead of
* a file, as with hwloc_topology_set_xml()).
*
* Gather topology information from the XML memory buffer given at \p
* buffer and of length \p size. This buffer may have been filled
* earlier with hwloc_topology_export_xmlbuffer() in hwloc/export.h.
* Gather topology information from the XML memory buffer given at
* \p buffer and of length \p size (including an ending \0).
* This buffer may have been filled earlier with
* hwloc_topology_export_xmlbuffer() in hwloc/export.h.
*
* Note that this function does not actually load topology
* information; it just tells hwloc where to load it from. You'll
Expand All @@ -1964,6 +1999,10 @@ HWLOC_DECLSPEC int hwloc_topology_set_xml(hwloc_topology_t __hwloc_restrict topo
* \note On success, the XML component replaces the previously enabled
* component (if any), but the topology is not actually modified until
* hwloc_topology_load().
*
* \note If an invalid XML input file is given, the error may be reported
* either here or later by hwloc_topology_load() depending on the XML library
* used by hwloc.
*/
HWLOC_DECLSPEC int hwloc_topology_set_xmlbuffer(hwloc_topology_t __hwloc_restrict topology, const char * __hwloc_restrict buffer, int size);

Expand Down Expand Up @@ -2171,9 +2210,10 @@ enum hwloc_topology_flags_e {
*/
HWLOC_TOPOLOGY_FLAG_NO_DISTANCES = (1UL<<7),

/** \brief Ignore memory attributes.
/** \brief Ignore memory attributes and tiers.
*
* Ignore memory attribues from the operating systems (and from XML).
* Ignore memory attribues from the operating systems (and from XML)
* Hence also do not try to build memory tiers.
*/
HWLOC_TOPOLOGY_FLAG_NO_MEMATTRS = (1UL<<8),

Expand Down Expand Up @@ -2362,8 +2402,8 @@ HWLOC_DECLSPEC const struct hwloc_topology_support *hwloc_topology_get_support(h
/** \brief Type filtering flags.
*
* By default, most objects are kept (::HWLOC_TYPE_FILTER_KEEP_ALL).
* Instruction caches, I/O and Misc objects are ignored by default (::HWLOC_TYPE_FILTER_KEEP_NONE).
* Die and Group levels are ignored unless they bring structure (::HWLOC_TYPE_FILTER_KEEP_STRUCTURE).
* Instruction caches, memory-side caches, I/O and Misc objects are ignored by default (::HWLOC_TYPE_FILTER_KEEP_NONE).
* Group levels are ignored unless they bring structure (::HWLOC_TYPE_FILTER_KEEP_STRUCTURE).
*
* Note that group objects are also ignored individually (without the entire level)
* when they do not bring structure.
Expand Down Expand Up @@ -2627,13 +2667,33 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_insert_misc_object(hwloc_topology_t to
* This function returns a new Group object.
*
* The caller should (at least) initialize its sets before inserting
* the object in the topology. See hwloc_topology_insert_group_object().
* the object in the topology, see hwloc_topology_insert_group_object().
* Or it may decide not to insert and just free the group object
* by calling hwloc_topology_free_group_object().
*
* \return The allocated object on success.
* \return \c NULL on error.
*/
*
* \note If successfully inserted by hwloc_topology_insert_group_object(),
* the object will be freed when the entire topology is freed.
* If insertion failed (e.g. \c NULL or empty CPU and node-sets),
* it is freed before returning the error.
*/
HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_alloc_group_object(hwloc_topology_t topology);

/** \brief Free a group object allocated with hwloc_topology_alloc_group_object().
*
* This function is only useful if the group object was not given
* to hwloc_topology_insert_group_object() as planned.
*
* \note \p topology must be the same as the one previously passed
* to hwloc_topology_alloc_group_object().
*
* \return \c 0 on success.
* \return \c -1 on error, for instance if an invalid topology is given.
*/
HWLOC_DECLSPEC int hwloc_topology_free_group_object(hwloc_topology_t topology, hwloc_obj_t group);

/** \brief Add more structure to the topology by adding an intermediate Group
*
* The caller should first allocate a new Group object with hwloc_topology_alloc_group_object().
Expand Down Expand Up @@ -2671,6 +2731,14 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_alloc_group_object(hwloc_topology_t to
* hence the existing objects may get reordered (including PUs and NUMA nodes),
* and their logical indexes may change.
*
* \note If the insertion fails, the input group object is freed.
*
* \note If the group object should be discarded instead of inserted,
* it may be passed to hwloc_topology_free_group_object() instead.
*
* \note \p topology must be the same as the one previously passed
* to hwloc_topology_alloc_group_object().
*
* \return The inserted object if it was properly inserted.
*
* \return An existing object if the Group was merged or discarded
Expand Down
8 changes: 4 additions & 4 deletions deps/hwloc/include/hwloc/autogen/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#ifndef HWLOC_CONFIG_H
#define HWLOC_CONFIG_H

#define HWLOC_VERSION "2.9.3rc2-git"
#define HWLOC_VERSION "2.10.0rc3-git"
#define HWLOC_VERSION_MAJOR 2
#define HWLOC_VERSION_MINOR 9
#define HWLOC_VERSION_RELEASE 3
#define HWLOC_VERSION_GREEK "rc2"
#define HWLOC_VERSION_MINOR 10
#define HWLOC_VERSION_RELEASE 0
#define HWLOC_VERSION_GREEK "rc3"

/* #undef HWLOC_PCI_COMPONENT_BUILTIN */
/* #undef HWLOC_OPENCL_COMPONENT_BUILTIN */
Expand Down
5 changes: 5 additions & 0 deletions deps/hwloc/include/hwloc/diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ HWLOC_DECLSPEC int hwloc_topology_diff_load_xml(const char *xmlpath, hwloc_topol
HWLOC_DECLSPEC int hwloc_topology_diff_export_xml(hwloc_topology_diff_t diff, const char *refname, const char *xmlpath);

/** \brief Load a list of topology differences from a XML buffer.
*
* Build a list of differences from the XML memory buffer given
* at \p xmlbuffer and of length \p buflen (including an ending \0).
* This buffer may have been filled earlier with
* hwloc_topology_diff_export_xmlbuffer().
*
* If not \c NULL, \p refname will be filled with the identifier
* string of the reference topology for the difference file,
Expand Down
Loading

0 comments on commit 1ca9012

Please sign in to comment.