C++高性能并行编程与优化 - 课件 - 10 从稀疏数据结构到量化数据类型
org/linalg/html_templates/node91.html 第 1 章:稀疏网格 稠密网格计算粒子经过的格点数量 改用更小的 char 存储 只用一个 bit 存储,一个 char 可以存储 8 个 bit 用 map 来存储 读取:如果不存在,则读到 0 写入:如果不存在,则创建该表项 用 unordered_map 来存储 map 基于红黑树,会按照键值排序,需要键值具有 然而我们这里是 要用他记录粒子 经过的点,因此 具有一定空间局 域性,能够被分 块优化。 实际上空间局域 性正是稀疏网格 能够实现的一大 前提,稍后详细 讨论。 在 16x16 分块的基础上,只用一个 bit 存储 图片解释稀疏的好处 传统稠密二维数组 无边界稀疏分块哈希表 有了无边界的稀疏网格,再也不用担心二维数组要分配多大了。 坐标可以无限延伸,甚至可以是负数!比如 (-1,2) 等…… 他会自动在写入时分配 因此如果你的程序不需要那么高精度,可以考虑 用小点的数据类型。 8 个 bit 合并进一个 int8_t :每个占据 1/8 字节 • 考虑到我们的 i % 2 只可能是 0 和 1 ,也就是 实际只占据了 1bit ,而如果用 int8_t 存储是 1 字 节也就是 8bit 了。 • 因此还可以进一步优化,让八个 bit 占据同一个 字节。 • 不过计算起来比较复杂,需要很多位运算。0 码力 | 102 页 | 9.50 MB | 1 年前3C++20: An (Almost) Complete Overview
Directive Text Formatting Math Constants std::source_location [[nodiscard(reason)]] Bit Operations Small Standard Library Additions5 Agenda New keywords: concept requires the return value will result in memory leaks.")]] void* GetData() { /* ... */ }80 Bit Operations Header <bit> Set of global non-member functions to operate on bits Rotate: rotl(), rotr() significant bit countl_one(): number of consecutive 1 bits starting from most significant bit countr_zero(): number of consecutive 0 bits starting from least significant bit countr_one():0 码力 | 85 页 | 512.18 KB | 5 月前3No Silver Bullet – Essence and Accident in Software Engineering
software systems • The system should first be made to run, even though it does nothing useful • Bit-by-bit it is fleshed out • The morale effects are startling • Enthusiasm jumps when there is a running problem? • Or am I just shaving a yak?Brook’s Advice • The system should first be made to run • Bit-by-bit it is fleshed out • One always has, at every stage in the process, a working system • Enthusiasm0 码力 | 35 页 | 1.43 MB | 5 月前3whats new in visual studio
CppCon 2021 CppCon 2021 What’s New In ‘ Visual Studio 64-bit IDE, C++20, WSL2, and More Marian Luparu (he/him) @mluparu Sy Brand (they/them) @TartanLlama C++ Product Team, Microsoft @VisualC https://aka Cross-platform development 4. Developer and Team Productivity New in Visual Studio 2022 • 64bit IDE • New themes available https://aka.ms/vsthemes • Or bring your own VSCode theme to VS • Color-coded Representations of C++ – Gabriel Dos Reis (online 27th) Wednesday 27th • What's New in Visual Studio: 64-bit IDE, C++20, WSL 2, and more – Sy Brand & Marian Luparu Thursday 28th • C++20’sCalendars 0 码力 | 42 页 | 19.02 MB | 5 月前3C++20 STL Features: 1 Year of Development on GitHub
Features, Including: • atomic>, atomic > • GH-601 by AdamBucior • <bit> (bit_cast, rotating/counting, power-of-2) • Several PRs by barcharcraz • make_shared() For Arrays 0 码力 | 45 页 | 702.09 KB | 5 月前3C++高性能并行编程与优化 - 课件 - 12 从计算机组成原理看 C 语言指针
*)malloc(size); • 如果你没看出来(哪怕是其中一个),那就要好好上小彭老师的课哦! 字节( byte ) 和位( bit )有什么区别 • 众所周知,计算机是二进制的,存储的实际上是一个个 0 和 1 。 • 每个存储 0 或 1 的空间称为一个位( bit ),一位可以存储 0 或 1 两个可能的值。 • 现在的计算机都会把 8 个位打包成一个字节( byte ),也就是说: 10 码力 | 128 页 | 2.95 MB | 1 年前3Finding Bugs using Path-Sensitive Static Analysis
pattern Matching using `is` and `as – Herb Sutter Wednesday 27th • What's New in Visual Studio: 64-bit IDE, C++20, WSL 2, and more – Sy Brand & Marian Luparu Thursday 28th • C++20’sCalendars 0 码力 | 35 页 | 14.13 MB | 5 月前3C++20's
pattern Matching using `is` and `as – Herb Sutter Wednesday 27th • What's New in Visual Studio: 64-bit IDE, C++20, WSL 2, and more – Sy Brand & Marian Luparu Thursday 28th • C++20’sCalendars 0 码力 | 55 页 | 8.67 MB | 5 月前3C++23: An Overview of Almost All New and Updated Features
Heterogeneous Erasure Removed Features Garbage Collection Support97 std::byteswap() Defined in <bit> Standard way to swap bytes of integral types E.g.: std::uint32_t a{ 0x12345678u }; std::println("{:x}"0 码力 | 105 页 | 759.96 KB | 5 月前3C++高性能并行编程与优化 - 课件 - 08 CUDA 开启的 GPU 编程
atomicCAS 实 现了! atomicCAS :可以实现任意原子操作 • 据悉,一些老版本 CUDA 的 atomicAdd 是不支持 float 类型的,可以用 CAS 配 合按位转换( bit-cast )的函数 __float_as_int 和 __int_as_float 来实现 浮点原子加法。 • 当然我们 CUDA 11 的 atomicAdd 本身 就支持 float0 码力 | 142 页 | 13.52 MB | 1 年前3
共 10 条
- 1