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

Mirgate kmeans daal to DPC++ #7

Merged
merged 342 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
342 commits
Select commit Hold shift + click to select a range
219421e
add empty homogentable
minmingzhu Apr 22, 2022
4853c30
update
minmingzhu Apr 23, 2022
fb74ceb
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
5ef6673
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
f2f62d7
update
minmingzhu Apr 28, 2022
a26810d
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
b33bdda
Update build-jni.sh
minmingzhu Apr 17, 2022
a220486
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
b3f748e
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
f2c73ea
add empty homogentable
minmingzhu Apr 22, 2022
e709f79
update
minmingzhu Apr 23, 2022
5682bda
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
1f58164
update
minmingzhu Apr 28, 2022
493b4e4
update
minmingzhu May 17, 2022
e6a0568
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
bda3e5d
update ConvertHomogenTableSuite.scala
minmingzhu Apr 17, 2022
39e3451
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
92d122d
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
913dbb1
add empty homogentable
minmingzhu Apr 22, 2022
7dfeb45
update
minmingzhu Apr 23, 2022
8d6966f
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
37c7289
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
05d040c
update
minmingzhu Apr 28, 2022
e2d82b5
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
4878b3a
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
7dcd34f
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
86a3300
add empty homogentable
minmingzhu Apr 22, 2022
9a76374
update
minmingzhu Apr 23, 2022
a8506e0
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
67133e5
update
minmingzhu Apr 28, 2022
995634d
update
minmingzhu May 17, 2022
5ac54bb
rebase dpcpp
minmingzhu May 17, 2022
561ccfd
Merge branch 'convert_homogentable' into rdd_to_homogenTable
minmingzhu May 17, 2022
44b8b01
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
9159a0a
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
bd6f1bb
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
134e53e
update
minmingzhu Apr 28, 2022
2f1e118
rollback to edb9f3d
minmingzhu May 9, 2022
0ad11d6
update
minmingzhu May 9, 2022
9bf6625
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
e57d776
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
c44215f
update
minmingzhu May 9, 2022
304326d
update
minmingzhu May 9, 2022
dbde288
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
eeaba6a
rollback to edb9f3d
minmingzhu May 9, 2022
c83b143
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
f491862
update
minmingzhu May 9, 2022
c5ee622
update
minmingzhu May 9, 2022
2656a8d
update
minmingzhu May 9, 2022
f7dd4a3
fix comments
minmingzhu May 10, 2022
2b87a75
fix comments
minmingzhu May 16, 2022
0b47896
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
1fd7bd3
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
2926f6f
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
7b0f487
update
minmingzhu Apr 23, 2022
fed83f3
update
minmingzhu Apr 28, 2022
c5fb769
update
minmingzhu May 17, 2022
1e71601
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
6061062
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
10ea8a8
add empty homogentable
minmingzhu Apr 22, 2022
3aa21db
update
minmingzhu Apr 23, 2022
7bc9782
update
minmingzhu Apr 28, 2022
72ac27e
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
7fc8771
update
minmingzhu Apr 23, 2022
45025fe
update
minmingzhu Apr 28, 2022
52d82ca
update
minmingzhu May 17, 2022
e01b283
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
27af86d
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
97e511b
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
da2d606
update
minmingzhu Apr 23, 2022
42a0c3b
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
d135493
update
minmingzhu Apr 28, 2022
472bbd0
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
0c1e0c0
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
366d92c
update
minmingzhu Apr 23, 2022
fa80695
update
minmingzhu May 17, 2022
036c08c
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
da503b7
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
8668c0e
update
minmingzhu Apr 23, 2022
ef48e29
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
6af59e7
update
minmingzhu Apr 28, 2022
280ea13
update code style
minmingzhu May 18, 2022
56c5ba0
update HomogenTableTest.java
minmingzhu May 18, 2022
b698539
remove unused code
minmingzhu May 18, 2022
3fbf4cc
add debug print
minmingzhu May 18, 2022
a0806e2
update debug print
minmingzhu May 19, 2022
e1843e7
update
minmingzhu May 19, 2022
842a922
update KMeansOneAPIImpl.cpp
minmingzhu May 19, 2022
591fa6f
update
minmingzhu May 20, 2022
ac4b750
update
minmingzhu May 20, 2022
734eacb
update
minmingzhu May 20, 2022
ad7cf53
update
minmingzhu May 20, 2022
a90b2b9
update
minmingzhu May 20, 2022
ce8d5fd
update
minmingzhu May 20, 2022
c4cc324
update
minmingzhu May 20, 2022
dd0b9b6
update
minmingzhu May 21, 2022
abba106
update
minmingzhu May 22, 2022
0fd0018
update
minmingzhu May 22, 2022
25a9498
fixed comments
minmingzhu May 25, 2022
bd1ce8f
update
minmingzhu May 25, 2022
0f7645a
Merge branch 'rdd_to_homogenTable' into mirgate_kmeans
minmingzhu May 25, 2022
cfa2e8b
Update com_intel_oap_mllib_OneDAL__.h
minmingzhu May 25, 2022
6cd5e86
Update OneDAL.cpp
minmingzhu May 25, 2022
c2c4834
Update HomogenTableImpl.cpp
minmingzhu May 25, 2022
e2ebc05
Update ConvertHomogenTableSuite.scala
minmingzhu May 25, 2022
ade4452
update
minmingzhu May 25, 2022
d177b9c
used static_cast
minmingzhu May 26, 2022
527e18f
update
minmingzhu May 26, 2022
26be02e
Update GPU.cpp
minmingzhu May 26, 2022
1fb1478
update
minmingzhu May 26, 2022
64cdc6d
update
minmingzhu May 26, 2022
8299a39
update
minmingzhu May 26, 2022
7fcdc46
fix comments
minmingzhu May 27, 2022
f7e47df
Merge remote-tracking branch 'origin/rdd_to_homogenTable' into rdd_to…
minmingzhu May 27, 2022
1285c03
update code style
minmingzhu May 27, 2022
ea63e32
update
minmingzhu May 29, 2022
27262c4
update
minmingzhu May 29, 2022
0e2084c
update
minmingzhu May 31, 2022
f35b1b9
Merge branch 'rdd_to_homogenTable' into mirgate_kmeans
minmingzhu May 31, 2022
882f542
Convert RDD[Vector]/RDD[LabeledPoint] to HomogenTable (#8)
minmingzhu May 31, 2022
534309d
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
6d9d221
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
a85a1b5
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
74d7ec2
add empty homogentable
minmingzhu Apr 22, 2022
48fec67
update
minmingzhu Apr 22, 2022
d1b9ab3
update
minmingzhu Apr 23, 2022
ca45204
update
minmingzhu Apr 28, 2022
34337b3
1. Merge branch 'convert_homogentable' into rdd_to_homogenTable
minmingzhu May 2, 2022
4c73872
1. Merge branch 'convert_homogentable' into rdd_to_homogenTable
minmingzhu May 7, 2022
8bdd264
update cpp style
minmingzhu May 8, 2022
492d66b
rollback to edb9f3d
minmingzhu May 9, 2022
b97485d
update
minmingzhu May 9, 2022
a3672bd
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
2e922ff
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
0b67419
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
fb55564
update
minmingzhu May 9, 2022
70dcc4c
update
minmingzhu May 9, 2022
6ef11f8
update
minmingzhu May 9, 2022
618d919
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
5506b5b
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
9bb8ffb
rollback to edb9f3d
minmingzhu May 9, 2022
36d8a6d
update
minmingzhu May 9, 2022
76f2d38
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
38bebb6
update
minmingzhu May 9, 2022
be68d67
update
minmingzhu May 9, 2022
aedeb9a
update
minmingzhu May 9, 2022
77cc3ca
fix comments
minmingzhu May 10, 2022
68384a0
update code style
minmingzhu May 10, 2022
16fb7f2
fix comments
minmingzhu May 16, 2022
a49da70
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
5799067
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
35e8e20
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
16b5aca
add empty homogentable
minmingzhu Apr 22, 2022
e674007
update
minmingzhu Apr 23, 2022
4686ab0
update
minmingzhu Apr 28, 2022
a6c5971
update
minmingzhu May 17, 2022
7d1e26d
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
0356328
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
f1325df
add empty homogentable
minmingzhu Apr 22, 2022
ffce21d
update
minmingzhu Apr 23, 2022
8958f33
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
f0bbc83
update
minmingzhu Apr 28, 2022
243bfeb
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
94438c1
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
0991b07
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
f00505b
update
minmingzhu Apr 23, 2022
8bfcc51
update
minmingzhu May 17, 2022
d26925a
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
1c2d9ee
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
152da02
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
e60646e
add empty homogentable
minmingzhu Apr 22, 2022
b8b4127
update
minmingzhu Apr 23, 2022
5395670
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
7c2b5e9
update
minmingzhu Apr 28, 2022
e078fcc
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
0fd4742
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
98bedc5
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
cfa6a50
update
minmingzhu Apr 23, 2022
4f2d09c
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
f3fbd78
update
minmingzhu May 17, 2022
b6c97cc
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
4cf4812
convert rdd to HomogenTable
minmingzhu Apr 18, 2022
0145e1c
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
b3906b8
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
717657e
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
349c4ce
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
6b458d2
add empty homogentable
minmingzhu Apr 22, 2022
080ae51
update
minmingzhu Apr 23, 2022
2bd9a3d
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
f52ba7d
update
minmingzhu May 17, 2022
747fc81
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
eb7ee20
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
b56baa1
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
68d7f5e
rollback to edb9f3d
minmingzhu May 9, 2022
a9c79e0
update
minmingzhu May 9, 2022
dfab242
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
bc078eb
update
minmingzhu May 9, 2022
ccf4cb2
update
minmingzhu May 9, 2022
b65b318
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
027014c
rollback to edb9f3d
minmingzhu May 9, 2022
8d1c489
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
f34cbe3
update
minmingzhu May 9, 2022
72a733d
update
minmingzhu May 9, 2022
c9ada2f
fix comments
minmingzhu May 10, 2022
76ee53c
fix comments
minmingzhu May 16, 2022
ce3b5cd
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
aa2329d
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
e38aa16
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
b339168
add empty homogentable
minmingzhu Apr 22, 2022
5819b52
update
minmingzhu Apr 23, 2022
789403a
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
7ff9cf1
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
2510101
update
minmingzhu Apr 23, 2022
7cd6d54
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
43ad784
1. convert rdd to HomogenTable
minmingzhu Apr 21, 2022
cd2dbc3
update
minmingzhu Apr 23, 2022
45ae0b9
update
minmingzhu May 17, 2022
9bc760a
update code style
minmingzhu May 18, 2022
dc02cd8
update
minmingzhu May 20, 2022
abed70b
update
minmingzhu May 20, 2022
eff37a8
update
minmingzhu May 22, 2022
ff28e5c
fixed comments
minmingzhu May 25, 2022
750ea71
Update HomogenTableImpl.cpp
minmingzhu May 25, 2022
a4339d2
Update GPU.cpp
minmingzhu May 26, 2022
070685e
fix comments
minmingzhu May 27, 2022
b015ad9
update
minmingzhu May 29, 2022
ed31b65
update
minmingzhu May 31, 2022
d2c1f63
update
minmingzhu May 31, 2022
74da916
update
minmingzhu May 31, 2022
15e7685
Merge branch 'dpcpp' into mirgate_kmeans
minmingzhu May 31, 2022
5e010f8
update
minmingzhu May 31, 2022
952d2d1
Update ColumnAccessor.java
minmingzhu May 31, 2022
8910eef
Update ColumnAccessor.java
minmingzhu May 31, 2022
0d44bd8
Update KMeansDALImpl.cpp
minmingzhu May 31, 2022
0d36ae3
update
minmingzhu May 31, 2022
eeba716
update
minmingzhu May 31, 2022
1d2ca32
Merge remote-tracking branch 'origin/mirgate_kmeans' into mirgate_kmeans
minmingzhu May 31, 2022
7057971
update
minmingzhu May 31, 2022
91c0336
Update service.h
minmingzhu Jun 1, 2022
42ade80
Update RowAccessorTest.java
minmingzhu Jun 1, 2022
2f0990b
Update RowAccessorTest.java
minmingzhu Jun 1, 2022
4ca6677
update comments
minmingzhu Jun 6, 2022
2c082cf
Merge remote-tracking branch 'origin/mirgate_kmeans' into mirgate_kmeans
minmingzhu Jun 6, 2022
5c63f4a
Update Communicator.hpp
minmingzhu Jun 6, 2022
9ee65e3
update
minmingzhu Jun 6, 2022
72ec5a0
fix comments
minmingzhu Jun 13, 2022
c12adcb
update
minmingzhu Jun 13, 2022
2192917
update
minmingzhu Jun 13, 2022
627cb7b
Update OneDAL.scala
minmingzhu Jun 13, 2022
b5f6cc3
Update Utils.scala
minmingzhu Jun 13, 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
2 changes: 0 additions & 2 deletions examples/kmeans/run-gpu-standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ 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.KMeansExample

USE_DPU=true
DEVICE=GPU
RESOURCE_FILE=$PWD/IntelGpuResourceFile.json
WORKER_GPU_AMOUNT=4
Expand All @@ -28,7 +27,6 @@ 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.isDPU=$USE_DPU" \
--conf "spark.oap.mllib.device=$DEVICE" \
--conf "spark.worker.resourcesFile=$RESOURCE_FILE" \
--conf "spark.worker.resource.gpu.amount=$WORKER_GPU_AMOUNT" \
Expand Down
2 changes: 2 additions & 0 deletions examples/kmeans/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ source ../../conf/env.sh
# The data file should be copied to $HDFS_ROOT before running examples
DATA_FILE=$HDFS_ROOT/data/sample_kmeans_data.txt

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

Expand All @@ -20,6 +21,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
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ private native int[] cPullInt(long cObject, long cColumnIndex, long cRowStartInd
long cRowEndIndex, int computeDeviceIndex);
private native float[] cPullFloat(long cObject, long cColumnIndex, long cRowStartIndex,
long cRowEndIndex, int computeDeviceIndex);

}
73 changes: 73 additions & 0 deletions mllib-dal/src/main/native/Communicator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*******************************************************************************
* Copyright 2021 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.
*******************************************************************************/

