Skip to content

Commit

Permalink
Intel(R) oneAPI Collective Communications Library (oneCCL) 2021.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sazanovd committed Dec 8, 2020
1 parent 7490aa7 commit d313361
Show file tree
Hide file tree
Showing 562 changed files with 20,688 additions and 20,902 deletions.
145 changes: 145 additions & 0 deletions .clang-format
@@ -0,0 +1,145 @@
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: false
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: true
DisableFormat: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 1
UseTab: Never
...
79 changes: 41 additions & 38 deletions CMakeLists.txt
Expand Up @@ -34,9 +34,6 @@ check_compiler_version()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if (NOT CMAKE_DISABLE_SYCL)
set(CMAKE_DISABLE_SYCL 0)
endif()

#make build variable case insensitive
string( TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_CASE_INSENSITIVE)
Expand All @@ -47,6 +44,7 @@ if (${CMAKE_BUILD_TYPE_CASE_INSENSITIVE} STREQUAL "debug")
set(USE_SECURITY_FLAGS FALSE)
endif()

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 @@ -58,6 +56,7 @@ 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}")
Expand Down Expand Up @@ -93,8 +92,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)
Expand Down Expand Up @@ -144,14 +141,40 @@ 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)

if (COMPUTE_RUNTIME)
activate_compute_runtime("${CMAKE_CURRENT_LIST_DIR}/cmake" ${COMPUTE_RUNTIME})
set(PARENT_COMPUTE_RUNTIME_TARGET_NAME ${COMPUTE_RUNTIME_TARGET_NAME})
if (NOT COMPUTE_RUNTIME_TARGET_NAME)
message(FATAL_ERROR "Failed to find requested compute runtime: ${COMPUTE_RUNTIME}")
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")
set(MULTI_GPU_SUPPORT ON)
endif()
if (MULTI_GPU_SUPPORT)
message(STATUS "Enable multi GPU support using L0")
endif()
endif()

if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
Expand Down Expand Up @@ -210,6 +233,9 @@ if (CCL_BF16_COMPILER)
endif()
endif()

add_definitions(-DCCL_GPU_BF16_TRUNCATE)
set(CCL_GPU_BF16_TRUNCATE ON)

set(CCL_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/src)

