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

[GPU] Add convertToSyclHomogen for row merged table for kmeans and pca #159

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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