Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr-Solovev committed Sep 24, 2024
1 parent 56fc2d7 commit c51600a
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .ci/env/apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function install_dpcpp {
}

function install_mkl {
sudo apt-get install -y intel-oneapi-mkl-devel
sudo apt-get install -y intel-oneapi-mkl-devel=2024.2.1-103
}

function install_clang-format {
Expand Down
3 changes: 2 additions & 1 deletion .ci/pipeline/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ variables:
TBB_VERSION : 'v2021.10.0'
VM_IMAGE : 'ubuntu-22.04'
SYSROOT_OS: 'jammy'
WINDOWS_BASEKIT_URL: 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/d91caaa0-7306-46ea-a519-79a0423e1903/w_BaseKit_p_2024.2.1.101_offline.exe'
WIN_BASEKIT_VERSION: '2024.2.1.101'
WINDOWS_BASEKIT_URL: 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/d91caaa0-7306-46ea-a519-79a0423e1903/w_BaseKit_p_$(WIN_BASEKIT_VERSION)_offline.exe'
WINDOWS_DPCPP_COMPONENTS: 'intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.tbb.devel'

jobs:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ permissions:
contents: read

variables:
WINDOWS_BASEKIT_URL: 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/d91caaa0-7306-46ea-a519-79a0423e1903/w_BaseKit_p_2024.2.1.101_offline.exe'
WIN_BASEKIT_VERSION: '2024.2.1.101'
WINDOWS_BASEKIT_URL: 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/d91caaa0-7306-46ea-a519-79a0423e1903/w_BaseKit_p_$(WIN_BASEKIT_VERSION)_offline.exe'
WINDOWS_ALL_COMPONENTS: 'intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel'

jobs:
Expand Down
109 changes: 82 additions & 27 deletions cpp/daal/src/externals/service_math_mkl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@
#include <mkl.h>
#include "src/services/service_defines.h"

#if !defined(__DAAL_CONCAT5)
#define __DAAL_CONCAT5(a, b, c, d, e) __DAAL_CONCAT51(a, b, c, d, e)
#define __DAAL_CONCAT51(a, b, c, d, e) a##b##c##d##e
#endif

#define VMLFN_CALL(f_name, f_args) \
v##f_name f_args; \
#define __DAAL_MKLFN_CALL_MATH(f_name, f_args) \
f_name f_args; \
return;

namespace daal
Expand Down Expand Up @@ -106,27 +101,57 @@ struct MklMath<double, cpu>
return r;
}