enable_testing()
Expand All @@ -222,32 +248,6 @@ set(CMAKE_CLANG_FLAGS "${CMAKE_CLANG_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

if (COMPUTE_RUNTIME)
if ((${COMPUTE_RUNTIME_TARGET_NAME} STREQUAL "ze_loader")
OR (${COMPUTE_RUNTIME_TARGET_NAME} STREQUAL "Intel::SYCL"))
set(MULTI_GPU_SUPPORT ON)
activate_compute_runtime("${CMAKE_CURRENT_LIST_DIR}/cmake" L0)
message ("Enable multi GPU support: ${MULTI_GPU_SUPPORT}")
message ("COMPUTE_RUNTIME_TARGET_NAME: ${COMPUTE_RUNTIME_TARGET_NAME}")
endif()
endif(COMPUTE_RUNTIME)

if (MULTI_GPU_SUPPORT)
option(CCL_GPU_DEVICES_AFFINITY_ENABLE "Enable L0" ON)
if(CCL_GPU_DEVICES_AFFINITY_ENABLE)
set(CCL_GPU_DEVICES_AFFINITY_MASK_SIZE 4)
message ("Set L0 device mask affinity size: ${CCL_GPU_DEVICES_AFFINITY_MASK_SIZE}")
endif()
endif(MULTI_GPU_SUPPORT)

if (CCL_ENABLE_SYCL)
if (${PARENT_COMPUTE_RUNTIME_TARGET_NAME} STREQUAL "Intel::SYCL")
set (CCL_ENABLE_SYCL_CHECK_CONTRACT "#if defined(__cplusplus)\n#if !defined(__clang__) || __clang_major__ < 9 || !defined(CL_SYCL_LANGUAGE_VERSION)\n#error This version of CCL configured only for oneAPI DPC++ Compiler\n#endif\n#endif")
else(${PARENT_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()

#generate & install vars.sh
configure_file(cmake/vars.sh.in ${CMAKE_CURRENT_BINARY_DIR}/vars.sh @ONLY)
configure_file(cmake/setvars.sh.in ${CMAKE_CURRENT_BINARY_DIR}/setvars.sh @ONLY)
Expand All @@ -259,15 +259,15 @@ 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})

set(CCL_MAJOR_VERSION "0")
set(CCL_MINOR_VERSION "10")
set(CCL_MAJOR_VERSION "2021")
set(CCL_MINOR_VERSION "1")
set(CCL_UPDATE_VERSION "0")
set(CCL_PRODUCT_STATUS "beta")
set(CCL_PRODUCT_STATUS "Gold")
string(TIMESTAMP CCL_PRODUCT_BUILD_DATE "%Y-%m-%dT %H:%M:%SZ")
get_vcs_properties("git")
set(CCL_PRODUCT_FULL "${CCL_PRODUCT_STATUS}-${CCL_MAJOR_VERSION}.${CCL_MINOR_VERSION}.${CCL_UPDATE_VERSION} ${CCL_PRODUCT_BUILD_DATE} ${VCS_INFO}")
configure_file(${PROJECT_SOURCE_DIR}/include/oneapi/ccl/ccl_config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/oneapi/ccl/ccl_config.h")
file(COPY "${CMAKE_CURRENT_BINARY_DIR}/include/oneapi/ccl/ccl_config.h" DESTINATION ${PROJECT_SOURCE_DIR}/include/oneapi/ccl)
configure_file(${PROJECT_SOURCE_DIR}/include/oneapi/ccl/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/oneapi/ccl/config.h")
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)


Expand All @@ -282,4 +282,7 @@ if (CCL_ENABLE_SYCL)
endif()

add_subdirectory(tests/functional)
#add_subdirectory(tests/unit)

if (BUILD_UT)
#add_subdirectory(tests/unit)
endif()
5 changes: 2 additions & 3 deletions cmake/FindIntelSYCL.cmake
Expand Up @@ -26,14 +26,13 @@ endif()

set(OPENCLROOT "${dpcpp_root_hints}/include/sycl/CL/")

if(MULTI_GPU_SUPPORT)
find_package(L0 REQUIRED)
if(TRY_ENABLE_SYCL_L0)
find_package(L0)
if(LevelZero_FOUND)
set(COMPUTE_RUNTIME_NAME ze_loader)
endif()
endif()


if (NOT COMPUTE_RUNTIME_NAME)
message("Not OpenCL or L0")
endif()
Expand Down
26 changes: 16 additions & 10 deletions cmake/FindL0.cmake
Expand Up @@ -16,15 +16,21 @@ endif()

list(INSERT CMAKE_PREFIX_PATH 0 ${l0_root_hints})

if (TARGET ze_loader)
set(LevelZero_FOUND ON)
endif()

if(NOT TARGET ze_loader)
find_path(LevelZero_INCLUDE_DIR
NAMES ze_api.h
PATHS
ENV ZE_ROOT
${l0_root_hints}
PATH_SUFFIXES
include
include/level_zero
local/include
local/include/level_zero/
local/include/level_zero
NO_DEFAULT_PATH
)

Expand All @@ -35,8 +41,9 @@ if(NOT TARGET ze_loader)
${l0_root_hints}
PATH_SUFFIXES
lib
lib/x86_64-linux-gnu
lib/level_zero
local/lib
lib/level_zero/
local/lib/level_zero
NO_DEFAULT_PATH
)
Expand All @@ -58,15 +65,14 @@ if(NOT TARGET ze_loader)
message("L0 is using OpenCL interoperability")
list(APPEND LevelZero_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
endif()
add_library(ze_loader INTERFACE IMPORTED)
set_target_properties(ze_loader
PROPERTIES INTERFACE_LINK_LIBRARIES "${LevelZero_LIBRARIES}"
)
set_target_properties(ze_loader
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LevelZero_INCLUDE_DIRS}"
)
endif()

add_library(ze_loader INTERFACE IMPORTED)
set_target_properties(ze_loader
PROPERTIES INTERFACE_LINK_LIBRARIES "${LevelZero_LIBRARIES}"
)
set_target_properties(ze_loader
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LevelZero_INCLUDE_DIRS}"
)
endif()

# Reverting the CMAKE_PREFIX_PATH to its original state
Expand Down

0 comments on commit d313361

Please sign in to comment.