Skip to content

Commit 2198ac0

Browse files
authored
oneCCL: corrections for error_handling and generic_workflow pages (#250)
1 parent 35fda27 commit 2198ac0

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

source/elements/oneCCL/source/spec/error_handling.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ Common exceptions
2929
".. _oneccl_exception:
3030

3131
``ccl::exception``", "Reports general unspecified error"
32-
".. _oneccl_exception_unsupported_device:
32+
".. _oneccl_exception_invalid_argument:
3333

34-
``ccl::unsupported_device``", "Reports an error when the operation is not supported on a specific device"
34+
``ccl::invalid_argument``", "Reports an error when arguments to the operation were rejected"
3535
".. _oneccl_exception_host_bad_alloc:
3636

3737
``ccl::host_bad_alloc``", "Reports an error that occurred during memory allocation on the host"
@@ -40,7 +40,7 @@ Common exceptions
4040
``ccl::device_bad_alloc``", "Reports an error that occurred during memory allocation on a specific device"
4141
".. _oneccl_exception_unimplemented:
4242

43-
``ccl::unimplemented``", "Reports an error when an algorithm or a method is not implemented"
44-
".. _oneccl_exception_invalid_argument:
43+
``ccl::unimplemented``", "Reports an error when the requested operation is not implemented"
44+
".. _oneccl_exception_unsupported:
4545

46-
``ccl::invalid_argument``", "Reports an error when arguments to the operation were rejected"
46+
``ccl::unsupported``", "Reports an error when the requested operation is not supported"

source/elements/oneCCL/source/spec/generic_workflow.rst

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ using an out-of-band communication mechanism and be used to create key-value sto
1313

1414
.. code:: cpp
1515
16+
using namespace std;
17+
1618
/* for example use MPI as an out-of-band communication mechanism */
1719
1820
int mpi_rank, mpi_size;
@@ -21,29 +23,29 @@ using an out-of-band communication mechanism and be used to create key-value sto
2123
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
2224
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
2325
24-
kvs_interface kvs;
25-
kvs::address_type kvs_addr;
26+
ccl::shared_ptr_class<ccl::kvs> kvs;
27+
ccl::kvs::address_type kvs_addr;
2628
2729
if (mpi_rank == 0) {
2830
kvs = ccl::create_main_kvs();
2931
kvs_addr = kvs->get_address();
30-
MPI_Bcast((void*)kvs_addr.data(), kvs::address_max_size, MPI_BYTE, 0, MPI_COMM_WORLD);
32+
MPI_Bcast((void*)kvs_addr.data(), ccl::kvs::address_max_size, MPI_BYTE, 0, MPI_COMM_WORLD);
3133
}
3234
else {
33-
MPI_Bcast((void*)kvs_addr.data(), kvs::address_max_size, MPI_BYTE, 0, MPI_COMM_WORLD);
35+
MPI_Bcast((void*)kvs_addr.data(), ccl::kvs::address_max_size, MPI_BYTE, 0, MPI_COMM_WORLD);
3436
kvs = ccl::create_kvs(kvs_addr);
3537
}
3638
3739
2. Create communicator(s):
3840

3941
.. code:: cpp
4042
41-
/* for host communications */
43+
/* host communications */
4244
auto comm = ccl::create_communicator(mpi_size, mpi_rank, kvs);
4345
4446
.. code:: cpp
4547
46-
/* for SYCL devices communications, for example with multiple devices per process */
48+
/* SYCL devices communications, for example with multiple devices per process */
4749
4850
/* sycl_context -> cl::sycl::context */
4951
/* sycl_devices -> vector<cl::sycl::device> */
@@ -53,18 +55,19 @@ using an out-of-band communication mechanism and be used to create key-value sto
5355
auto ccl_context = ccl::create_context(sycl_context);
5456
5557
/* create ccl::device objects from cl::sycl::device objects */
56-
std::vector<device> ccl_devices;
58+
vector<ccl::device> ccl_devices;
5759
for (size_t idx = 0; idx < sycl_devices.size(); idx++) {
5860
ccl_devices.push_back(ccl::create_device(sycl_devices[idx]));
5961
}
6062
61-
std::vector<std::pair<size_t, device>> r2d_map;
63+
map<size_t, ccl::device> r2d_map;
6264
for (auto& dev : ccl_devices) {
63-
r2d_map.push_back(<rank>, dev);
65+
size_t rank = /* generate a globally unique rank for a specific device */
66+
r2d_map[rank] = dev;
6467
}
6568
6669
/* create ccl::stream objects from cl::sycl::queue objects */
67-
std::vector<stream> ccl_streams;
70+
vector<ccl::stream> ccl_streams;
6871
for (size_t idx = 0; idx < sycl_queues.size(); idx++) {
6972
ccl_streams.push_back(ccl::create_stream(sycl_queues[idx]));
7073
}
@@ -78,13 +81,13 @@ using an out-of-band communication mechanism and be used to create key-value sto
7881

7982
.. code:: cpp
8083
81-
/* for host communications */
84+
/* host communications */
8285
allreduce(..., comm).wait();
8386
8487
.. code:: cpp
8588
86-
/* for SYCL devices communications */
87-
std::vector<event> events;
89+
/* SYCL devices communications */
90+
vector<ccl::event> events;
8891
for (auto& comm : comms) {
8992
events.push_back(allreduce(..., comm, ccl_streams[comm.rank()]));
9093
}

source/elements/oneCCL/source/spec/main_objects.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,21 @@ and be used to create key-value stores on other ranks:
180180

181181
.. code:: cpp
182182
183-
kvs ccl::create_main_kvs() const;
183+
shared_ptr_class<kvs> ccl::create_main_kvs() const;
184184
185-
return ``kvs``
185+
return ``shared_ptr_class<kvs>``
186186
the main key-value store object
187187

188188

189189
Creating a new key-value store from main kvs address:
190190

191191
.. code:: cpp
192192
193-
kvs ccl::create_kvs(const kvs::address_type& addr) const;
193+
shared_ptr_class<kvs> ccl::create_kvs(const kvs::address_type& addr) const;
194194
195195
addr
196196
the address of the main kvs
197-
return ``kvs``
197+
return ``shared_ptr_class<kvs>``
198198
key-value store object
199199

200200

0 commit comments

Comments
 (0)