Working with Asynchrony Generically: A Tour of C++ Executors
concurrent operation 5. Implementing a simple algorithm 6. Senders and coroutines Part 2: 1. Structured concurrency 2. Cancellation 3. An extended example3 GOALS FOR THE EXECUTORS PROPOSAL The vision: whether to use coroutines or not in the hands of the caller.51 COMING UP IN THE NEXT HOUR: Structured concurrency Cancellation support in sender/receiver Extended example: Sender/receiver and ranges52 coroutines55 WHAT’S COMING IN PART 2 1. Structured concurrency 2. Cancellation support in the sender/receiver abstraction 3. An extended example56 Structured concurrency57 IN THE BEGINNING … WAS GOTO0 码力 | 121 页 | 7.73 MB | 5 月前3Rust 异步并发框架在移动端的应用 - 陈明煜
任务窃取 Fusion of IO/CPU intensive 结构化并发 Structured Concurrency 核心在于通过一种父子结构化的方法实现并发程序,用具有明确入口点和出口 点的控制流结构来封装并发任务(可以是线程也可以是协程)的执行,确保所有派生任务在出口之前完 成。 Structured concurrency 结构化并发带来的好处: 更高的易用性,用户不再需要显示调用 更高的易用性,用户不再需要显示调用 await 提高程序的可读性和可维护性 保证了变量生命周期合法,使子任务可以捕获父任务的变量 结构化并发 Structured concurrency Scope Rust 线程中的结构化并发 阻塞等待所有 Scope 内的子线程任务完成 子线程执行的闭包中可以捕获 Scope 外的变 量 AsyncScope 将 std 库中 thread scope0 码力 | 25 页 | 1.64 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 17 由浅入深学习 map 容器
second); } • 答案是同属于 C++17 的 structural-binding 语法糖,他和 range-based loop 可以配合着 用。 • for (auto [k, v]: m) { • print(k, v); } • auto [k, v] 这个就是 structural-binding ,我们第三课讲 tuple 时就介绍过了。 • 本来是要再写一行 auto 开恩,允许两个语法糖一起 用, C++ 之父他真的我哭死。 不客气,小彭老师 不客气,小彭老师 map 的遍历:用 C++17 range-based loop 配合 structural- binding • 我们现在遍历一个 map ,然后把他里面所有的 V 都设为 v2 ,要怎么做? • for (auto [k, v]: m) { • v = v2; } • 这样吗?不行! [k 因为只有指针是浅拷贝的,是可以远程修改另一个对象的。 • 这里说的指针,不光是 T * 指针,还包括 T & 引用, iterator 迭代器,他们都是指针的 变体。 • 而 structural-binding 和 range-based loop 语法支持引用,也非常简单: • for (auto &[k, v]: m) { • v = v2; // 引用比指针还方便,自动解引用。此处等价于迭代器版的0 码力 | 90 页 | 8.76 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 07 深入浅出访存优化
• 插桩这个操作,就是说在结构网格中,从一个点往周围固定范围读取值, 并根据一定权重累加,然后用于修改自身的值。 • 比如求一个场的梯度、散度、旋度、拉普拉斯。如果场是用结构网格 ( structured grid )表示,那就是一个插桩操作。 • 插桩的内核( kernel )指的就是这个“周围范围”的形状(如右图三个例子) 和每个地方读取到值对修改自身值的权重等信息。 • 个人认为 organized that allows the CPU’s to process the data, without having to wait. If the data is not structured in a cache friendly way, the CPU will have to wait. What if the application needs fast access0 码力 | 147 页 | 18.88 MB | 1 年前3陈东 - 利用Rust重塑移动应用开发-230618
Photo / image / chart RCC_Android 利用 Rust 重塑移动应用开发 - RCC_Andorid is an rust library which is to binding Rust code into Android application. - Use the crate rifgen, flapigen to generate the java interface independent android library RCC_IOS 利用 Rust 重塑移动应用开发 - RCC_IOS is an rust library which is to binding Rust code into IOS application. - Use the crate lipo to generate the staticlib for ios application0 码力 | 22 页 | 2.10 MB | 1 年前3C++20: An (Almost) Complete Overview
into module interface files and module implementation files is possible but not needed Can be structured with submodules and module partitions No need for include guards No need to invent unique0 码力 | 85 页 | 512.18 KB | 5 月前3C++高性能并行编程与优化 - 课件 - 14 C++ 标准库系列课 - 你所不知道的 set 容器
• iterator first; • bool second; • }; 使用 C++17 的结构化绑定来拆解 pair • C++17 提供了结构化绑定 (structual binding) 的语法, 可以取出一个 POD 结构体 的所有成员, pair 也不例外 。 • auto [ok, it] = b.insert(3); • 等价于 • auto tmp = b.insert(3);0 码力 | 83 页 | 10.23 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 08 CUDA 开启的 GPU 编程
个元素……之所以他搞这么复杂,其实是因为 thrust 需要兼容一些“老年 程序”爱用的 C++03 ,不然早该换成 C++11 的 std::tuple 和 C++17 的 structual-binding 语法了……反正我是不喜欢用他的迭代器这一套,简单的问题反而复杂化。 • 怪不得王鑫磊在 ZPC 里要自己造轮子哦,虽然是 C++03 ,总感觉是几百年前的编程语言。 • 现在很多“老年”教材对0 码力 | 142 页 | 13.52 MB | 1 年前3
共 8 条
- 1