forked from oneapi-src/distributed-ranges-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample1.cpp
More file actions
32 lines (22 loc) · 674 Bytes
/
example1.cpp
File metadata and controls
32 lines (22 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-FileCopyrightText: Intel Corporation
//
// SPDX-License-Identifier: BSD-3-Clause
#include <dr/mhp.hpp>
#include <fmt/core.h>
namespace mhp = dr::mhp;
int main(int argc, char **argv) {
mhp::init(sycl::default_selector_v);
mhp::distributed_vector<char> dv(81);
std::string decoded_string(80, 0);
mhp::copy(
0,
std::string("Mjqqt%|twqi&%Ymnx%nx%ywfsxrnxnts%kwtr%ymj%tsj%fsi%tsq~%"
"Inxywngzyji%Wfsljx%wjfqr&"),
dv.begin());
mhp::for_each(dv, [](char &val) { val -= 5; });
mhp::copy(0, dv, decoded_string.begin());
if (mhp::rank() == 0)
fmt::print("{}\n", decoded_string);
mhp::finalize();
return 0;
}