-
Notifications
You must be signed in to change notification settings - Fork 12.5k
[Draft] Tensor Parallel support to llama.cpp #9648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: Chen Xi <xi2chen@intel.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -566,6 +566,17 @@ if (GGML_SYCL) | |
list(APPEND GGML_EXTRA_LIBS_PRIVATE DNNL::dnnl) | ||
endif() | ||
|
||
set(oneCCL_DIR "/opt/intel/oneapi/ccl/latest/lib/cmake/oneCCL") | ||
set(MPI_INCLUDE_PATH "/opt/intel/oneapi/mpi/latest/include") | ||
set(MPI_LIBRARY_PATH "/opt/intel/oneapi/mpi/latest/lib/") | ||
set(ONECCL_INCLUDE_PATH "/opt/intel/oneapi/ccl/latest/include") | ||
set(ONECCL_LIBRARY_PATH "/opt/intel/oneapi/ccl/latest/lib/") | ||
include_directories(${MPI_INCLUDE_PATH} ${ONECCL_INCLUDE_PATH}) | ||
find_library(MPI_LIBRARY mpi HINTS ${MPI_LIBRARY_PATH}) | ||
find_library(ONECCL_LIBRARY ccl HINTS ${ONECCL_LIBRARY_PATH}) | ||
# find_package(oneCCL REQUIRED) | ||
message("-- oneCCL found") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add script for not found oneCCL. oneCCL is not included in oneAPI base toolkit, please print the message to guide user how to install it. |
||
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} ${MPI_LIBRARY_PATH} ${ONECCL_LIBRARY_PATH}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GGML_EXTRA_LIBS was recently split into GGML_EXTRA_LIBS_PUBLIC and GGML_EXTRA_LIBS_PRIVATE, so I think the line above won't work anymore |
||
if (WIN32) | ||
find_package(IntelSYCL REQUIRED) | ||
find_package(MKL REQUIRED) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,13 @@ | |
#ifndef GGML_SYCL_DPCT_HELPER_HPP | ||
#define GGML_SYCL_DPCT_HELPER_HPP | ||
|
||
#include <stdlib.h> | ||
#include <sycl/sycl.hpp> | ||
#include <sycl/half_type.hpp> | ||
#include <oneapi/ccl.hpp> | ||
#include <oneapi/mkl.hpp> | ||
#include <map> | ||
#include <mpi.h> | ||
|
||
#include "ggml.h" | ||
|
||
|
@@ -480,8 +482,6 @@ namespace dpct | |
int _max_nd_range_size_i[3]; | ||
uint32_t _device_id; | ||
std::array<unsigned char, 16> _uuid; | ||
uint32_t _rank; | ||
uint32_t _world_size; | ||
}; | ||
|
||
static int get_major_version(const sycl::device &dev) | ||
|
@@ -873,8 +873,8 @@ namespace dpct | |
} | ||
return -1; | ||
} | ||
inline int get_ccl_rank() { return _rank; } | ||
inline int get_ccl_world_size() { return _world_size; } | ||
inline int get_rank() { return _rank; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These new functions have no relationship with DPCT. |
||
inline int get_world_size() { return _world_size; } | ||
inline ccl::communicator create_ccl_communicator(ccl::device dev, ccl::context ctx) { | ||
return ccl::create_communicator(_world_size, _rank, dev, ctx, _kvs); | ||
|
||
|
@@ -1002,7 +1002,13 @@ namespace dpct | |
return convert_backend_index(backend1) < convert_backend_index(backend2); | ||
} | ||
|
||
static void init_ccl() { | ||
static void mpi_finalize() { | ||
static int is_finalized = 0; | ||
MPI_Finalized(&is_finalized); | ||
if (!is_finalized) MPI_Finalize(); | ||
} | ||
|
||
void init_ccl() { | ||
ccl::init(); | ||
MPI_Init(NULL, NULL); | ||
MPI_Comm_size(MPI_COMM_WORLD, &_world_size); | ||
|
@@ -1018,7 +1024,6 @@ namespace dpct | |
MPI_Bcast((void *)main_addr.data(), main_addr.size(), MPI_BYTE, 0, MPI_COMM_WORLD); | ||
_kvs = ccl::create_kvs(main_addr); | ||
} | ||
|
||
} | ||
|
||
dev_mgr() | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The real oneapi path is not always in
/opt/intel/oneapi/
.Please use
ENV{ONEAPI_ROOT}
which is mandatory env variable in cmakefile.Same for following script