Skip to content
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

feature: enabling oneDPL and sort primitive refactoring #3046

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
65d9322
init adding dpl
Alexandr-Solovev Jan 16, 2025
f8028b7
fixes for dpl
Alexandr-Solovev Jan 20, 2025
0b553e8
minor fix
Alexandr-Solovev Jan 21, 2025
2a91928
minor fix
Alexandr-Solovev Jan 21, 2025
ab367c0
minor fix for dpl from toolkit
Alexandr-Solovev Jan 22, 2025
e053cdf
minor fix for script
Alexandr-Solovev Jan 22, 2025
3f1a6fe
minor fixes
Alexandr-Solovev Jan 22, 2025
700cd10
minor fix
Alexandr-Solovev Jan 22, 2025
809760f
minor fix
Alexandr-Solovev Jan 22, 2025
d01ea31
minor fix for dpl
Alexandr-Solovev Jan 22, 2025
064bb12
fix correct link
Alexandr-Solovev Jan 22, 2025
6e3587d
minor fixes
Alexandr-Solovev Jan 22, 2025
0d9edd6
Merge branch 'uxlfoundation:main' into dev/asolovev_radix_sort_opt
Alexandr-Solovev Jan 23, 2025
a60eb07
minor fix
Alexandr-Solovev Jan 23, 2025
16c8f6c
minor fix
Alexandr-Solovev Jan 23, 2025
91410dc
Merge branch 'uxlfoundation:main' into dev/asolovev_radix_sort_opt
Alexandr-Solovev Feb 5, 2025
8fd11bb
fixes
Alexandr-Solovev Feb 5, 2025
bf9d31f
fixes for memory
Alexandr-Solovev Feb 7, 2025
4575642
reduce memory usage
Alexandr-Solovev Feb 7, 2025
16b1ca5
optimizations
Alexandr-Solovev Feb 10, 2025
09995cf
fixes for tree_order
Alexandr-Solovev Feb 10, 2025
0ecfd35
initial internal dispatcher
Alexandr-Solovev Feb 10, 2025
94b260b
fixes
Alexandr-Solovev Feb 11, 2025
5bdd54f
minor fixes
Alexandr-Solovev Feb 14, 2025
e7f4066
Merge branch 'main' into dev/asolovev_radix_sort_opt
Alexandr-Solovev Feb 20, 2025
aaa4546
fixes
Alexandr-Solovev Feb 20, 2025
a7cfed8
add fraction checker
Alexandr-Solovev Feb 21, 2025
b450d82
minor fixes
Alexandr-Solovev Feb 21, 2025
24cf250
fixes
Alexandr-Solovev Feb 21, 2025
2f397cf
fixes
Alexandr-Solovev Feb 21, 2025
caf932e
fixes for dpl install
Alexandr-Solovev Feb 25, 2025
cb66c3f
minor fixes
Alexandr-Solovev Feb 27, 2025
6f64de2
fixes for memory usage
Alexandr-Solovev Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .ci/pipeline/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ variables:
VM_IMAGE : 'ubuntu-22.04'
SYSROOT_OS: 'jammy'
WINDOWS_BASEKIT_URL: 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe'
WINDOWS_DPCPP_COMPONENTS: 'intel.oneapi.win.mkl.devel:intel.oneapi.win.tbb.devel'
WINDOWS_DPCPP_COMPONENTS: 'intel.oneapi.win.mkl.devel:intel.oneapi.win.tbb.devel:intel.oneapi.win.dpl'
LINUX_DPL_URL: 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/de3c613f-829c-4bdc-aa2b-6129eece3bd9/intel-onedpl-2022.7.1.15_offline.sh'

resources:
repositories:
Expand Down Expand Up @@ -71,6 +72,9 @@ jobs:
- script: |
.ci/env/apt.sh mkl
displayName: 'mkl installation'
- script:
chmod +x .ci/scripts/install_dpl.sh && .ci/scripts/install_dpl.sh $(LINUX_DPL_URL)
displayName: 'oneDPL installation'
- script: |
source /opt/intel/oneapi/setvars.sh
.ci/scripts/describe_system.sh
Expand Down Expand Up @@ -393,6 +397,9 @@ jobs:
- script: |
.ci/env/apt.sh mkl
displayName: 'mkl installation'
- script:
chmod +x .ci/scripts/install_dpl.sh && .ci/scripts/install_dpl.sh $(LINUX_DPL_URL)
displayName: 'oneDPL installation'
- script: |
source /opt/intel/oneapi/setvars.sh
.ci/scripts/describe_system.sh
Expand Down
31 changes: 31 additions & 0 deletions .ci/scripts/install_dpl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#===============================================================================
# Copyright contributors to the oneDAL project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================

URL=$1

# Download the installation script
curl --output installer.sh --url "$URL" --retry 5 --retry-delay 5
chmod +x installer.sh

# Execute the installation script
sudo sh installer.sh -a --silent --eula accept
installer_exit_code=$?

# Clean up
rm -f installer.sh

exit $installer_exit_code
21 changes: 19 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Required Software:
* BLAS and LAPACK libraries - both provided by oneMKL
* Python version 3.9 or higher
* TBB library (repository contains script to download it)
* oneDPL library
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alexandr-Solovev Please remember to update also the conda instructions that appear towards the end of this file.

The package name for conda should be onedpl-devel, and it needs to update the list of environment variables to add DPL_ROOT.