#pragma once

//cpp ccl host communicator
#ifdef ONEDAL_DATA_PARALLEL

#include "oneapi/ccl.hpp"
#include "oneapi/dal/detail/ccl/communicator.hpp"
#include "Singleton.hpp"

namespace de = oneapi::dal::detail;
namespace oneapi::dal::preview::spmd {

namespace backend {
struct ccl {};
} // namespace backend
class ccl_info {
friend class de::singleton<ccl_info>;

private:
ccl_info(int size, int rank_id, const ccl::string &ip_port) {
rank = rank_id;
rank_count = size;
ccl::string ccl_ip_port(ip_port);
auto kvs_attr = ccl::create_kvs_attr();
kvs_attr.set<ccl::kvs_attr_id::ip_port>(ccl_ip_port);
kvs = ccl::create_main_kvs(kvs_attr);
}

public:
ccl::shared_ptr_class<ccl::kvs> kvs;
int rank;
int rank_count;
};

template <typename Backend>
communicator<device_memory_access::none> make_communicator(int size, int rank, const ccl::string &ip_port) {
auto& info = de::singleton<ccl_info>::get(size, rank, ip_port);
// integral cast
return oneapi::dal::detail::ccl_communicator<device_memory_access::none>{ info.kvs,
info.rank,
info.rank_count };
}

template <typename Backend>
communicator<device_memory_access::usm> make_communicator(sycl::queue& queue, int size, int rank, const ccl::string &ip_port) {
auto& info = de::singleton<ccl_info>::get(size, rank, ip_port);
return oneapi::dal::detail::ccl_communicator<device_memory_access::usm>{
queue,
info.kvs,
oneapi::dal::detail::integral_cast<std::int64_t>(info.rank),
oneapi::dal::detail::integral_cast<std::int64_t>(info.rank_count)
};
}

} // namespace oneapi::dal::preview::spmd

