Skip to content

Commit

Permalink
Intel(R) oneAPI Collective Communications Library (oneCCL) 2021.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy.sazanov authored and sazanovd committed Mar 31, 2021
1 parent 18a54aa commit 6012d5e
Show file tree
Hide file tree
Showing 497 changed files with 21,481 additions and 13,173 deletions.
148 changes: 66 additions & 82 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(PROJECT_FULL_NAME "oneAPI Collective Communications Library")

project(${PROJECT_NAME})

include(cmake/helpers.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/helpers.cmake)

check_compiler_version()

Expand All @@ -44,7 +44,10 @@ if (${CMAKE_BUILD_TYPE_CASE_INSENSITIVE} STREQUAL "debug")
set(USE_SECURITY_FLAGS FALSE)
endif()

option(BUILD_EXAMPLES "Build examples" TRUE)
option(BUILD_FT "Build functional tests" TRUE)
option(BUILD_UT "Build unit tests" TRUE)

option(USE_CODECOV_FLAGS "Calculate code coverage" FALSE)
option(WITH_ASAN "Use address sanitizer, can only be used in Debug build" FALSE)

Expand All @@ -56,11 +59,16 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif()

#show build info
message(STATUS "Build unit tests: ${BUILD_UT}")
message(STATUS "Installation directory: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE_CASE_INSENSITIVE}")
message(STATUS "C compiler : ${CMAKE_C_COMPILER}")
message(STATUS "CXX compiler : ${CMAKE_CXX_COMPILER}")
message(STATUS "Build examples: ${BUILD_EXAMPLES}")
message(STATUS "Build functional tests: ${BUILD_FT}")
message(STATUS "Build unit tests: ${BUILD_UT}")