* Microsoft Visual Studio\* (Windows\* only)
* [MSYS2](http://msys2.github.io) (Windows\* only)
* `make` and `dos2unix` tools; install these packages using MSYS2 on Windows\* as follows:
Expand Down Expand Up @@ -113,9 +114,25 @@ is available as an alternative to the manual setup.

./dev/download_tbb.sh

6. Download and install Python (version 3.9 or higher).
6. Set up Intel(R) Threading Building Blocks (Intel(R) TBB):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
6. Set up Intel(R) Threading Building Blocks (Intel(R) TBB):
6. Set up Intel(R) OneDPL


7. Build oneDAL via command-line interface. Choose the appropriate commands based on the interface, platform, and the compiler you use. Interface and platform are required arguments of makefile while others are optional. Below you can find the set of examples for building oneDAL. You may use a combination of them to get the desired build configuration:
_Note: if you used the general oneAPI setvars script from a Base Toolkit installation, this step will not be necessary as oneDPL will already have been set up._

Download and install [Intel(R) oneDPL](https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-library.html).
Set the environment variables for for Intel(R) oneDPL. For example:

- oneDPL (Windows\*):

call "C:\Program Files (x86)\Intel\oneAPI\dpl\latest\env\vars.bat" intel64

- oneDPL (Linux\*):

source /opt/intel/oneapi/dpl/latest/env/vars.sh intel64


7. Download and install Python (version 3.9 or higher).

8. Build oneDAL via command-line interface. Choose the appropriate commands based on the interface, platform, and the compiler you use. Interface and platform are required arguments of makefile while others are optional. Below you can find the set of examples for building oneDAL. You may use a combination of them to get the desired build configuration:

- DAAL interfaces on **Linux\*** using **Intel(R) C++ Compiler**:

Expand Down
15 changes: 15 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ ccl_repo(
]
)

load("@onedal//dev/bazel/deps:dpl.bzl", "dpl_repo")
dpl_repo(
name = "dpl",
root_env_var = "DPL_ROOT",
urls = [
"https://files.pythonhosted.org/packages/95/f6/18f78cb933e01ecd9e99d37a10da4971a795fcfdd1d24640799b4050fdbb/onedpl_devel-2022.7.1-py2.py3-none-manylinux_2_28_x86_64.whl",
],
sha256s = [
"3b270999d2464c5151aa0e7995dda9e896d072c75069ccee1efae9dc56bdc417",
],
strip_prefixes = [
"onedpl_devel-2022.7.1.data/data",
],
)

load("@onedal//dev/bazel/deps:mkl.bzl", "mkl_repo")
mkl_repo(
name = "mkl",
Expand Down
1 change: 1 addition & 0 deletions cpp/oneapi/dal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dal_module(
],
dpc_deps = [
"@mkl//:mkl_dpc",
"@dpl//:headers",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inline sycl::event sort_inplace(sycl::queue& queue_,
const bk::event_vector& deps = {}) {
ONEDAL_ASSERT(src.get_count() > 0);
auto src_ind = pr::ndarray<Index, 1>::empty(queue_, { src.get_count() });
return pr::radix_sort_indices_inplace<Float, Index>{ queue_ }(src, src_ind, deps);
return pr::radix_sort_indices_inplace<Float, Index>(queue_, src, src_ind, deps);
}

template <typename Float, typename Bin, typename Index>
Expand Down Expand Up @@ -429,13 +429,14 @@ sycl::event indexed_features<Float, Bin, Index>::operator()(const table& tbl,
pr::ndarray<Bin, 1>::empty(queue_, { row_count_ }, sycl::usm::alloc::device);
}

pr::radix_sort_indices_inplace<Float, Index> sort{ queue_ };

sycl::event last_event;

for (Index i = 0; i < column_count_; i++) {
last_event = extract_column(data_nd_, values_nd, indices_nd, i, { last_event });
last_event = sort(values_nd, indices_nd, { last_event });
last_event = pr::radix_sort_indices_inplace<Float, Index>(queue_,
values_nd,
indices_nd,
{ last_event });
last_event =
compute_bins(values_nd, indices_nd, column_bin_vec_[i], entries_[i], i, { last_event });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "oneapi/dal/backend/primitives/utils.hpp"
#include "oneapi/dal/algo/decision_forest/train_types.hpp"

#include "oneapi/dal/backend/primitives/rng/host_engine_collection.hpp"
#include "oneapi/dal/backend/primitives/rng/device_engine.hpp"

#include "oneapi/dal/algo/decision_forest/backend/gpu/train_misc_structs.hpp"
#include "oneapi/dal/algo/decision_forest/backend/gpu/train_impurity_data.hpp"
Expand Down Expand Up @@ -50,8 +50,7 @@ class train_kernel_hist_impl {
using model_manager_t = train_model_manager<Float, Index, Task>;
using train_context_t = train_context<Float, Index, Task>;
using imp_data_t = impurity_data<Float, Index, Task>;
using rng_engine_t = pr::host_engine;
using rng_engine_list_t = std::vector<rng_engine_t>;
using rng_engine_list_t = ::oneapi::dal::backend::primitives::device_engine;
using msg = dal::detail::error_messages;
using comm_t = bk::communicator<spmd::device_memory_access::usm>;
using node_t = node<Index>;
Expand Down Expand Up @@ -575,7 +574,7 @@ class train_kernel_hist_impl {
pr::ndarray<hist_type_t, 1>& oob_per_obs_list,
pr::ndarray<Float, 1>& var_imp,
pr::ndarray<Float, 1>& var_imp_variance,
const rng_engine_list_t& rng_engine_arr,
rng_engine_list_t& rng_engine_arr,
Index tree_idx,
Index tree_in_block,
Index built_tree_count,
Expand Down
Loading
Loading