Back to Basics Castinginit code } Turns INVALID_SIZE into a very large number ## “In all cases, it would be better if the cast - new or old - could be eliminated” ## —Bjarne Stroustrup The Design and Evolution of C++ Why do si; int i = si; ## Explicit Type Conversions #### Explicit Type Conversions a.k.a Casts ## C-style cast ## ()var 1. Create a temporary of using var 2. can be any valid type with qualifiers = (A*)&f; B* pb = (B*)pa; double d = *(double*)(pb); return (int)d; } ## C-style cast 1. Create a temporary of using var 2. can be any valid type with qualifiers 3. Overrides 0 码力 | 117 页 | 1.57 MB | 1 年前3
C++ Exceptions for Smaller FirmwareTables Run Time Type Info (RTTI) Exception Code TIME Nondeterministic Type Comparison (dynamic\_cast)  ## Slow Binary std::expected ### After 2.5 years, what did the students think? ## I F/ELSE everywhere! Just (void) cast away the problems! void blink_led( output_pin& p_pin, milliseconds p_transition_time) Tables Run Time Type Info (RTTI) Exception Code TIME Nondeterministic Type Comparison (dynamic_cast) 🙏 😄 ## Slow Binary Search Frame Unwinding Frame Evaluation Most accepted it... Some asked0 码力 | 237 页 | 6.74 MB | 1 年前3
Dynamic Model in TVM0 码力 | 24 页 | 417.46 KB | 1 年前3
Dynamically Loaded Libraries Outside the Standard0 码力 | 100 页 | 3.98 MB | 1 年前3
Julia 1.7.0 DEV DocumentationJulia GC. • Array{T,N} When an array is passed to C as a Ptr\{T\} argument, it is not reinterpret-cast: Julia requires that the element type of the array matches T, and the address of the first element convert_julia_type can transform between any two types. It returns an R-value with cgval.typ set to typ. It'll cast the object to the requested representation, making heap boxes, allocating stack copies, and computing GC rooting. By our above invariants, this function is illegal, because it performs an address space cast from 10 to 0. However, it can be useful, in certain situations, so we provide a special intrinsic:0 码力 | 1399 页 | 4.59 MB | 2 年前3
Julia 1.12.0 DEV DocumentationJulia GC. ## • Array{T,N} When an array is passed to C as a Ptr\{T\} argument, it is not reinterpret-cast: Julia requires that the element type of the array matches T, and the address of the first element Arrays If a Julia function returns an array, the return value of jl_eval_string and jl_call can be cast to a jl_array_t*: jl_function_t *func = jl_get_function(jl_base_module, "reverse"); jl_array_t convert_julia_type can transform between any two types. It returns an R-value with cgval.typ set to typ. It'll cast the object to the requested representation, making heap boxes, allocating stack copies, and computing0 码力 | 2009 页 | 6.72 MB | 2 年前3
4 【王琼】容器监控架构演进 王琼 YY直播
监控维度更多,除了传统物理集群的监控,还包括核心服务监控(API server,Etcd等)、容器监控、Pod监控、Namespace监控等 ● 监控对象动态可变,在集群中容器的销毁创建十分频繁,无法提前预置 监控指标随着容器规模爆炸式增长,如何处理及展示大量监控数据 随着集群动态增长,监控系统必须具备动态扩缩的能力 ## 监控遇上 Kubernetes 目前容器云平台提供的k8s集群包括: 10+集群(云+物理机房+边缘) resource_requests_memory:label_biz_type ## Thanos + Kvass ## Kvass是一个Prometheus横向扩缩容解决方案 他使用Sidecar动态得根据Coordinator分配下来的target列表来为每个Prometheus生成只含特定target的配置文件,从而将采集任务分散到各个Prometheus分片。 Coordinator用于 et的时候,会根据target的实际规模来,而不是通过hashmod来,所以每个分片的总负载会被控制在一个阈值以下,不会出现某个分片OOM的情况。 ● 自动扩缩容:Kvass会根据当前集群的规模,动态调整分片个数  ## Thanos +0 码力 | 23 页 | 2.17 MB | 2 年前3
Hello 算法 1.0.0 Golang版第13章 回溯 13.1 回溯算法 13.2 全排列问题 13.3 子集和问题 13.4 n 皇后问题 13.5 小结 第14章 动态规划 14.1 初探动态规划 14.2 动态规划问题特性 14.3 动态规划解题思路 14.4 0-1 背包问题 14.5 完全背包问题 14.6 编辑距离问题 14.7 小结 第 15 章 贪心 15.1 贪心算法 等。 数据结构:基本数据类型和数据结构的分类方法。数组、链表、栈、队列、哈希表、树、堆、图等数据结构的定义、优缺点、常用操作、常见类型、典型应用、实现方法等。 · 算法:搜索、排序、分治、回溯、动态规划、贪心等算法的定义、优缺点、效率、应用场景、解题步骤和示例问题等。  图 2-6 斐波那契数列的递归树 从本质上看,递归体现了“将问题分解为更小子问题”的思维范式,这种分治策略至关重要。 从算法角度看,搜索、排序、回溯、分治、动态规划等许多重要算法策略直接或间接地应用了这种思维方式。 从数据结构角度看,递归天然适合处理链表、树和图的相关问题,因为它们非常适合用分治思想进行分析。 #### 2.2.3 两者对比 总结以上内容,如表0 码力 | 382 页 | 17.60 MB | 2 年前3
C++高性能并行编程与优化 - 课件 - 08 CUDA 开启的 GPU 编程进一步:核函数调用核函数 从 Keller 架构开始,___global___ 里可以调用另一个 ___global___,也就是说核函数可以调用另一个核函数,且其三重尖括号里的板块数和线程数可以动态指定,无需先传回到 CPU 再进行调用,这是 CUDA 特有的能力 kernel: Thread 0 of 3 kernel: Thread 1 of 3 kernel: Thread 2 of of 5 another: Thread 3 of 5 another: Thread 4 of 5 常用于这种情况:需要从 GPU 端动态计算出 blockDim 和 gridDim,而又不希望导回数据到 CPU 导致强制同步影响性能。这种模式被称为动态并行(dynamic parallelism),OpenGL 有一个 glDispatchComputeIndirect 的 API 和这个很像,但毕竟没有 65532 arr[65533]: 65533 arr[65534]: 65534 ## 网格跨步循环:应用于线程和板块一起上的情况 - 网格跨步循环实际上本来是这样,利用扁平化的线程数量和线程编号实现动态大小。 - 同样,无论调用者指定每个板块多少线程(blockDim),总共多少板块(gridDim)。都能自动根据给定的 n 区间循环,不会越界,也不会漏掉几个元素。 - 这样一个 for 循环非常符合0 码力 | 142 页 | 13.52 MB | 2 年前3
全球架构师峰会2019北京/大数据/Kubernetes 运行大数据工作负载的探索和实践&mdash0 码力 | 25 页 | 3.84 MB | 2 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100













