Skip to content

Commit 71cd446

Browse files
committed
save work before merge main squash
1 parent 17c4592 commit 71cd446

File tree

2,625 files changed

+1471885
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,625 files changed

+1471885
-73
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <nvexec/stream_context.cuh>
18+
#include <stdexec/execution.hpp>
19+
20+
#include <cstdio>
21+
22+
namespace ex = stdexec;
23+
24+
int main() {
25+
using nvexec::is_on_gpu;
26+
27+
nvexec::stream_context stream_ctx{};
28+
ex::scheduler auto sch = stream_ctx.get_scheduler();
29+
30+
auto bulk_fn = [](int lbl) {
31+
return [=](int i) {
32+
std::printf("B%d: i = %d\n", lbl, i);
33+
};
34+
};
35+
36+
auto then_fn = [](int lbl) {
37+
return [=] {
38+
std::printf("T%d\n", lbl);
39+
};
40+
};
41+
42+
auto fork = ex::schedule(sch) | ex::then(then_fn(0)) | ex::split();
43+
44+
auto snd = ex::transfer_when_all( //
45+
sch,
46+
fork | ex::bulk(4, bulk_fn(1)),
47+
fork | ex::then(then_fn(1)),
48+
fork | ex::bulk(4, bulk_fn(2)))
49+
| ex::then(then_fn(2));
50+
51+
stdexec::sync_wait(std::move(snd));
52+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <nvexec/stream_context.cuh>
18+
#include <stdexec/execution.hpp>
19+
20+
#include <cstdio>
21+
22+
namespace ex = stdexec;
23+
24+
int main() {
25+
using nvexec::is_on_gpu;
26+
27+
nvexec::stream_context stream_ctx{};
28+
ex::scheduler auto sch = stream_ctx.get_scheduler();
29+
30+
auto bulk_fn = [](int lbl) {
31+
return [=](int i) {
32+
std::printf("B%d: i = %d\n", lbl, i);
33+
};
34+
};
35+
36+
auto then_fn = [](int lbl) {
37+
return [=] {
38+
std::printf("T%d\n", lbl);
39+
};
40+
};
41+
42+
auto fork = ex::schedule(sch) | ex::then(then_fn(0)) | ex::split();
43+
44+
auto snd = ex::transfer_when_all( //
45+
sch,
46+
fork
47+
| ex::bulk(4, bulk_fn(1)),
48+
fork | ex::then(then_fn(1)),
49+
fork | ex::bulk(4, bulk_fn(2)))
50+
| ex::then(then_fn(2));
51+
52+
stdexec::sync_wait(std::move(snd));
53+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <nvexec/stream_context.cuh>
18+
#include <stdexec/execution.hpp>
19+
20+
#include <cstdio>
21+
22+
namespace ex = stdexec;
23+
24+
int main() {
25+
using nvexec::is_on_gpu;
26+
27+
nvexec::stream_context stream_ctx{};
28+
ex::scheduler auto sch = stream_ctx.get_scheduler();
29+
30+
auto bulk_fn = [](int lbl) {
31+
return [=](int i) {
32+
std::printf("B%d: i = %d\n", lbl, i);
33+
};
34+
};
35+
36+
auto then_fn = [](int lbl) {
37+
return [=] {
38+
std::printf("T%d\n", lbl);
39+
};
40+
};
41+
42+
auto fork = ex::schedule(sch) | ex::then(then_fn(0)) | ex::split();
43+
44+
auto snd = ex::transfer_when_all( //
45+
sch,
46+
fork | ex::bulk(4, bulk_fn(1)),
47+
fork | ex::then(then_fn(1)),
48+
fork | ex::bulk(4, bulk_fn(2)))
49+
| ex::then(then_fn(2));
50+
51+
stdexec::sync_wait(std::move(snd));
52+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <nvexec/stream_context.cuh>
18+
#include <stdexec/execution.hpp>
19+
20+
#include <thrust/device_vector.h>
21+
22+
#include <cstdio>
23+
#include <span>
24+
25+
namespace ex = stdexec;
26+
using stdexec::__tag_invoke::tag_invoke;
27+
struct sink_receiver {
28+
using is_receiver = void;
29+
friend void tag_invoke(stdexec::set_value_t, sink_receiver, auto&&...) noexcept {}
30+
friend void tag_invoke(stdexec::set_error_t, sink_receiver, auto&&) noexcept {}
31+
friend void tag_invoke(stdexec::set_stopped_t, sink_receiver) noexcept {}
32+
friend stdexec::empty_env tag_invoke(stdexec::get_env_t, sink_receiver) noexcept { return {}; }
33+
};
34+
// unqualified call to tag_invoke:
35+
int main() {
36+
const int n = 2 * 1024;
37+
thrust::device_vector<float> input(n, 1.0f);
38+
float* first = thrust::raw_pointer_cast(input.data());
39+
float* last = thrust::raw_pointer_cast(input.data()) + input.size();
40+
41+
nvexec::stream_context stream_ctx{};
42+
43+
auto snd = ex::just(std::span{first, last})
44+
| nvexec::reduce(42.0f);
45+
auto [result] =
46+
stdexec::sync_wait(ex::on(stream_ctx.get_scheduler(), std::move(snd))).value();
47+
48+
49+
50+
51+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <nvexec/stream_context.cuh>
18+
#include <stdexec/execution.hpp>
19+
20+
#include <thrust/device_vector.h>
21+
22+
#include <cstdio>
23+
#include <span>
24+
25+
namespace ex = stdexec;
26+
using stdexec::__tag_invoke::tag_invoke;
27+
struct sink_receiver {
28+
using is_receiver = void;
29+
friend void tag_invoke(stdexec::set_value_t, sink_receiver, auto&&...) noexcept {}
30+
friend void tag_invoke(stdexec::set_error_t, sink_receiver, auto&&) noexcept {}
31+
friend void tag_invoke(stdexec::set_stopped_t, sink_receiver) noexcept {}
32+
friend stdexec::empty_env tag_invoke(stdexec::get_env_t, sink_receiver) noexcept { return {}; }
33+
};
34+
// unqualified call to tag_invoke:
35+
int main() {
36+
const int n = 2 * 1024;
37+
thrust::device_vector<float> input(n, 1.0f);
38+
float* first = thrust::raw_pointer_cast(input.data());
39+
float* last = thrust::raw_pointer_cast(input.data()) + input.size();
40+
41+
nvexec::stream_context stream_ctx{};
42+
43+
auto snd = ex::just(std::span{first, last})
44+
| nvexec::reduce(42.0f);
45+
46+
47+
auto [result] =
48+
stdexec::sync_wait(ex::on(stream_ctx.get_scheduler(), std::move(snd))).value();
49+
50+
51+
52+
53+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <nvexec/stream_context.cuh>
18+
#include <stdexec/execution.hpp>
19+
20+
#include <thrust/device_vector.h>
21+
22+
#include <cstdio>
23+
#include <span>
24+
25+
namespace ex = stdexec;
26+
using stdexec::__tag_invoke::tag_invoke;
27+
struct sink_receiver {
28+
using is_receiver = void;
29+
friend void tag_invoke(stdexec::set_value_t, sink_receiver, auto&&...) noexcept {}
30+
friend void tag_invoke(stdexec::set_error_t, sink_receiver, auto&&) noexcept {}
31+
friend void tag_invoke(stdexec::set_stopped_t, sink_receiver) noexcept {}
32+
friend stdexec::empty_env tag_invoke(stdexec::get_env_t, sink_receiver) noexcept { return {}; }
33+
};
34+
// unqualified call to tag_invoke:
35+
int main() {
36+
const int n = 2 * 1024;
37+
thrust::device_vector<float> input(n, 1.0f);
38+
float* first = thrust::raw_pointer_cast(input.data());
39+
float* last = thrust::raw_pointer_cast(input.data()) + input.size();
40+
41+
nvexec::stream_context stream_ctx{};
42+
43+
auto snd = ex::just(std::span{first, last})
44+
| nvexec::reduce(42.0f);
45+
using tag_
46+
47+
auto [result] =
48+
stdexec::sync_wait(ex::on(stream_ctx.get_scheduler(), std::move(snd))).value();
49+
50+
51+
52+
53+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <nvexec/stream_context.cuh>
18+
#include <stdexec/execution.hpp>
19+
20+
#include <thrust/device_vector.h>
21+
22+
#include <cstdio>
23+
#include <span>
24+
25+
namespace ex = stdexec;
26+
using stdexec::__tag_invoke::tag_invoke;
27+
struct sink_receiver {
28+
using is_receiver = void;
29+
friend void tag_invoke(stdexec::set_value_t, sink_receiver, auto&&...) noexcept {}
30+
friend void tag_invoke(stdexec::set_error_t, sink_receiver, auto&&) noexcept {}
31+
friend void tag_invoke(stdexec::set_stopped_t, sink_receiver) noexcept {}
32+
friend stdexec::empty_env tag_invoke(stdexec::get_env_t, sink_receiver) noexcept { return {}; }
33+
};
34+
// unqualified call to tag_invoke:
35+
int main() {
36+
const int n = 2 * 1024;
37+
thrust::device_vector<float> input(n, 1.0f);
38+
float* first = thrust::raw_pointer_cast(input.data());
39+
float* last = thrust::raw_pointer_cast(input.data()) + input.size();
40+
41+
nvexec::stream_context stream_ctx{};
42+
43+
auto snd = ex::just(std::span{first, last})
44+
| nvexec::reduce(42.0f);
45+
using stdexec::__tag_invoke::tag_invoke;
46+
tag_invoke(stdexec::get_completion_signatures, my-sender, the-environment);
47+
auto [result] =
48+
stdexec::sync_wait(ex::on(stream_ctx.get_scheduler(), std::move(snd))).value();
49+
50+
51+
52+
53+
}

0 commit comments

Comments
 (0)