Skip to content

Commit

Permalink
[GPU] Add convertToSyclHomogen for row merged table for kmeans and pca (
Browse files Browse the repository at this point in the history
#159)

* Add convertToSyclHomogen for row merged table

* Add convertToSyclHomogen for pca
  • Loading branch information
xwu99 authored Dec 15, 2021
1 parent 0d80960 commit 559ff5d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion mllib-dal/src/main/native/KMeansDALImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using namespace std;
using namespace daal;
using namespace daal::algorithms;
using namespace daal::services;

typedef double algorithmFPType; /* Algorithm floating-point type */

Expand Down Expand Up @@ -262,8 +263,18 @@ Java_com_intel_oap_mllib_clustering_KMeansDALImpl_cKMeansDALComputeWithInitCente
daal::services::Environment::getInstance()->setDefaultExecutionContext(
ctx);

using daal::data_management::internal::convertToSyclHomogen;

Status st;
NumericTablePtr pSyclHomogen = convertToSyclHomogen<algorithmFPType>(*pData, st);
if (!st.ok()) {
std::cout << "Failed to convert row merged table to SYCL homogen one"
<< std::endl;
return 0L;
}

ret = doKMeansDALComputeWithInitCenters(
env, obj, rankId, comm, pData, centroids, cluster_num, tolerance,
env, obj, rankId, comm, pSyclHomogen, centroids, cluster_num, tolerance,
iteration_num, executor_num, resultObj);

env->ReleaseIntArrayElements(gpu_idx_array, gpu_indices, 0);
Expand Down
13 changes: 12 additions & 1 deletion mllib-dal/src/main/native/PCADALImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using namespace std;
using namespace daal;
using namespace daal::algorithms;
using namespace daal::services;

typedef double algorithmFPType; /* Algorithm floating-point type */

Expand Down Expand Up @@ -195,7 +196,17 @@ Java_com_intel_oap_mllib_feature_PCADALImpl_cPCATrainDAL(
daal::services::Environment::getInstance()->setDefaultExecutionContext(
ctx);

doPCADALCompute(env, obj, rankId, comm, pData, nBlocks, resultObj);
using daal::data_management::internal::convertToSyclHomogen;

Status st;
NumericTablePtr pSyclHomogen = convertToSyclHomogen<algorithmFPType>(*pData, st);
if (!st.ok()) {
std::cout << "Failed to convert row merged table to SYCL homogen one"
<< std::endl;
return 0L;
}

doPCADALCompute(env, obj, rankId, comm, pSyclHomogen, nBlocks, resultObj);

env->ReleaseIntArrayElements(gpu_idx_array, gpu_indices, 0);
} else
Expand Down

0 comments on commit 559ff5d

Please sign in to comment.