Skip to content

Commit

Permalink
Merge branch 'master' into tbb-arena
Browse files Browse the repository at this point in the history
  • Loading branch information
olegkkruglov committed Oct 7, 2023
2 parents 00172ad + 7be05a4 commit c5fd09a
Show file tree
Hide file tree
Showing 30 changed files with 627 additions and 518 deletions.
7 changes: 3 additions & 4 deletions .ci/pipeline/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ jobs:
# displayName: 'Uploading on fail'
# condition: failed()
# continueOnError: true

# - job: 'LinuxMakeDPCPP'
# timeoutInMinutes: 0
# variables:
Expand Down Expand Up @@ -395,8 +394,8 @@ jobs:
.ci/scripts/build.sh --compiler clang --target daal --optimizations "sse2 avx2" --conda-env ci-env
displayName: 'make daal'
- script: |
.ci/scripts/build.sh --compiler clang --target oneapi_c --optimizations "sse2 avx2"
displayName: 'make oneapi_c'
.ci/scripts/build.sh --compiler clang --target onedal_c --optimizations "sse2 avx2"
displayName: 'make onedal_c'
- task: PublishPipelineArtifact@1
inputs:
artifactName: '$(platform.type) build'
Expand Down Expand Up @@ -471,4 +470,4 @@ jobs:
# targetPath: '$(Build.Repository.LocalPath)/$(release.dir)'
# displayName: 'Uploading on fail'
# condition: failed()
# continueOnError: true
# continueOnError: true
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AlgorithmContainerImpl<batch> : public AlgorithmContainer<batch>
*
* \tparam mode Computation mode of the algorithm, \ref ComputeMode
* \tparam sse2Container Implementation for Intel(R) Streaming SIMD Extensions 2 (Intel(R) SSE2)
* \tparam sse42Container Implementation for Intel(R) Streaming SIMD Extensions 42 (Intel(R) SSE42)
* \tparam sse42Container Implementation for Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2)
* \tparam avx2Container Implementation for Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2)
* \tparam avx512Container Implementation for Intel(R) Xeon(R) processors based on Intel AVX-512
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace interface1
*
* \tparam mode Computation mode of the algorithm, \ref ComputeMode
* \tparam sse2Container Implementation for Intel(R) Streaming SIMD Extensions 2 (Intel(R) SSE2)
* \tparam sse42Container Implementation for Intel(R) Streaming SIMD Extensions 42 (Intel(R) SSE42)
* \tparam sse42Container Implementation for Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2)
* \tparam avx2Container Implementation for Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2)
* \tparam avx512Container Implementation for Intel(R) Xeon(R) processors based on Intel AVX-512
*/
Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/include/services/daal_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ namespace daal
{
/**
* <a name="DAAL-ENUM-COMPUTEMODE"></a>
* Computation modes of Intel(R) oneDAL algorithms
* Computation modes of Intel(R) oneAPI Data Analytics Library (oneDAL) algorithms
*/
enum ComputeMode
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/include/services/daal_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/*
//++
// Intel(R) oneDAL string class.
// Intel(R) oneAPI Data Analytics Library (oneDAL) string class.
//--
*/

Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/include/services/error_handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/*
//++
// Handling errors in Intel(R) oneDAL.
// Handling errors in Intel(R) oneAPI Data Analytics Library (oneDAL).
//--
*/

Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/include/services/error_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/*
//++
// Data types for error handling in Intel(R) oneDAL.
// Data types for error handling in Intel(R) oneAPI Data Analytics Library (oneDAL).
//--
*/

Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/include/services/error_indexes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/*
//++
// Details of errors in Intel(R) oneDAL.
// Details of errors in Intel(R) oneAPI Data Analytics Library (oneDAL).
//--
*/

Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/include/services/internal/execution_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ExecutionContext : public Base
// This branch is needed to avoid problems with deleting SYCL entities
// after SYCL RT static objects are already released.
// This is caused by "C++ static initialization order fiasco" problem between
// oneDAL static Environment object and internal static contexts of SYCL RT.
// Intel(R) oneAPI Data Analytics Library (oneDAL) static Environment object and internal static contexts of SYCL RT.
// Here we solve this temporary with a small memory leak.
// TODO: remove this after complete transition to DPC++ kernels.
if (needEmptyDeleter)
Expand Down
6 changes: 3 additions & 3 deletions cpp/daal/include/services/internal/sycl/math/mkl_blas.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace interface1

/**
* <a name="DAAL-CLASS-ONEAPI-INTERNAL__MKLGEMM"></a>
* \brief Adapter for MKL GEMM routine
* \brief Adapter for Intel(R) MKL GEMM routine
*/
template <typename algorithmFPType>
struct MKLGemm
Expand Down Expand Up @@ -112,7 +112,7 @@ struct MKLGemm

/**
* <a name="DAAL-CLASS-ONEAPI-INTERNAL__MKLSYRK"></a>
* \brief Adapter for MKL SYRK routine
* \brief Adapter for Intel(R) MKL SYRK routine
*/
template <typename algorithmFPType>
struct MKLSyrk
Expand Down Expand Up @@ -171,7 +171,7 @@ struct MKLSyrk

/**
* <a name="DAAL-CLASS-ONEAPI-INTERNAL__MKLAXPY"></a>
* \brief Adapter for MKL AXPY routine
* \brief Adapter for Intel(R) MKL AXPY routine
*/
template <typename algorithmFPType>
struct MKLAxpy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/*
//++
// Utility functions for DAL wrappers over MKL routines.
// Utility functions for DAL wrappers over Intel(R) MKL routines.
//--
*/

Expand Down
4 changes: 2 additions & 2 deletions cpp/daal/include/services/internal/sycl/math/mkl_lapack.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace interface1

/**
* <a name="DAAL-CLASS-ONEAPI-INTERNAL__MKLPOTRF"></a>
* \brief Adapter for MKL POTRF routine
* \brief Adapter for Intel(R) MKL POTRF routine
*/
template <typename algorithmFPType>
struct MKLPotrf
Expand Down Expand Up @@ -98,7 +98,7 @@ struct MKLPotrf

/**
* <a name="DAAL-CLASS-ONEAPI-INTERNAL__MKLPOTRS></a>
* \brief Adapter for MKL POTRS routine
* \brief Adapter for Intel(R) MKL POTRS routine
*/
template <typename algorithmFPType>
struct MKLPotrs
Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/include/services/library_version_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/*
//++
// Intel(R) oneDAL version information.
// Intel(R) oneAPI Data Analytics Library (oneDAL) version information.
//--
*/

Expand Down
4 changes: 2 additions & 2 deletions cpp/daal/src/externals/core_threading_win_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ DAAL_EXPORT void * _getThreadPinner(bool create_pinner, void (*read_topo)(int &,
#define CALL_RET_FUNC_FROM_DLL_CPU_MIC(ret_type, fn_dpref, fn_cpu, fn_name, argdecl, argcall)
#endif

/* Used directly in Intel oneDAL */
/* Used directly in Intel(R) oneAPI Data Analytics Library (oneDAL) */
CALL_VOID_FUNC_FROM_DLL(fpk_blas_, dsyrk,
(const char * uplo, const char * trans, const DAAL_INT * n, const DAAL_INT * k, const double * alpha, const double * a,
const DAAL_INT * lda, const double * beta, double * c, const DAAL_INT * ldc),
Expand Down Expand Up @@ -1109,7 +1109,7 @@ typedef signed int Ipp32s;
typedef float Ipp32f;
typedef double Ipp64f;

/* Used in Intel oneDAL via SS */
/* Used in Intel(R) oneAPI Data Analytics Library (oneDAL) via SS */
CALL_RET_FUNC_FROM_DLL(IppStatus, fpk_dft_, ippsSortRadixAscend_64f_I, (Ipp64f * pSrcDst, Ipp64f * pTmp, Ipp32s len), (pSrcDst, pTmp, len));
CALL_RET_FUNC_FROM_DLL(IppStatus, fpk_dft_, ippsSortRadixAscend_32f_I, (Ipp32f * pSrcDst, Ipp32f * pTmp, Ipp32s len), (pSrcDst, pTmp, len));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,25 @@ void add_regularization(sycl::queue& q_,
template <typename Float>
sycl::event value_and_gradient_iter(sycl::queue& q_,
std::int64_t p,
const pr::ndarray<Float, 1>& params_nd,
const pr::ndarray<Float, 2>& data_nd,
const pr::ndarray<std::int32_t, 1>& responses_nd,
const pr::ndarray<Float, 1>& probabilities,
pr::ndarray<Float, 1>& out,
pr::ndarray<Float, 1>& ans,
const pr::ndview<Float, 2>& data_nd,
const pr::ndview<std::int32_t, 1>& responses_nd,
const pr::ndview<Float, 1>& probabilities,
pr::ndview<Float, 1>& out,
pr::ndview<Float, 1>& ans,
bool fit_intercept,
sycl::event& prev_iter) {
auto fill_event = fill(q_, out, Float(0), {});

auto out_loss = out.slice(0, 1);
auto out_gradient = out.slice(1, p + 1);
auto out_loss = out.get_slice(0, 1);
auto out_gradient = out.get_slice(1, p + 2);
auto out_gradient_suf = fit_intercept ? out_gradient : out_gradient.get_slice(1, p + 1);

auto loss_event = compute_logloss_with_der(q_,
params_nd,
data_nd,
responses_nd,
probabilities,
out_loss,
out_gradient,
Float(0),
Float(0),
out_gradient_suf,
fit_intercept,
{ fill_event });

Expand All @@ -156,26 +153,15 @@ sycl::event value_and_gradient_iter(sycl::queue& q_,

template <typename Float>
sycl::event value_iter(sycl::queue& q_,
std::int64_t p,
const pr::ndarray<Float, 1>& params_nd,
const pr::ndarray<Float, 2>& data_nd,
const pr::ndarray<std::int32_t, 1>& responses_nd,
const pr::ndarray<Float, 1>& probabilities,
pr::ndarray<Float, 1>& out_loss,
pr::ndarray<Float, 1>& ans_loss,
const pr::ndview<std::int32_t, 1>& responses_nd,
const pr::ndview<Float, 1>& probabilities,
pr::ndview<Float, 1>& out_loss,
pr::ndview<Float, 1>& ans_loss,
bool fit_intercept,
sycl::event& prev_iter) {
auto fill_event = fill(q_, out_loss, Float(0), {});
auto loss_event = compute_logloss(q_,
params_nd,
data_nd,
responses_nd,
probabilities,
out_loss,
Float(0),
Float(0),
fit_intercept,
{ fill_event });
auto loss_event =
compute_logloss(q_, responses_nd, probabilities, out_loss, fit_intercept, { fill_event });
const auto* const out_ptr = out_loss.get_data();
auto* const ans_loss_ptr = ans_loss.get_mutable_data();
return q_.submit([&](sycl::handler& cgh) {
Expand All @@ -189,7 +175,6 @@ sycl::event value_iter(sycl::queue& q_,
template <typename Float>
sycl::event gradient_iter(sycl::queue& q_,
std::int64_t p,
const pr::ndarray<Float, 1>& params_nd,
const pr::ndarray<Float, 2>& data_nd,
const pr::ndarray<std::int32_t, 1>& responses_nd,
const pr::ndarray<Float, 1>& probabilities,
Expand All @@ -198,14 +183,12 @@ sycl::event gradient_iter(sycl::queue& q_,
bool fit_intercept,
sycl::event& prev_iter) {
auto fill_event = fill(q_, out_gradient, Float(0), {});
auto out_grad_suf = fit_intercept ? out_gradient : out_gradient.get_slice(1, p + 1);
auto grad_event = compute_derivative(q_,
params_nd,
data_nd,
responses_nd,
probabilities,
out_gradient,
Float(0),
Float(0),
out_grad_suf,
fit_intercept,
{ fill_event });
grad_event.wait_and_throw();
Expand All @@ -225,7 +208,6 @@ sycl::event gradient_iter(sycl::queue& q_,
template <typename Float>
sycl::event hessian_iter(sycl::queue& q_,
std::int64_t p,
const pr::ndarray<Float, 1>& params_nd,
const pr::ndarray<Float, 2>& data_nd,
const pr::ndarray<std::int32_t, 1>& responses_nd,
const pr::ndarray<Float, 1>& probabilities,
Expand All @@ -235,7 +217,6 @@ sycl::event hessian_iter(sycl::queue& q_,
sycl::event& prev_iter) {
auto fill_event = fill(q_, out_hessian, Float(0), {});
auto hess_event = compute_hessian(q_,
params_nd,
data_nd,
responses_nd,
probabilities,
Expand Down Expand Up @@ -282,6 +263,7 @@ result_t compute_kernel_dense_batch_impl<Float>::operator()(
const bk::uniform_blocking blocking(n, bsz);

const auto params_nd = pr::table2ndarray_1d<Float>(q_, params, alloc::device);
const auto params_nd_suf = fit_intercept ? params_nd : params_nd.slice(1, p);
const auto* const params_ptr = params_nd.get_data();

const auto responses_nd_big = pr::table2ndarray_1d<std::int32_t>(q_, responses, alloc::device);
Expand Down Expand Up @@ -326,14 +308,13 @@ result_t compute_kernel_dense_batch_impl<Float>::operator()(
const auto responses_nd = responses_nd_big.slice(first, cursize);

sycl::event prob_e =
compute_probabilities(q_, params_nd, data_nd, probabilities, fit_intercept, {});
compute_probabilities(q_, params_nd_suf, data_nd, probabilities, fit_intercept, {});
prob_e.wait_and_throw();

if (desc.get_result_options().test(result_options::value) &&
desc.get_result_options().test(result_options::gradient)) {
prev_logloss_e = value_and_gradient_iter(q_,
p,
params_nd,
data_nd,
responses_nd,
probabilities,
Expand All @@ -345,9 +326,6 @@ result_t compute_kernel_dense_batch_impl<Float>::operator()(
else {
if (desc.get_result_options().test(result_options::value)) {
prev_logloss_e = value_iter(q_,
p,
params_nd,
data_nd,
responses_nd,
probabilities,
out_loss,
Expand All @@ -358,7 +336,6 @@ result_t compute_kernel_dense_batch_impl<Float>::operator()(
if (desc.get_result_options().test(result_options::gradient)) {
prev_grad_e = gradient_iter(q_,
p,
params_nd,
data_nd,
responses_nd,
probabilities,
Expand All @@ -371,7 +348,6 @@ result_t compute_kernel_dense_batch_impl<Float>::operator()(
if (desc.get_result_options().test(result_options::hessian)) {
prev_hess_e = hessian_iter(q_,
p,
params_nd,
data_nd,
responses_nd,
probabilities,
Expand Down
1 change: 1 addition & 0 deletions cpp/oneapi/dal/backend/primitives/objective_function/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dal_module(
dal_deps = [
"@onedal//cpp/oneapi/dal/backend/primitives:common",
"@onedal//cpp/oneapi/dal/backend/primitives:blas",
"@onedal//cpp/oneapi/dal/backend/primitives/optimizers",
],
)

Expand Down
Loading

0 comments on commit c5fd09a

Please sign in to comment.