add_definitions(-DCCL_C_COMPILER="${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
add_definitions(-DCCL_CXX_COMPILER="${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")

SET(MULTI_GPU_SUPPORT OFF CACHE BOOL "Enable Multi GPU extension support")

Expand All @@ -76,7 +84,10 @@ set(CCL_INSTALL_LICENSE "${CMAKE_INSTALL_PREFIX}/licensing")
set(CCL_INSTALL_MODULE "${CMAKE_INSTALL_PREFIX}/modulefiles")
set(CCL_INSTALL_EXAMPLES "${CMAKE_INSTALL_PREFIX}/examples")
set(CCL_INSTALL_TESTS "${CMAKE_INSTALL_PREFIX}/tests")
set(CCL_INSTALL_UNIT_TESTS "${CMAKE_INSTALL_PREFIX}/tests/unit")
set(CCL_INSTALL_KERNELS "${CMAKE_INSTALL_PREFIX}/lib/kernels")

set(CCL_UNIT_TESTS_BUILD "${CMAKE_BINARY_DIR}/tests/unit")

set(MPI_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/mpi/include/")
set(MPI_LIB_DIR "${PROJECT_SOURCE_DIR}/mpi/lib/")
Expand All @@ -92,7 +103,6 @@ include_directories(${LIBFABRIC_INCLUDE_DIR})
link_directories(${MPI_LIB_DIR})
link_directories(${LIBFABRIC_LIB_DIR})

set(CCL_INSTALL_UNIT_TESTS "${CMAKE_INSTALL_PREFIX}/tests/unit")

set(CMAKE_SKIP_INSTALL_RPATH TRUE)
set(CMAKE_SKIP_RPATH TRUE)
Expand All @@ -117,6 +127,8 @@ if(USE_SECURITY_FLAGS)
endif()
endif()

set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${PROJECT_SOURCE_DIR}/ccl.map")

if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
if (USE_CODECOV_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -prof-gen=srcpos -prof-src-root-cwd")
Expand All @@ -141,35 +153,28 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CXX_COMP
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(TRY_ENABLE_SYCL_L0 OFF)
set(TRY_ENABLE_SYCL_L0 ON)

if (COMPUTE_RUNTIME)
activate_compute_runtime("${CMAKE_CURRENT_LIST_DIR}/cmake" ${COMPUTE_RUNTIME})
if (NOT COMPUTE_RUNTIME_TARGET_NAME)
message(FATAL_ERROR "Failed to find requested compute runtime: ${COMPUTE_RUNTIME}")
if (COMPUTE_BACKEND)
activate_compute_backend("${CMAKE_CURRENT_LIST_DIR}/cmake" ${COMPUTE_BACKEND})
if (NOT COMPUTE_BACKEND_TARGET_NAME)
message(FATAL_ERROR "Failed to find requested compute runtime: ${COMPUTE_BACKEND}")
endif()
message(STATUS "COMPUTE_RUNTIME_TARGET_NAME: ${COMPUTE_RUNTIME_TARGET_NAME}")
if (${CCL_ENABLE_SYCL_V} STREQUAL 1)
option (CCL_ENABLE_SYCL "Enable CCL SYCL runtime" ON)
message(STATUS "Enable CCL SYCL runtime")
if (${COMPUTE_RUNTIME_TARGET_NAME} STREQUAL "Intel::SYCL")
set (CCL_ENABLE_SYCL_CHECK_CONTRACT "#if defined(__cplusplus)\n#if !defined(__clang__) || __clang_major__ < 9 || !defined(SYCL_LANGUAGE_VERSION)\n#error This version of CCL configured only for oneAPI DPC++ Compiler\n#endif\n#endif")
execute_process(COMMAND dpcpp -v
OUTPUT_VARIABLE DPCPP_VERSION
ERROR_VARIABLE DPCPP_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
message(STATUS "DPC++ compiler version:\n" "${DPCPP_VERSION}")
else(${COMPUTE_RUNTIME_TARGET_NAME} STREQUAL "Codeplay::ComputeCpp")
set (CCL_ENABLE_SYCL_CHECK_CONTRACT "#if defined(__cplusplus)\n#if !defined(__clang__) || __clang_major__ < 6\n#error This version of CCL configured only for oneAPI DPC++ Compiler\n#endif\n#endif")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPUTE_RUNTIME_FLAGS}")
if ((${COMPUTE_RUNTIME_TARGET_NAME} STREQUAL "Intel::SYCL") AND
${CCL_ENABLE_SYCL_L0} STREQUAL 1)
set(MULTI_GPU_SUPPORT ON)
elseif(${COMPUTE_RUNTIME_TARGET_NAME} STREQUAL "ze_loader")
message(STATUS "COMPUTE_BACKEND_TARGET_NAME: ${COMPUTE_BACKEND_TARGET_NAME}")

if (${COMPUTE_BACKEND_TARGET_NAME} STREQUAL "Intel::SYCL" OR ${COMPUTE_BACKEND_TARGET_NAME} STREQUAL "Intel::SYCL_level_zero")
option (CCL_ENABLE_SYCL "Enable CCL SYCL runtime" ON)
message(STATUS "Enable CCL SYCL runtime")
execute_process(COMMAND dpcpp -v
OUTPUT_VARIABLE DPCPP_VERSION
ERROR_VARIABLE DPCPP_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
message(STATUS "DPC++ compiler version:\n" "${DPCPP_VERSION}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPUTE_BACKEND_FLAGS}")
if (${COMPUTE_BACKEND_TARGET_NAME} STREQUAL "Intel::SYCL_level_zero" OR ${COMPUTE_BACKEND_TARGET_NAME} STREQUAL "ze_loader")
set(MULTI_GPU_SUPPORT ON)
endif()
if (MULTI_GPU_SUPPORT)
Expand All @@ -191,50 +196,7 @@ if(WITH_ASAN AND ${CMAKE_BUILD_TYPE_CASE_INSENSITIVE} STREQUAL "debug")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lasan")
endif()

set(GCC_BF16_MIN_SUPPORTED "4.9.0")
set(GCC_BF16_AVX512BF_MIN_SUPPORTED "10.0.0")
set(ICC_BF16_AVX512BF_MIN_SUPPORTED "19.1.0")
set(CLANG_BF16_MIN_SUPPORTED "9.0.0")
set(CLANG_BF16_AVX512BF_MIN_SUPPORTED "10.0.0")

if (${CMAKE_C_COMPILER_ID} STREQUAL "Intel"
OR (${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS ${CLANG_BF16_MIN_SUPPORTED})
OR (${CMAKE_C_COMPILER_ID} STREQUAL "GNU"
AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS ${GCC_BF16_MIN_SUPPORTED})
)
add_definitions(-DCCL_BF16_COMPILER)
set(CCL_BF16_COMPILER ON)
message(STATUS "BF16 compiler: yes")
else()
set(CCL_BF16_COMPILER OFF)
message(STATUS "BF16 compiler: no")
endif()

if ((${CMAKE_C_COMPILER_ID} STREQUAL "Intel"
AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS ${ICC_BF16_AVX512BF_MIN_SUPPORTED})
OR (${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS ${CLANG_BF16_AVX512BF_MIN_SUPPORTED})
OR (${CMAKE_C_COMPILER_ID} STREQUAL "GNU"
AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS ${GCC_BF16_AVX512BF_MIN_SUPPORTED})
)
add_definitions(-DCCL_BF16_AVX512BF_COMPILER)
message(STATUS "BF16 AVX512BF compiler: yes")
else()
message(STATUS "BF16 AVX512BF compiler: no")
endif()

if (CCL_BF16_COMPILER)
if ((${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_C_COMPILER_ID} STREQUAL "GNU"))
add_definitions(-DCCL_BF16_TARGET_ATTRIBUTES)
message(STATUS "BF16 target attributes: yes")
else()
message(STATUS "BF16 target attributes: no")
endif()
endif()

add_definitions(-DCCL_GPU_BF16_TRUNCATE)
set(CCL_GPU_BF16_TRUNCATE ON)
set_lp_env()

set(CCL_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/src)

Expand All @@ -259,8 +221,14 @@ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/ccl DESTINATION ${CCL_INSTALL_MODUL
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/third-party-programs.txt DESTINATION ${CCL_INSTALL_LICENSE})
install(PROGRAMS ${PROJECT_SOURCE_DIR}/LICENSE DESTINATION ${CCL_INSTALL_LICENSE})

# copy kernels
if(COMPUTE_BACKEND AND EXISTS "${PROJECT_SOURCE_DIR}/src/kernels")
file(GLOB spv_kernels "${PROJECT_SOURCE_DIR}/src/kernels/ring_*.spv")
install(PROGRAMS ${spv_kernels} DESTINATION ${CCL_INSTALL_KERNELS})
endif()

set(CCL_MAJOR_VERSION "2021")
set(CCL_MINOR_VERSION "1")
set(CCL_MINOR_VERSION "2")
set(CCL_UPDATE_VERSION "0")
set(CCL_PRODUCT_STATUS "Gold")
string(TIMESTAMP CCL_PRODUCT_BUILD_DATE "%Y-%m-%dT %H:%M:%SZ")
Expand All @@ -270,19 +238,35 @@ configure_file(${PROJECT_SOURCE_DIR}/include/oneapi/ccl/config.h.in "${CMAKE_CUR
file(COPY "${CMAKE_CURRENT_BINARY_DIR}/include/oneapi/ccl/config.h" DESTINATION ${PROJECT_SOURCE_DIR}/include/oneapi/ccl)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)

#generate oneCCLConfig*.cmake
configure_file("cmake/templates/oneCCLConfig.cmake.in"
"${CCL_INSTALL_LIB}/cmake/oneCCL/oneCCLConfig.cmake"
COPYONLY)

set(PROJECT_VERSION "${CCL_MAJOR_VERSION}.${CCL_MINOR_VERSION}.${CCL_UPDATE_VERSION}")

configure_file("cmake/templates/oneCCLConfigVersion.cmake.in"
"${CCL_INSTALL_LIB}/cmake/oneCCL/oneCCLConfigVersion.cmake"
@ONLY)

#include other CMakeLists

add_subdirectory(src)
add_subdirectory(examples/benchmark)
add_subdirectory(examples/common)
add_subdirectory(examples/cpu)
if (CCL_ENABLE_SYCL)
add_subdirectory(examples/sycl)

if (BUILD_EXAMPLES)
add_subdirectory(examples/benchmark)
add_subdirectory(examples/common)
add_subdirectory(examples/cpu)
add_subdirectory(examples/external_launcher)
if (CCL_ENABLE_SYCL)
add_subdirectory(examples/sycl)
endif()
endif()

add_subdirectory(tests/functional)
if (BUILD_FT)
add_subdirectory(tests/functional)
endif()

if (BUILD_UT)
#add_subdirectory(tests/unit)
#add_subdirectory(tests/unit)
endif()
107 changes: 87 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,111 @@
# Contributing guidelines

If you have improvements to the oneCCL code, please send us your pull
requests! To get started with pull requests, see GitHub
[howto](https://help.github.com/en/articles/about-pull-requests).
We welcome community contributions to oneCCL. You can:

The current guidelines are work in progress.
- Submit your changes directly with a [pull request](https://github.com/oneapi-src/oneCCL/pulls).
- Log a bug or feedback with an [issue](https://github.com/oneapi-src/oneCCL/issues).

## Pull request checklist
Refer to our guidelines on [pull requests](#pull-requests) and [isssues](#issues) before you proceed.

TBD
## Issues

Use [GitHub issues]((https://github.com/oneapi-src/oneCCL/issues)) to:
- report an issue
- provide feedback
- make a feature request

**Note**: To report a vulnerability, refer to [Intel vulnerability reporting policy](https://www.intel.com/content/www/us/en/security-center/default.html).

## Pull requests

Before you submit a pull request, make sure that:

- You follow our [code contribution guidelines](#code-contribution-guidelines) and our [coding style](#coding-style).
- You provided the [requested details](#rfc-pull-requests) for new primitives or extended the existing [unit tests](#unit-tests) when fixing an issue.
- You [signed-off](#sign-your-work) your work.

**Note**: This project follows the
[GitHub flow](https://guides.github.com/introduction/flow/index.html). To get started with pull requests, see [GitHub howto](https://help.github.com/en/articles/about-pull-requests).

### RFC pull requests

It is strongly advised to open an RFC (request for comments) pull request when contributing new
primitives. Please provide the following details:

* The definition of the operation as an oneCCL primitive. It should also include interface and semantics. It is OK to have sketches for the interface, but the semantics should be fairly well-defined.
* The definition of the operation as a oneCCL primitive. It should include an interface and semantics. We welcome sketches for the interface, but the semantics should be fairly well-defined.

* Use case, including the model and parallelism scenario.
* A use case, including a model and parallelism scenario.

## Code contribution guidelines
### Code contribution guidelines

The code must be:

* *Tested*: oneCCL uses gtests for lightweight functional testing.
* *Tested*: oneCCL uses `gtests` for lightweight functional testing.

* *Documented*: oneCCL uses Doxygen for inline comments in public header
files that are used to build reference manual and markdown (also processed by
Doxygen) for user guide.
* *Documented*: oneCCL uses `Doxygen` for inline comments in public header
files that are used to build the API reference and `reStructuredText` for the Developer Guide. See [oneCCL documentation](https://oneapi-src.github.io/oneCCL/) for reference.

* *Portable*: oneCCL supports CPU and GPU
architectures, as well as different compilers and run-times. The new code should be complaint
with the [System Requirements](README.md#system-requirements).
architectures as well as different compilers and run-times. The new code should be complaint
with the [System Requirements](README.md#prerequisites).

## Coding style
### Coding style

The general principle is to follow the style of existing / surrounding code.
The general principle is to follow the style of existing or surrounding code.

TBD

## Unit tests
### Unit tests

Be sure to extend the existing tests when fixing an issue.

### Sign your work

Use the sign-off line at the end of the patch. Your signature certifies
that you wrote the patch or otherwise have the right to pass it on as an
open-source patch. If you can certify
the below (from [developercertificate.org](http://developercertificate.org/)):

```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
Then you add a line to every git commit message:

Signed-off-by: Kris Smith <[email protected]>

**Note**: Use your real name.

If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.
Loading

0 comments on commit 6012d5e

Please sign in to comment.