@@ -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 }
0 commit comments