static void vPowx(SizeType n, const double * in, double in1, double * out) { VMLFN_CALL(dPowx, ((int)n, in, in1, out)); }
static void vPowx(SizeType n, const double * in, double in1, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdPowx, ((int)n, in, in1, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vCeil(SizeType n, const double * in, double * out) { VMLFN_CALL(dCeil, ((int)n, in, out)); }
static void vCeil(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdCeil, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vErfInv(SizeType n, const double * in, double * out) { VMLFN_CALL(dErfInv, ((int)n, in, out)); }
static void vErfInv(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdErfInv, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vErf(SizeType n, const double * in, double * out) { VMLFN_CALL(dErf, ((int)n, in, out)); }
static void vErf(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdErf, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vExp(SizeType n, const double * in, double * out) { VMLFN_CALL(dExp, ((int)n, in, out)); }
static void vExp(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdExp, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static double vExpThreshold() { return -650.0; }

static void vTanh(SizeType n, const double * in, double * out) { VMLFN_CALL(dTanh, ((int)n, in, out)); }
static void vTanh(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdTanh, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vSqrt(SizeType n, const double * in, double * out) { VMLFN_CALL(dSqrt, ((int)n, in, out)); }
static void vSqrt(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdSqrt, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vLog(SizeType n, const double * in, double * out) { VMLFN_CALL(dLn, ((int)n, in, out)); }
static void vLog(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdLn, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vLog1p(SizeType n, const double * in, double * out) { VMLFN_CALL(dLog1p, ((int)n, in, out)); }
static void vLog1p(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdLog1p, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vCdfNormInv(SizeType n, const double * in, double * out) { VMLFN_CALL(dCdfNormInv, ((int)n, in, out)); }
static void vCdfNormInv(SizeType n, const double * in, double * out)
{
__DAAL_MKLFN_CALL_MATH(vmdCdfNormInv, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}
};

/*
Expand Down Expand Up @@ -188,27 +213,57 @@ struct MklMath<float, cpu>
return r;
}

static void vPowx(SizeType n, const float * in, float in1, float * out) { VMLFN_CALL(sPowx, ((int)n, in, in1, out)); }
static void vPowx(SizeType n, const float * in, float in1, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsPowx, ((int)n, in, in1, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vCeil(SizeType n, const float * in, float * out) { VMLFN_CALL(sCeil, ((int)n, in, out)); }
static void vCeil(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsCeil, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vErfInv(SizeType n, const float * in, float * out) { VMLFN_CALL(sErfInv, ((int)n, in, out)); }
static void vErfInv(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsErfInv, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vErf(SizeType n, const float * in, float * out) { VMLFN_CALL(sErf, ((int)n, in, out)); }
static void vErf(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsErf, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vExp(SizeType n, const float * in, float * out) { VMLFN_CALL(sExp, ((int)n, in, out)); }
static void vExp(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsExp, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static float vExpThreshold() { return -75.0f; }

static void vTanh(SizeType n, const float * in, float * out) { VMLFN_CALL(sTanh, ((int)n, in, out)); }
static void vTanh(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsTanh, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vSqrt(SizeType n, const float * in, float * out) { VMLFN_CALL(sSqrt, ((int)n, in, out)); }
static void vSqrt(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsSqrt, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vLog(SizeType n, const float * in, float * out) { VMLFN_CALL(sLn, ((int)n, in, out)); }
static void vLog(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsLn, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vLog1p(SizeType n, const float * in, float * out) { VMLFN_CALL(sLog1p, ((int)n, in, out)); }
static void vLog1p(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsLog1p, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}

static void vCdfNormInv(SizeType n, const float * in, float * out) { VMLFN_CALL(sCdfNormInv, ((int)n, in, out)); }
static void vCdfNormInv(SizeType n, const float * in, float * out)
{
__DAAL_MKLFN_CALL_MATH(vmsCdfNormInv, ((int)n, in, out, (VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_STDERR)));
}
};

} // namespace mkl
Expand Down
16 changes: 7 additions & 9 deletions cpp/daal/src/externals/service_service_mkl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define __SERVICE_SERVICE_MKL_H__

#include "services/daal_defines.h"
#include "src/services/service_topo.h"
#include <mkl.h>
#include <mkl_service.h>
#include <string.h>
Expand Down Expand Up @@ -61,22 +62,19 @@ struct MklService
// return memmove_s(dest, destSize, src, smax);
}

static int serv_get_ht()
{
// TODO: real detection of hypertheading
return 0;
}
static int serv_get_ht() { return (serv_get_ncorespercpu() > 1 ? 1 : 0); }

static int serv_get_ncpus()
{
// TODO: detection of npus
return 1;
unsigned int ncores = daal::services::internal::_internal_daal_GetSysProcessorCoreCount();
return (ncores ? ncores : 1);
}

static int serv_get_ncorespercpu()
{
// TODO: detection of ncores per cpu
return 1;
unsigned int nlogicalcpu = daal::services::internal::_internal_daal_GetSysLogicalProcessorCount();
unsigned int ncpus = serv_get_ncpus();
return (ncpus > 0 && nlogicalcpu > 0 && nlogicalcpu > ncpus ? nlogicalcpu / ncpus : 1);
}

// TODO: The real call should be delegated to a backend library if the option is supported
Expand Down
5 changes: 0 additions & 5 deletions cpp/daal/src/externals/service_stat_rng_mkl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
#ifndef __SERVICE_STAT_RNG_MKL_H__
#define __SERVICE_STAT_RNG_MKL_H__

#if !defined(__DAAL_CONCAT5)
#define __DAAL_CONCAT5(a, b, c, d, e) __DAAL_CONCAT51(a, b, c, d, e)
#define __DAAL_CONCAT51(a, b, c, d, e) a##b##c##d##e
#endif

#define __DAAL_VSLFN_CALL_NR(f_name, f_args, errcode) __DAAL_VSLFN_CALL_NO_V(f_name, f_args, errcode)
#define __DAAL_VSLFN_CALL_NR_WHILE(f_name, f_args, errcode) \
{ \
Expand Down
5 changes: 0 additions & 5 deletions cpp/daal/src/externals/service_stat_rng_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@

#include "src/externals/service_stat_rng_ref.h"

#if !defined(__DAAL_CONCAT2)
#define __DAAL_CONCAT2(a, b) a##b
#endif

#define __DAAL_VSLFN(f_pref, f_name) __DAAL_CONCAT2(f_pref, f_name)
#define __DAAL_VSLFN_CALL_NR(f_pref, f_name, f_args, errcode) __DAAL_VSLFN_CALL(f_pref, f_name, f_args, errcode)
#define __DAAL_VSLFN_CALL_NR_WHILE(f_pref, f_name, f_args, errcode) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion cpp/daal/src/services/service_topo.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static int __internal_daal_countBits(DWORD_PTR x);
unsigned _internal_daal_GetMaxCPUSupportedByOS();
unsigned _internal_daal_GetOSLogicalProcessorCount();
unsigned _internal_daal_GetSysProcessorPackageCount();
unsigned _internal_daal_GetProcessorCoreCount();
unsigned _internal_daal_GetSysProcessorCoreCount();
unsigned _internal_daal_GetLogicalProcessorCount();
unsigned _internal_daal_GetCoresPerPackageProcessorCount();
unsigned _internal_daal_GetProcessorPackageCount();
Expand Down

0 comments on commit c51600a

Please sign in to comment.