C++高性能并行编程与优化 - 课件 - 11 现代 CMake 进阶指南
PROJECT_NAME :当前项目名 • CMAKE_PROJECT_NAME :根项目的项目名 • 详见: https://cmake.org/cmake/help/latest/command/project.html 子模块里也可以用 project 命令,将当前目录作为一个独立的子项目 这样一来 PROJECT_SOURCE_DIR 就会是子模块的源码目录而不是外层了。 这时候 CMake 会认为这个子 3.18 版本新增) • 如果不指定 LANGUAGES ,默认为 C 和 CXX 。 https://cmake.org/cmake/help/latest/command/project.html 常见问题: LANGUAGES 中没有启用 C 语言,但是却用到了 C 语言 解决:改成 project( 项目名 LANGUAGES C CXX) 即可 也可以先设置 LANGUAGES 和 ON 等价, FALSE 和 OFF 等价; YES 和 ON 等价, NO 和 OFF 等价。 https://www.cnblogs.com/Braveliu/p/15614013.html 案例:添加一个 BOOL 类型的缓存变量,用于控制要不要启用某特性 CMake 对 BOOL 类型缓存的 set 指令提供了一个简写: option option( 变量名 “描述” 变量值0 码力 | 166 页 | 6.54 MB | 1 年前3CeresDB Rust 生产实践 任春韶
https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#why-pinning https://doc.rust-lang.org/beta/unstable-book/language-features/generators.html 生产实践 – Async lock Req0 Req1 Req2 Memory cache https://docs https://docs.rs/tokio/1.28.2/tokio/sync/ struct.Mutex.html#which-kind-of-mutex-should-you-use 生产实践 – Async lock runtime.spawn(task0) runtime.spawn(task1) runtime.spawn(task2) 生产实践 – Async lock runtime Cancellation try_join_all!(a,b,c…) https://docs.rs/futures/latest/futures/future/fn.try_join_all.html 生产实践 – Cancellation try_join_all!(a,b,c…) join_all!(a,b,c…) https://github.com/tokio-rs/tokio/issues/24010 码力 | 22 页 | 6.95 MB | 1 年前3THE FIRST EXPLORATION OF PROJECT SPARROW
Microkernel and Monolithic Kernel: Source: https://www.guru99.com/microkernel-in-operating-systems.html I. Background . Source: https://os.inf.tu-dresden.de/Studium/MkK//SS2021/01_intro.pdf https://docs.sel4.systems/projects/sel4/status.html Mathematical Proof Source: https://sel4.systems/About/seL4-whitepaper.pdf I. Background com/lowRISC/opentitan Workflow Source: https://opentitan.org/guides/getting_started/index.html 1.5 Renode Overview I. Background https://renode.io/ Antmicro's virtual0 码力 | 68 页 | 13.14 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 10 从稀疏数据结构到量化数据类型
Row Storage ) http://www.netlib.org/linalg/html_templates/node91.html 按行压缩( Compressed Row Storage ) http://www.netlib.org/linalg/html_templates/node91.html 第 1 章:稀疏网格 稠密网格计算粒子经过的格点数量 改用更小的 char 存储 位(图 1 )。 • 双精度浮点数 float 的底数有 52 位,指数有 11 位(图 2 )。 double: float: http://c.biancheng.net/view/314.html 以求最大值为案例 用定点数来表示 • 刚刚说到浮点数的特性是有指数位,可表示不同数量级上的数。 • 比如 123.4 实际上是 1.234 * 10^2 ,也就是他实际存储的是 2340 码力 | 102 页 | 9.50 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 16 现代 CMake 模块化项目管理指南
src ,则是基于定义者所在路径。 https://cmake.org/cmake/help/latest/command/function.html https://cmake.org/cmake/help/latest/command/macro.html include 和 add_subdirectory 的区别 • include 相当于直接把代码粘贴过去,直接访问调用者的作用域。这里创建的变量和外面共 [OPTIONAL_COMPONENTS components...] • ) https://cmake.org/cmake/help/latest/command/find_package.html find_package 命令用法举例 • find_package(OpenCV) • 查找名为 OpenCV 的包,找不到不报错,事后可以通过 ${OpenCV_FOUND} 查询是否找到。 比较版本号时,可以用 if (${XXX_VERSION} VERSION_LESS 3.1.0) 判断大小。 https://cmake.org/cmake/help/latest/command/if.html find_package 命令指定版本 • find_package(OpenCV REQUIRED) • 查找名为 OpenCV 的包,不限版本,事后可以通过 ${OpenCV_VERSION}0 码力 | 56 页 | 6.87 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 08 CUDA 开启的 GPU 编程
行时检测到的版本。编译器默认就是最老 的 52 ,能兼容所有 GTX900 以上显卡。 https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#extended-notation 针对不同的架构,使用不同的代码 通过 CMake 设置架构版本号 • 可以用 CMAKE_CUDA_ARCHITECTURES 这个变量 ,设置要针对哪个架构生成 fmodf , fabsf , fminf , fmax f 。 https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#math-libraries 稍微快一些,但不完全精确的 __sinf • 两个下划线的 __sinf 是 GPU intrinstics ,精度相当于 GLSL 里的那种。 适合对精度要求不高,但有性能要求的图 会在统一内存上分配, 因此不论 GPU 还是 CPU 都可以直接访 问到。 http://cs.boisestate.edu/~alark/thrust_intro/presentation.html 换成分离的 device_vector 和 host_vector • 而 device_vector 则是在 GPU 上分配 内存, host_vector 在 CPU 上分配内 存。0 码力 | 142 页 | 13.52 MB | 1 年前3Bringing Existing Code to CUDA Using constexpr and std::pmr
device, • Callable from the device only. https://docs.nvidia.com/cuda/cuda-c-programming-guide/ index.html#function-declaration-specifiers 36 |The __host__ execution space specifier declares a function that function is compiled for the host only. https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#host Execution Space Specifiers 37 |__host__ __device__ void _add(std::size_t n, float const* x change in future compiler releases. https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/ index.html#options-for-altering-compiler-linker-behavior-expt-relaxed- constexpr Using constexpr 40 |constexpr0 码力 | 51 页 | 3.68 MB | 5 月前3C++高性能并行编程与优化 - 课件 - Zeno 中的现代 C++ 最佳实践
std::string 和 std::vector等价(留做回家作业)。 • https://www.boost.org/doc/libs/1_55_0/doc/html/ boost_typeerasure.html 类型擦除利用的是 C++ 模板的惰性实例化, Java 的泛型是做不到滴 • 由于 C++ 模板惰性编译的特性,这个擦除掉的表达式会在你实例化 AnimalWrapper 0 码力 | 54 页 | 3.94 MB | 1 年前3绕过conntrack,使用eBPF增强 IPVS优化K8s网络性能
about TKE https://cloud.tencent.com/product/tke • Jobs https://careers.tencent.com/home.html Bugs solved – 1/2 • IPVS conn_reuse_mode=1 low cps Ip_vs_conn nf_conn New ip_vs_conn Bugs solved0 码力 | 24 页 | 1.90 MB | 1 年前3基于Rust-vmm实现Kubernetes运行时
com/product/tke https://github.com/tkestack/tke • Join us https://careers.tencent.com/home.html0 码力 | 27 页 | 34.17 MB | 1 年前3
共 17 条
- 1
- 2