Posts
2022
levelDB 代码阅读笔记 04 filter
FilterPolicy接口 # 1 2class LEVELDB_EXPORT FilterPolicy { 3 public: 4 virtual ~FilterPolicy(); 5 6 // Return the name of this policy. Note that if the filter encoding 7 // changes in an incompatible way, the name returned by this method 8 // must be changed. Otherwise, old incompatible filters may be 9 // passed to methods of this type. 10 virtual const char* Name() const = 0; 11 12 // keys[0,n-1] contains a list of keys (potentially with duplicates) 13 // that are ordered according to the user supplied comparator. 14 // Append a filter that summarizes keys[0,n-1] to *dst. 15 // 16 // Warning: do not change the initial contents of *dst. Instead, 17 // append the newly constructed filter to *dst. 18 virtual void CreateFilter(const Slice* keys, int n, 19 std::string* dst) const = 0; 20 21 // "filter" contains the data appended by a preceding call to 22 // CreateFilter() on this class. This method must return true if 23 // the key was in the list of keys passed to CreateFilter(). 24 // This method may return true or false if the key was not on the 25 // list, but it should aim to return false with a high probability. 26 virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; 27}; 其中CreateFilter的含义是从n个key生成一个 std::string. 生成的std::string可以包含n个key的信息(类似于生成了一个全集) 从而后续判断某个key是否在其中。
levelDB 代码阅读笔记 02 comparator
levelDB是一个有序的KV存储,因此key的顺序是十分关键的 levelDB提供用户自己定义key顺序的能力
levelDB 代码阅读笔记 01 db.h
背景 # 最近在做一个智能算力相关的项目,类似美团外卖广告智能算力的探索与实践 其中实现控制系统需要与数据库交互。 虽然最后技术选型并没有使用到levelDB,但是想趁机把代码读了吧。
2021
ska::flat_hash_map 源码分析
围绕 Robin Hood Hashing、探测距离和存储布局,拆解 ska::flat_hash_map 的实现思路。
一次 AVX2 在 GCC 4 上 Core Dump 的排查经历
从最小复现、指令集与 ABI 差异入手,定位旧版 GCC 环境中的 AVX2 崩溃问题。
[施工完成] CSAPP shell lab
背景 # 动手实现一个简单的Lab,主要依赖于课本第八章的内容 感觉主要是05比较难。。发现执行的顺序不太对。。原因是SIGCHLD里面waitpid参数没写对。。 后面的就相对简单了 累计大概花了10个小时的样子
Reverse-Mode Automatic Differentiation
从数值微分与符号微分出发,解释反向模式自动微分及其计算图实现。
【推荐系统】Toward the Next Generation of Recommender Systems: A Survey of the State-of-the-Art and Possible Extensions
·5 mins
迫于生计,从今天开始学习推荐系统相关的内容,今天先来读一篇推荐系统领域的综述 Toward the next generation of recommender systems: a survey of the state-of-the-art and possible extensions
使用github actions来部署 github pages
目前我的博客是部署在github pages上,源码是一个repo,渲染出来的静态页面是一个repo. 更新的时候是把后者作为前者的submodule. 感觉这种方式有些落后了,简直和某司内部的平台有的一比。因此尝试采用了下github actions,来自动化这个部署的流程。
2020
[施工完成] CSAPP Cachelab
背景 # CSAPP:3e 的配套实验 地址 分成了两个部分,第一部分是模拟一下cache的miss,hit,evict的规则。第二部分是优化一个矩阵的转置,使得miss尽可能少。
【施工中】torch2trt 学习笔记
·2 mins
前言 # 偶然发现了 torch2trt 的模型转换方案,思路是直接将pytorch op映射到TensorRT的python api. 在pytorch进行每个op forward的时候,tensorrt也相应往network上添加op. 这里会先涉及torch2trt的使用,后面会补充这个转换工具的代码学习
Jetson Nano踩坑记录
·8 mins
写在前面 # 主要是需要在jetson nano做模型转换,来记录下踩的坑 目前有两条路径,一条是我们现有的转换路径,也就是pytorch->onnx(->caffe)->trt的路径 在这条路径上踩了比较多的坑,最终暂时放弃,最直接的原因是cudnn8.0升级接口发生改动,编译caffe遇到较多问题 这里其实仍然采用了两条平行的路径,一条是直接在nano上构建环境,另外一种是基于docker(包括构建交叉编译环境用于加快编译速度)