Skip to content

Commit

Permalink
update oneCCL to 21.5 (#11)
Browse files Browse the repository at this point in the history
* add 22.5 release

* add 21.5 oneCCL

* fix patch issue

* gpu rel 0.3.0

* revert cmake patch

* fix path issue

* update patch
  • Loading branch information
KimBioInfoStudio authored Dec 24, 2021
1 parent 4325196 commit 4c41111
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 67 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "third_party/oneCCL"]
path = third_party/oneCCL
url = https://github.com/oneapi-src/oneCCL.git

[submodule "third_party/Internal_oneCCL"]
path = third_party/Internal_oneCCL
url = https://github.com/intel-innersource/libraries.performance.communication.oneccl.git
8 changes: 2 additions & 6 deletions cmake/Modules/FindoneCCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ IF (USE_SYSTEM_ONECCL)
ENDIF(USE_SYSTEM_ONECCL)

IF (NOT ONECCL_FOUND)
IF (USE_DEV_ONECCL)
SET(ONECCL_ROOT "${PROJECT_SOURCE_DIR}/third_party/Internal_oneCCL")
ELSE()
SET(ONECCL_ROOT "${PROJECT_SOURCE_DIR}/third_party/oneCCL")
ENDIF()

SET(ONECCL_ROOT "${PROJECT_SOURCE_DIR}/third_party/oneCCL")


ADD_SUBDIRECTORY(${ONECCL_ROOT} )
IF(NOT TARGET ccl)
MESSAGE(FATAL_ERROR "Failed to find oneCCL target")
Expand Down
13 changes: 0 additions & 13 deletions patches/Update_Internal_oneCCL.patch

This file was deleted.

41 changes: 10 additions & 31 deletions patches/Update_oneCCL.patch
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
Index: torch-ccl/third_party/oneCCL/cmake/FindIntelSYCL_level_zero.cmake
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- torch-ccl/third_party/oneCCL/cmake/FindIntelSYCL_level_zero.cmake (revision 2d3dd773af8f77589832b80ade3075d7eac77f2d)
+++ torch-ccl/third_party/oneCCL/cmake/FindIntelSYCL_level_zero.cmake (date 1634305871499)
@@ -72,6 +72,9 @@
if(IntelSYCL_level_zero_FOUND AND NOT TARGET Intel::SYCL_level_zero)
get_target_property(LEVEL_ZERO_INCLUDE_DIRECTORIES ze_loader INTERFACE_INCLUDE_DIRECTORIES)

+ get_filename_component(EXTENSION_SYCL_INCLUDE_DIRS "${INTEL_SYCL_INCLUDE_DIRS}/.." ABSOLUTE)
+ set(INTEL_SYCL_INCLUDE_DIRS "${INTEL_SYCL_INCLUDE_DIRS};${EXTENSION_SYCL_INCLUDE_DIRS}")
+
add_library(Intel::SYCL_level_zero UNKNOWN IMPORTED)
list(APPEND SYCL_LEVEL_ZERO_INCLUDE_DIRS "${LEVEL_ZERO_INCLUDE_DIRECTORIES}")
list(APPEND SYCL_LEVEL_ZERO_INCLUDE_DIRS "${INTEL_SYCL_INCLUDE_DIRS}")
Index: torch-ccl/third_party/oneCCL/src/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- torch-ccl/third_party/oneCCL/src/CMakeLists.txt (revision 2d3dd773af8f77589832b80ade3075d7eac77f2d)
+++ torch-ccl/third_party/oneCCL/src/CMakeLists.txt (date 1634306166871)
@@ -310,10 +310,10 @@

# link with release_mt libmpi.so for oneAPI Base toolkit
# libccl.so -> cpu_icc/cpu_gpu_dpcpp -> lib -> latest -> ccl -> mpi -> ...
-set(ONEAPI_IMPI_RPATH "'$ORIGIN'/../../../../mpi/latest/lib/release_mt/")
+set(ONEAPI_IMPI_RPATH "'$ORIGIN':'$ORIGIN'/../../../../mpi/latest/lib/release_mt/")
set_target_properties(ccl PROPERTIES LINK_FLAGS "-Wl,-rpath,${ONEAPI_IMPI_RPATH}")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 72e1eda..2eb06f5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -294,7 +294,10 @@ endif()
add_library(ccl SHARED $<TARGET_OBJECTS:ccl-objects>)
target_include_directories(ccl PUBLIC ${SRC_INCLUDE_DIRS})

-target_link_libraries(ccl PUBLIC ${SRC_LINK_LIBS})
+set(ONEAPI_IMPI_RPATH "'$ORIGIN'")
+set_target_properties(ccl PROPERTIES LINK_FLAGS "-Wl,-rpath,${ONEAPI_IMPI_RPATH}")
+
+target_link_libraries(ccl PRIVATE ${SRC_LINK_LIBS})

if (NOT LIB_SO_VERSION AND NOT LIB_MAJOR_VERSION)
Expand Down
13 changes: 2 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ def run(self):
for ext in cmake_extensions:
try:
# temp patch the oneCCL code
if os.environ.get('USE_DEV_ONECCL', "OFF").upper() in ["1", "Y", "YES", "ON"]:
check_call(["git", "apply", os.path.join(CWD, "patches/Update_Internal_oneCCL.patch")], cwd=os.path.join(CWD, "third_party/Internal_oneCCL"))
else:
check_call(["git", "apply", "./patches/Update_oneCCL.patch"], cwd=CWD)
check_call(["git", "apply", os.path.join(CWD, "patches/Update_oneCCL.patch")], cwd=os.path.join(CWD, "third_party/oneCCL"))
except Exception as e:
print("=" * 64 + "\nWARNNING!\n" + "=" * 64)
print(e)
Expand Down Expand Up @@ -123,9 +120,6 @@ def build_cmake(self, extension: CMakeExtension):
'BUILD_FT': 'OFF'
}

if os.environ.get('USE_DEV_ONECCL', "OFF").upper() in ["1", "Y", "YES", "ON"]:
build_options['USE_DEV_ONECCL'] = "ON"

runtime = 'gcc'
if 'COMPUTE_BACKEND' in os.environ:
if os.environ['COMPUTE_BACKEND'] == 'dpcpp_level_zero':
Expand Down Expand Up @@ -159,10 +153,7 @@ def run(self):
print(e)
print("=" * 64)
try:
if os.environ.get('USE_DEV_ONECCL', "OFF").upper() in ["1", "Y", "YES", "ON"]:
check_call(["git", "reset", "--hard"], cwd=os.path.join(CWD, "third_party/Internal_oneCCL"))
else:
check_call(["git", "reset", "--hard"], cwd=os.path.join(CWD, "third_party/Internal_oneCCL"))
check_call(["git", "reset", "--hard"], cwd=os.path.join(CWD, "third_party/oneCCL"))
except Exception as e:
print("=" * 64 + "\nWARNNING!\n" + "=" * 64)
print(e)
Expand Down
1 change: 0 additions & 1 deletion third_party/Internal_oneCCL
Submodule Internal_oneCCL deleted from 7d65bd
2 changes: 1 addition & 1 deletion third_party/oneCCL
Submodule oneCCL updated 482 files

0 comments on commit 4c41111

Please sign in to comment.