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

[ML-226] Migrate correlation daal to DPC++ #215

Merged
merged 232 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from 228 commits
Commits
Show all changes
232 commits
Select commit Hold shift + click to select a range
147a1c6
1. add JNI wrapper
minmingzhu Apr 7, 2022
925111f
add ci test
minmingzhu Apr 7, 2022
be707d0
update
minmingzhu Apr 7, 2022
74bee70
java code style
minmingzhu Apr 8, 2022
d3a5f0e
cpp code style
minmingzhu Apr 8, 2022
285b990
Update ci-local-test.sh
minmingzhu Apr 8, 2022
d7c7ba4
Update ci-local-test.sh
minmingzhu Apr 8, 2022
fd2eabd
Update install-build-deps-ubuntu.sh
minmingzhu Apr 8, 2022
e14f873
Update install-build-deps-ubuntu.sh
minmingzhu Apr 8, 2022
a9d4514
Update ci-local-test.sh
minmingzhu Apr 8, 2022
1a70789
Update ci-local-test.sh
minmingzhu Apr 8, 2022
76ae8a4
Update ci-local-test.sh
minmingzhu Apr 10, 2022
554ebeb
Update install-build-deps-ubuntu.sh
minmingzhu Apr 10, 2022
1cd4a13
Update install-build-deps-ubuntu.sh
minmingzhu Apr 11, 2022
ca7fe3a
Update install-build-deps-ubuntu.sh
minmingzhu Apr 11, 2022
0668115
Update install-build-deps-ubuntu.sh
minmingzhu Apr 11, 2022
efe8750
Update install-build-deps-ubuntu.sh
minmingzhu Apr 11, 2022
79f7ce2
Update prepare-build-deps.sh
minmingzhu Apr 11, 2022
9dfcb5c
add convert array, vector to homogentable
minmingzhu Apr 11, 2022
60c2fe9
1. rollback ci config
minmingzhu Apr 11, 2022
a48cd18
1. update prepare-build-deps.sh
minmingzhu Apr 11, 2022
4809691
remove ci GPU test
minmingzhu Apr 11, 2022
4d2c3ce
1. remove GPU CI test
minmingzhu Apr 11, 2022
c986eb4
update code style
minmingzhu Apr 11, 2022
a7872dd
update code style
minmingzhu Apr 11, 2022
fe9cddb
fix comments
minmingzhu Apr 12, 2022
1bd4fed
update Makefile
minmingzhu Apr 12, 2022
d1b16e0
fix comments
minmingzhu Apr 12, 2022
82d50a3
1. fix ci
minmingzhu Apr 12, 2022
ca357c2
update header
minmingzhu Apr 13, 2022
1f349ca
update header
Apr 13, 2022
46d2d20
update ci
Apr 13, 2022
032881c
Update ci-cluster-test.sh
minmingzhu Apr 13, 2022
439ed5a
update ci
Apr 13, 2022
1046f4a
update ci
Apr 13, 2022
e5681ee
update ci conf
Apr 13, 2022
f2eadd3
update oneapi to 2022.1.2
Apr 13, 2022
59408bb
update ci conf
Apr 13, 2022
287bccd
fix comment
minmingzhu Apr 13, 2022
445f9bd
Update build-jni.sh
minmingzhu Apr 13, 2022
df3da7a
1. merge dpcpp_jni
minmingzhu Apr 14, 2022
0c53850
update Makefile
minmingzhu Apr 14, 2022
ab538f7
update ci
minmingzhu Apr 14, 2022
b5c1fe1
Update test.sh
minmingzhu Apr 14, 2022
6414642
Update test.sh
minmingzhu Apr 14, 2022
d9915fc
update ci
minmingzhu Apr 14, 2022
60d4d5b
update ci
minmingzhu Apr 17, 2022
ecef05d
Merge remote-tracking branch 'origin/dpcpp_jni' into dpcpp_jni
minmingzhu Apr 17, 2022
9df3c9f
Update test.sh
minmingzhu Apr 17, 2022
f4456f3
Update test.sh
minmingzhu Apr 17, 2022
d231bcd
Merge pull request #1 from minmingzhu/dpcpp_jni
minmingzhu Apr 17, 2022
5c6bb09
update test
minmingzhu Apr 17, 2022
30b5564
update test.sh
minmingzhu Apr 18, 2022
cdb6a90
update test.sh
minmingzhu Apr 18, 2022
b14d68e
update test.sh
minmingzhu Apr 18, 2022
56a4cce
fix link libze_loader.so.1
minmingzhu Apr 18, 2022
2b0253f
update
minmingzhu Apr 18, 2022
655e44d
update ci-local-dpc-test.sh
minmingzhu Apr 18, 2022
38a6ca1
update oneapi to 2022.1.2
minmingzhu Apr 18, 2022
6392925
update
minmingzhu Apr 18, 2022
552d01f
update
minmingzhu Apr 18, 2022
24944d5
update
minmingzhu Apr 18, 2022
5163023
Update ci-local-dpc-test.sh
minmingzhu Apr 18, 2022
6554716
update
minmingzhu Apr 18, 2022
d90fb7c
Merge remote-tracking branch 'origin/make_homogen_table' into make_ho…
minmingzhu Apr 18, 2022
165a697
update Makefile
minmingzhu Apr 18, 2022
27e7f46
Update ci-local-dpc-test.sh
minmingzhu Apr 18, 2022
0e2fc6a
Update prepare-build-deps-gpu.sh
minmingzhu Apr 18, 2022
da34479
Update prepare-build-deps-gpu.sh
minmingzhu Apr 18, 2022
d3f96d3
Update prepare-build-deps.sh
minmingzhu Apr 18, 2022
4780662
update ci
minmingzhu Apr 18, 2022
35ed7ad
Update ci-local-dpc-test.sh
minmingzhu Apr 18, 2022
c0e0edf
update ci
minmingzhu Apr 19, 2022
9db6a54
Merge remote-tracking branch 'origin/make_homogen_table' into make_ho…
minmingzhu Apr 19, 2022
0923b4a
update ci
minmingzhu Apr 19, 2022
2b126b2
update ci
minmingzhu Apr 19, 2022
4fa1926
update ci
minmingzhu Apr 19, 2022
51422c2
update ci
minmingzhu Apr 19, 2022
60ebcd9
update ci
minmingzhu Apr 19, 2022
e80a9ed
update ci
minmingzhu Apr 19, 2022
0456d55
Update install-build-level-zero-deps-ubuntun.sh
minmingzhu Apr 19, 2022
e9bd073
Update install-build-level-zero-deps-ubuntun.sh
minmingzhu Apr 19, 2022
da09a20
Update install-build-level-zero-deps-ubuntun.sh
minmingzhu Apr 19, 2022
e13986f
Update ci-local-dpc-test.sh
minmingzhu Apr 19, 2022
c416e87
Update GPU.cpp
minmingzhu Apr 19, 2022
984891b
Update GPU.cpp
minmingzhu Apr 19, 2022
c564ec9
Update ci-build-test.sh
minmingzhu Apr 20, 2022
83cf403
update
minmingzhu Apr 20, 2022
3370441
update
minmingzhu Apr 20, 2022
813d0ba
update HomogenTableImpl.cpp
minmingzhu Apr 20, 2022
3553002
Update ci-local-dpc-test.sh
minmingzhu Apr 20, 2022
770e6b5
Update ci-local-dpc-test.sh
minmingzhu Apr 20, 2022
2d32a34
Update ci-local-dpc-test.sh
minmingzhu Apr 20, 2022
13a631b
update HomogenTable API
minmingzhu Apr 23, 2022
258999f
update install-build-level-zero-deps-ubuntu.sh
minmingzhu Apr 23, 2022
dff643f
update ci
minmingzhu Apr 23, 2022
e8cf694
Merge branch 'master' into dpcpp
minmingzhu Apr 23, 2022
93c789d
Merge branch 'dpcpp' into make_homogen_table
minmingzhu Apr 23, 2022
2cb11c6
update ci
minmingzhu Apr 23, 2022
72ccff8
Merge remote-tracking branch 'origin/make_homogen_table' into make_ho…
minmingzhu Apr 23, 2022
e9dd5c8
update ci
minmingzhu Apr 23, 2022
99e246f
update ci
minmingzhu Apr 24, 2022
44222da
update
minmingzhu Apr 24, 2022
ff255a7
update code style
minmingzhu Apr 24, 2022
322fa18
update
minmingzhu Apr 24, 2022
caa4d71
Update ci-local-dpc-test.sh
minmingzhu Apr 24, 2022
7875024
update ci
minmingzhu Apr 25, 2022
449fd38
Merge remote-tracking branch 'origin/make_homogen_table' into make_ho…
minmingzhu Apr 25, 2022
a63680b
Update ci-local-dpc-test.sh
minmingzhu Apr 25, 2022
70c8d1c
update ci
minmingzhu Apr 25, 2022
8ae78ea
update
minmingzhu Apr 25, 2022
a075d11
update ci
minmingzhu Apr 25, 2022
2445346
update ci
minmingzhu Apr 25, 2022
e1bfed2
Update run.sh
minmingzhu Apr 25, 2022
5833b49
Update build-jni.sh
minmingzhu Apr 25, 2022
51970e2
1. Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 26, 2022
0cd0846
Merge remote-tracking branch 'origin/make_homogen_table' into make_ho…
minmingzhu Apr 26, 2022
1b2f2c6
Update pom.xml
minmingzhu Apr 26, 2022
dd9eca5
Update test.sh
minmingzhu Apr 26, 2022
63c4c6c
Update Makefile
minmingzhu Apr 26, 2022
4617462
update
minmingzhu Apr 26, 2022
66b30db
Merge remote-tracking branch 'origin/make_homogen_table' into make_ho…
minmingzhu Apr 26, 2022
33d13eb
Update ConvertHomogenTableSuite.scala
minmingzhu Apr 26, 2022
69a4ef0
Update install-level-zero-ubuntu.sh
minmingzhu Apr 26, 2022
a8ea65e
Update install-level-zero-ubuntu.sh
minmingzhu Apr 26, 2022
6083877
Update build.sh
minmingzhu Apr 26, 2022
dac8cac
Update test.sh
minmingzhu Apr 26, 2022
212a562
Update test.sh
minmingzhu Apr 26, 2022
fc6e615
Update HomogenTableImpl.cpp
minmingzhu Apr 26, 2022
8c3d92b
Update install-build-deps-ubuntu.sh
minmingzhu Apr 26, 2022
3a53698
Update HomogenTableImpl.cpp
minmingzhu Apr 26, 2022
3e0a5ea
update
minmingzhu Apr 27, 2022
ffb9a30
update code style
minmingzhu Apr 27, 2022
517b89f
Update install-build-deps-ubuntu.sh
minmingzhu Apr 27, 2022
e21d4ed
fix comments
minmingzhu May 8, 2022
270bcd8
update
minmingzhu May 8, 2022
cddfde7
Merge remote-tracking branch 'origin/make_homogen_table' into make_ho…
minmingzhu May 8, 2022
edb9f3d
update
minmingzhu May 8, 2022
fed77b0
Update list-compute-devices.cpp
minmingzhu May 9, 2022
8103100
Merge pull request #3 from minmingzhu/make_homogen_table
minmingzhu May 9, 2022
3511d27
Convert homogentable to array/vector/matrix (#4)
minmingzhu May 17, 2022
5c06964
Convert RDD[Vector]/RDD[LabeledPoint] to HomogenTable (#8)
minmingzhu May 31, 2022
0bc4e6a
Mirgate kmeans daal to DPC++ (#7)
minmingzhu Jun 14, 2022
060160d
1. migrate pca to DPC++
minmingzhu Jun 15, 2022
4081d96
update
minmingzhu Jun 15, 2022
bc7341a
update
minmingzhu Jun 15, 2022
6c0940f
update
minmingzhu Jun 17, 2022
cac47ff
update
minmingzhu Jun 17, 2022
3b84722
update
minmingzhu Jun 17, 2022
79a5605
update
minmingzhu Jun 17, 2022
d69de18
normalize data
minmingzhu Jun 20, 2022
5415d1b
update
minmingzhu Jun 20, 2022
1871f9c
update
minmingzhu Jun 20, 2022
2c26514
update
minmingzhu Jun 20, 2022
05477ba
1. migrate correlation to DPC++ interface
minmingzhu Jun 21, 2022
79d8acf
update
minmingzhu Jun 21, 2022
12f5db0
update
minmingzhu Jun 22, 2022
63293ad
1. move local host to distributed host
minmingzhu Jun 30, 2022
4ceb4ef
update code style
minmingzhu Jun 30, 2022
05e4094
update
minmingzhu Jul 1, 2022
76be84c
Update ci-cluster-test.sh
minmingzhu Jul 1, 2022
614ca77
Update ci-cluster-test.sh
minmingzhu Jul 1, 2022
3e64614
Update build.sh
minmingzhu Jul 1, 2022
8054f13
Update build.sh
minmingzhu Jul 1, 2022
6330c2d
Update OneDAL.cpp
minmingzhu Jul 1, 2022
fc16778
Update OneDAL.cpp
minmingzhu Jul 1, 2022
4171761
Update OneDAL.cpp
minmingzhu Jul 1, 2022
653e487
Update com_intel_oap_mllib_OneDAL__.h
minmingzhu Jul 1, 2022
efb43e3
update code style
minmingzhu Jul 1, 2022
5544af0
Update NaiveBayesResult.java
minmingzhu Jul 1, 2022
b8e9b93
1. update code style
minmingzhu Jul 6, 2022
92a9ffd
Merge remote-tracking branch 'origin/dpcpp' into dpcpp
minmingzhu Jul 6, 2022
f67e0e7
update
minmingzhu Jul 6, 2022
975091a
update
minmingzhu Jul 6, 2022
e773caf
rollback code style
minmingzhu Jul 7, 2022
6cdb23e
rollback code style
minmingzhu Jul 7, 2022
4dc9548
Merge remote-tracking branch 'origin/dpcpp' into dpcpp
minmingzhu Jul 11, 2022
17db39d
rollback checkstyle.xml
minmingzhu Jul 11, 2022
1c0a85a
update
minmingzhu Jul 12, 2022
fdb4d11
rollback checkstyle.xml
minmingzhu Jul 12, 2022
186889b
update
minmingzhu Jul 12, 2022
1ebe473
update OneDAL.scala
minmingzhu Jul 12, 2022
966a9ff
revert ALS.scala
xwu99 Jul 14, 2022
4f74bac
revert checkstyle.xml
xwu99 Jul 14, 2022
aad8d41
:Revert "revert checkstyle.xml"
xwu99 Jul 14, 2022
6b821e4
disable cluster test for gpu
xwu99 Jul 14, 2022
54df393
disable cluster test for gpu
xwu99 Jul 14, 2022
37a42df
nit
xwu99 Jul 14, 2022
de9d66f
migrate cpa to DPC++
minmingzhu Jul 20, 2022
3a165b3
update
minmingzhu Jul 20, 2022
7b13ce4
Merge branch 'oneapi_interface' into migrate_pca
minmingzhu Jul 20, 2022
94469fa
Update OutputHelpers.hpp
minmingzhu Jul 20, 2022
3d4f7fe
update com_intel_oap_mllib_feature_PCADALImpl.h
minmingzhu Jul 21, 2022
94fe4ab
Merge remote-tracking branch 'origin/migrate_pca' into migrate_pca
minmingzhu Jul 21, 2022
2560eff
update
minmingzhu Jul 21, 2022
753c094
update PCADALImpl.scala
minmingzhu Jul 21, 2022
ef09c7e
1. update function name and variable name
minmingzhu Jul 25, 2022
0790f4d
update
minmingzhu Jul 27, 2022
5ced6f4
update
minmingzhu Jul 27, 2022
accc118
update stayHomogenTablePtrToVector to saveHomogenTablePtrToVector
minmingzhu Aug 2, 2022
ee91e8b
change compute_device to ComputeDevice
minmingzhu Aug 8, 2022
e1228bc
merge migrate_pca
minmingzhu Aug 9, 2022
0a8b957
1. migrate pca to DPC++
minmingzhu Jun 15, 2022
ac2d363
update
minmingzhu Jun 17, 2022
278db37
update
minmingzhu Jun 17, 2022
2523f6d
normalize data
minmingzhu Jun 20, 2022
dd5d2d9
update
minmingzhu Jun 20, 2022
7a1d03f
update
minmingzhu Jun 20, 2022
0783eae
update
minmingzhu Jun 20, 2022
1999349
1. migrate correlation to DPC++ interface
minmingzhu Jun 21, 2022
a046f2d
update
minmingzhu Jun 22, 2022
f6fcb70
Merge branch 'oneapi_interface' into mirgate_correlation
minmingzhu Aug 9, 2022
3632dda
update
minmingzhu Aug 9, 2022
80ceed8
Merge remote-tracking branch 'origin/mirgate_correlation' into mirgat…
minmingzhu Aug 9, 2022
ed987e1
update
minmingzhu Aug 9, 2022
9291714
Update prepare-build-deps-gpu.sh
minmingzhu Aug 10, 2022
8be4717
update
minmingzhu Aug 10, 2022
4f223d0
Update Makefile
minmingzhu Aug 10, 2022
a5bce19
Update OutputHelpers.hpp
minmingzhu Aug 10, 2022
88b1e39
Update PCAOneAPIImpl.cpp
minmingzhu Aug 10, 2022
7ec26eb
Update service.h
minmingzhu Aug 10, 2022
d646da7
update
minmingzhu Aug 10, 2022
5e8de4d
Update OneDAL.scala
minmingzhu Aug 10, 2022
b2f6f76
Update PCADALImpl.scala
minmingzhu Aug 10, 2022
4345a39
Update KmeansHomogenTableSuite.scala
minmingzhu Aug 10, 2022
dafad22
Update TestCommon.scala
minmingzhu Aug 10, 2022
afa5b99
Update test.sh
minmingzhu Aug 10, 2022
dfb41ab
update
minmingzhu Aug 10, 2022
794ecf8
fix comments
minmingzhu Aug 17, 2022
75468de
update
minmingzhu Aug 17, 2022
c05eef3
update
minmingzhu Aug 17, 2022
24cea3e
update code style
minmingzhu Aug 30, 2022
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
4 changes: 2 additions & 2 deletions examples/correlation/run-gpu-standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DATA_FILE=$HDFS_ROOT/data/sample_kmeans_data.txt
APP_JAR=target/oap-mllib-examples-$OAP_MLLIB_VERSION.jar
APP_CLASS=org.apache.spark.examples.ml.CorrelationExample

USE_GPU=true
DEVICE=GPU
RESOURCE_FILE=$PWD/IntelGpuResourceFile.json
WORKER_GPU_AMOUNT=4
EXECUTOR_GPU_AMOUNT=1
Expand All @@ -27,7 +27,7 @@ time $SPARK_HOME/bin/spark-submit --master $SPARK_MASTER \
--conf "spark.sql.shuffle.partitions=$SPARK_DEFAULT_PARALLELISM" \
--conf "spark.driver.extraClassPath=$SPARK_DRIVER_CLASSPATH" \
--conf "spark.executor.extraClassPath=$SPARK_EXECUTOR_CLASSPATH" \
--conf "spark.oap.mllib.useGPU=$USE_GPU" \
--conf "spark.oap.mllib.device=$DEVICE" \
--conf "spark.worker.resourcesFile=$RESOURCE_FILE" \
--conf "spark.worker.resource.gpu.amount=$WORKER_GPU_AMOUNT" \
--conf "spark.executor.resource.gpu.amount=$EXECUTOR_GPU_AMOUNT" \
Expand Down
3 changes: 2 additions & 1 deletion examples/correlation/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ../../conf/env.sh


DEVICE=CPU
APP_JAR=target/oap-mllib-examples-$OAP_MLLIB_VERSION.jar
APP_CLASS=org.apache.spark.examples.ml.CorrelationExample

Expand All @@ -17,6 +17,7 @@ time $SPARK_HOME/bin/spark-submit --master $SPARK_MASTER \
--conf "spark.sql.shuffle.partitions=$SPARK_DEFAULT_PARALLELISM" \
--conf "spark.driver.extraClassPath=$SPARK_DRIVER_CLASSPATH" \
--conf "spark.executor.extraClassPath=$SPARK_EXECUTOR_CLASSPATH" \
--conf "spark.oap.mllib.device=$DEVICE" \
--conf "spark.shuffle.reduceLocality.enabled=false" \
--conf "spark.network.timeout=1200s" \
--conf "spark.task.maxFailures=1" \
Expand Down
2 changes: 2 additions & 0 deletions examples/pca/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ APP_JAR=target/oap-mllib-examples-$OAP_MLLIB_VERSION.jar
APP_CLASS=org.apache.spark.examples.ml.PCAExample

# Dataset is created in the code, so no need to pass in as parameter
DEVICE=CPU

time $SPARK_HOME/bin/spark-submit --master $SPARK_MASTER \
--num-executors $SPARK_NUM_EXECUTORS \
Expand All @@ -18,6 +19,7 @@ time $SPARK_HOME/bin/spark-submit --master $SPARK_MASTER \
--conf "spark.sql.shuffle.partitions=$SPARK_DEFAULT_PARALLELISM" \
--conf "spark.driver.extraClassPath=$SPARK_DRIVER_CLASSPATH" \
--conf "spark.executor.extraClassPath=$SPARK_EXECUTOR_CLASSPATH" \
--conf "spark.oap.mllib.device=$DEVICE" \
--conf "spark.shuffle.reduceLocality.enabled=false" \
--conf "spark.network.timeout=1200s" \
--conf "spark.task.maxFailures=1" \
Expand Down
192 changes: 0 additions & 192 deletions mllib-dal/src/main/native/CorrelationDALImpl.cpp

This file was deleted.

90 changes: 90 additions & 0 deletions mllib-dal/src/main/native/CorrelationOneAPIImpl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*******************************************************************************
* Copyright 2020 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#include <chrono>

#ifdef CPU_GPU_PROFILE
#include "GPU.h"
#ifndef ONEDAL_DATA_PARALLEL
#define ONEDAL_DATA_PARALLEL
#endif

#include "Communicator.hpp"
#include "OutputHelpers.hpp"
#include "com_intel_oap_mllib_stat_CorrelationDALImpl.h"
#include "oneapi/dal/algo/covariance.hpp"
#include "oneapi/dal/table/homogen.hpp"
#include "service.h"

using namespace std;
using namespace oneapi::dal;
const int ccl_root = 0;

static void doCorrelationOneAPICompute(JNIEnv *env, jint rankId,
jlong pNumTabData, jint executorNum,
const ccl::string &ipPort,
jint computeDeviceOrdinal,
jobject resultObj) {
std::cout << "oneDAL (native): GPU/CPU compute start , rankid = %ld "
minmingzhu marked this conversation as resolved.
Show resolved Hide resolved
<< rankId << "; device = " << computeDeviceOrdinal
<< "(0:HOST;1:CPU;2:GPU)" << std::endl;
const bool isRoot = (rankId == ccl_root);
ComputeDevice device = getComputeDeviceByOrdinal(computeDeviceOrdinal);
homogen_table htable =
*reinterpret_cast<const homogen_table *>(pNumTabData);

const auto cor_desc = covariance::descriptor{}.set_result_options(
covariance::result_options::cor_matrix |
covariance::result_options::means);
auto queue = getQueue(device);
auto comm = preview::spmd::make_communicator<preview::spmd::backend::ccl>(
queue, executorNum, rankId, ipPort);
const auto result_train = preview::compute(comm, cor_desc, htable);
if (isRoot) {
std::cout << "Mean:\n" << result_train.get_means() << std::endl;
std::cout << "Correlation:\n"
<< result_train.get_cor_matrix() << std::endl;
// Return all covariance & mean
jclass clazz = env->GetObjectClass(resultObj);

// Get Field references
jfieldID correlationNumericTableField =
env->GetFieldID(clazz, "correlationNumericTable", "J");

HomogenTablePtr correlation =
std::make_shared<homogen_table>(result_train.get_cor_matrix());
saveHomogenTablePtrToVector(correlation);

env->SetLongField(resultObj, correlationNumericTableField,
(jlong)correlation.get());
}
}

JNIEXPORT jlong JNICALL
Java_com_intel_oap_mllib_stat_CorrelationDALImpl_cCorrelationTrainDAL(
JNIEnv *env, jobject obj, jlong pNumTabData, jint executorNum,
jint computeDeviceOrdinal, jint rankId, jstring ipPort, jobject resultObj) {
std::cout << "oneDAL (native): use GPU DPC++ kernels with " << std::endl;
minmingzhu marked this conversation as resolved.
Show resolved Hide resolved
const char *ipPortPtr = env->GetStringUTFChars(ipPort, 0);
std::string ipPortStr = std::string(ipPortPtr);
printf("oneDAL (native): CorrelationTrainDAL %d \n", computeDeviceOrdinal);
minmingzhu marked this conversation as resolved.
Show resolved Hide resolved
doCorrelationOneAPICompute(env, rankId, pNumTabData, executorNum, ipPortStr,
computeDeviceOrdinal, resultObj);

env->ReleaseStringUTFChars(ipPort, ipPortPtr);
return 0;
}
#endif
3 changes: 1 addition & 2 deletions mllib-dal/src/main/native/KMeansOneAPIImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <chrono>
#include <iomanip>
#include <iostream>
#include <mutex>

#ifdef CPU_GPU_PROFILE
#include "GPU.h"
Expand All @@ -42,7 +41,7 @@ static jlong doKMeansOneAPICompute(JNIEnv *env, jint rankId, jlong pNumTabData,
jint computeDeviceOrdinal,
jobject resultObj) {
std::cout << "oneDAL (native): GPU/CPU compute start , rankid = " << rankId
<< "; device = " << computeDeviceOrdinal << "(0:HOST;1:GPU;2:CPU)"
<< "; device = " << computeDeviceOrdinal << "(0:HOST;1:CPU;2:GPU)"
minmingzhu marked this conversation as resolved.
Show resolved Hide resolved
<< std::endl;
const bool isRoot = (rankId == ccl_root);
ComputeDevice device = getComputeDeviceByOrdinal(computeDeviceOrdinal);
Expand Down
6 changes: 3 additions & 3 deletions mllib-dal/src/main/native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ LIBS_COMMON := -L$(CCL_ROOT)/lib/cpu_gpu_dpcpp -lccl \

ONEDAL_LIBS := -lonedal_dpc \
-lonedal_core \
-lonedal_thread
-lonedal_thread

ifeq ($(PLATFORM_PROFILE),CPU_ONLY_PROFILE)
LIBS := $(LIBS_COMMON) $(ONEDAL_LIBS)
Expand All @@ -78,7 +78,7 @@ CPP_SRCS += \
./ALSDALImpl.cpp ./ALSShuffle.cpp \
./NaiveBayesDALImpl.cpp \
./LinearRegressionDALImpl.cpp \
./CorrelationDALImpl.cpp \
./CorrelationOneAPIImpl.cpp \
./SummarizerDALImpl.cpp \
./oneapi/dal/HomogenTableImpl.cpp \
./oneapi/dal/SimpleMetadataImpl.cpp \
Expand All @@ -93,7 +93,7 @@ OBJS += \
./ALSDALImpl.o ./ALSShuffle.o \
./NaiveBayesDALImpl.o \
./LinearRegressionDALImpl.o \
./CorrelationDALImpl.o \
./CorrelationOneAPIImpl.o \
./SummarizerDALImpl.o \
./oneapi/dal/HomogenTableImpl.o \
./oneapi/dal/SimpleMetadataImpl.o \
Expand Down
2 changes: 1 addition & 1 deletion mllib-dal/src/main/native/OutputHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "oneapi/dal/table/row_accessor.hpp"
#include "oneapi/dal/table/common.hpp"

std::ostream &operator<<(std::ostream &stream, const oneapi::dal::table &table) {
inline std::ostream &operator<<(std::ostream &stream, const oneapi::dal::table &table) {
auto arr = oneapi::dal::row_accessor<const float>(table).pull();
const auto x = arr.get_data();

Expand Down
Loading