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 d852b18 commit 9e93ab5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions cpp/daal/src/externals/service_service_mkl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define __SERVICE_SERVICE_MKL_H__

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

static int serv_get_ht() { return 0; }
static int serv_get_ht() { return (serv_get_ncorespercpu() > 1 ? 1 : 0); }

static int serv_get_ncpus() { return 1; }
static int serv_get_ncpus()
{
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
3 changes: 2 additions & 1 deletion cpp/daal/src/services/service_algo_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
//--
*/

#include "src/services/service_utils.h"
#include "src/services/service_algo_utils.h"
#include "services/error_indexes.h"
#include "services/error_handling.h"
#include "src/services/service_algo_utils.h"

namespace daal
{
Expand Down

0 comments on commit 9e93ab5

Please sign in to comment.