#endif
31 changes: 16 additions & 15 deletions mllib-dal/src/main/native/GPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@
#include <unistd.h>

#include "GPU.h"

typedef std::shared_ptr<sycl::queue> queuePtr;

static std::mutex mtx;
static std::vector<sycl::queue> cVector;

static sycl::queue getSyclQueue(const sycl::device device) {
mtx.lock();
if (!cVector.empty()) {
auto device = cVector[0];
mtx.unlock();
return device;
} else {
sycl::queue queue{device};
cVector.push_back(queue);
auto device = cVector[0];
mtx.unlock();
return device;
}
}

static std::vector<sycl::device> get_gpus() {
auto platforms = sycl::platform::get_platforms();
for (auto p : platforms) {
Expand Down Expand Up @@ -82,6 +68,21 @@ sycl::device getAssignedGPU(ccl::communicator &comm, int size, int rankId,
return rank_gpu;
}

static sycl::queue getSyclQueue(const sycl::device device) {
mtx.lock();
if (!cVector.empty()) {
const auto device = cVector[0];
mtx.unlock();
return device;
} else {
sycl::queue queue{device};
cVector.push_back(queue);
const auto device = cVector[0];
mtx.unlock();
return device;
}
}

sycl::queue getQueue(const compute_device device) {
std::cout << "Get Queue" << std::endl;

Expand Down
4 changes: 4 additions & 0 deletions mllib-dal/src/main/native/GPU.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifndef ONEDAL_DATA_PARALLEL
#define ONEDAL_DATA_PARALLEL
#endif

#include "service.h"
#include <CL/cl.h>
#include <CL/sycl.hpp>
Expand Down
Loading