当前位置: 首页 > java >正文

CMU-15445(1)——环境搭建

前言

最近在找完暑期实习之后,终于有了一些干项目外的空余时间学习新的知识,在这么多轮面试中,数据库的考察非常多,但孱弱的数据库基础导致我有很多次面试被问住,因此我希望在学习CMU-15445(Fall 2024)的过程中能夯实我的基础,更好的理解数据库在计算机中的应用。

我将从本节开始记录我从查找资源、注册以及后续project提交的过程。

1. 准备工作

1.1 Gradescope注册

在学习课程之前,我们需要注册一个Gradescope账号用于提交测试我们的project,并留记录以证明自己的学习经历。

非CMU学生如果要测试project,需在网站Gradescope提前注册账号。

  • 确保将学校设置为“Carnegie Mellon University
  • 参赛代码为“WWWJZ5

1.2 clone仓库

课程主页:CMU 15-445/645 :: Intro to Database Systems (Fall 2024)

github:cmu-db/bustub: The BusTub Relational Database Management System (Educational)

过程如下:

  1. 首先,在自己的github下创建新存储库

  2. 在PC上,创建公有 BusTub 存储库的克隆:

    $ git clone --bare https://github.com/cmu-db/bustub.git bustub-public
    
  3. 将公有BusTub镜像到刚才创建的新存储库中:

    $ cd bustub-public# If you pull / push over HTTPS
    $ git push https://github.com/student/bustub-private.git master# If you pull / push over SSH
    $ git push git@github.com:student/bustub-private.git master
    

    我这里使用的SSH协议,用户名和仓库名写为自己新创建的仓库名和用户名,如下:

    $ git push git@github.com:qiaobeibei/cmu-15445.git
    

    但是在 push 过程中,遇到了一个问题:

在这里插入图片描述

这里需要我们配置有效的SSH密钥,从而能通过GitHub的身份验证:

  1. 我们先查看本地是否已经存在SSH密钥:

    $ ls -al ~/.ssh
    

    如果存在id_rsa.pub(RSA 密钥)或者 id_ed25519.pub(Ed25519 密钥),则说明本地已存有密钥,如下

    在这里插入图片描述

    id_rsa.pub 文件的内容输出到终端,然后复制:

    $ cat ~/.ssh/id_rsa.pub
    

    在这里插入图片描述

    如果密钥不存在,那么我们需要生成新的SSH密钥:

    $ ssh-keygen -t ed25519 -C "your_email@example.com"
    

    your_email@example.com是我们Github上注册的邮箱地址。

    生成密钥后,启动SSH代理并将新生成的密钥添加到代理中:

    $ eval "$(ssh-agent -s)"
    $ ssh-add ~/.ssh/id_ed25519
    

    若使用的是 RSA 密钥,就把 id_ed25519 替换成 id_rsa

    然后查看密钥内容,并复制。

  2. 将SSH 公钥添加到 GitHub 账户

    1. 登录 GitHub 账户,点击右上角的头像,然后选择 Settings

    2. 在左侧菜单中,点击 SSH and GPG keys

    3. 点击 New SSH key 按钮。

    4. Title 字段中,输入一个描述性的名称,例如你的电脑名称或使用场景,方便你识别这个密钥。

      在这里插入图片描述
      在这里插入图片描述

    5. Key 字段中,粘贴你刚才复制的公钥内容。

    6. 点击 Add SSH key 按钮保存设置。

  3. 测试SSh连接

    输入以下指令,测试SSH连接是否正常:

    ssh -T git@github.com
    

    执行该命令后,输入密钥的密码短语,若出现以下结果,则连接成功:

    在这里插入图片描述

    其中,username 是 GitHub 用户名,可以正常使用 SSH 协议克隆和操作仓库了。

再次克隆仓库:

$ git push git@github.com:qiaobeibei/cmu-15445.git

push成功后,删除刚才clone到本地的公有 bustub-public 仓库。

$ cd ..
$ rm -rf bustub-public
  1. 将我们的个人仓库clone到本地计算机

    # If you pull / push over HTTPS
    $ git clone https://github.com/student/bustub-private.git# If you pull / push over SSH
    $ git clone git@github.com:student/bustub-private.git
    
  2. 将公共的 BusTub 仓库添加为第二个远程仓库

    $ git remote add public https://github.com/cmu-db/bustub.git
    

    使用以下命令验证远程仓库是否已成功添加:

    $ git remote -v
    

    预期输出示例:

    origin	https://github.com/qiaobeibei/cmu-15445.git (fetch)
    origin	https://github.com/qiaobeibei/cmu-15445.git (push)
    public	https://github.com/cmu-db/bustub.git (fetch)
    public	https://github.com/cmu-db/bustub.git (push)
    

    在这里插入图片描述

1.3 环境部署

首先要配置LLVM的C/C++环境,这一步非常重要,可以参考文章:CMU15445 2023spring环境准备 | JoyTsing

简要流程:

  1. 安装LLVM全家桶+cmkae

    sudo apt install clang clangd lldb cmake
    
  2. 安装LLVM

    wget https://mirrors.tuna.tsinghua.edu.cn/llvm-apt/llvm.sh
    chmod +x llvm.sh
    sudo ./llvm.sh all -m https://mirrors.tuna.tsinghua.edu.cn/llvm-apt
    
  3. Vscode所需插件:

    在这里插入图片描述

1.4 build

首先cd到项目根目录下,运行脚本安装依赖

$ sudo build_support/packages.sh

然后编译流程和官网介绍一样:

Then run the following commands to build the system:

$ mkdir build
$ cd build
$ cmake ..
$ make

If you want to compile the system in debug mode, pass in the following flag to cmake: Debug mode:

$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make -j`nproc`

This enables AddressSanitizer by default.

If you want to use other sanitizers,

$ cmake -DCMAKE_BUILD_TYPE=Debug -DBUSTUB_SANITIZER=thread ..
$ make -j`nproc`

There are some differences between macOS and Linux (i.e., mutex behavior) that might cause test cases to produce different results in different platforms. We recommend students to use a Linux VM for running test cases and reproducing errors whenever possible.

后续就是跟着project的介绍一步步做,完成project的task后,通过下面的命令进行测试:

$ cd build
$ make -j$(nproc) hyperloglog_test
$ ./test/hyperloglog_test

运行编译好的测试程序即可测试:

./test/hyperloglog_test

在这里插入图片描述

确保从测试用例名称中移除了 DISABLED_ 前缀,不然这些测试用例不会运行。如果想要运行某个之前被禁用的测试用例,只需把 DISABLED_ 前缀去掉即可。

比如要测试./test/buffer/lru_k_replacer_test.cpp,需要将测试用例第二个形参开头的DISABLE_前缀去掉,然后再次make,就会正常测试。
在这里插入图片描述

http://www.xdnf.cn/news/2765.html

相关文章:

  • python上测试neo4j库
  • 注意力机制:从 MHA、MQA、GQA、MLA 到 NSA、MoBA
  • Mysql索引
  • LeetCode【剑指offer】系列(动态规划篇)
  • VBA快速创建Excel中数据模型的数据连接
  • C++ 部署的性能优化方法
  • 网络拓扑模型相关题目-1
  • Lustre/Scade 语言时序算子与形式化验证的联系
  • 从暴力到优化:解决「分数严格小于k的子数组数目」问题
  • 硬件加密+本地部署,大模型一体机如何打造AI安全护城河?
  • terraform plan和apply的区别
  • 声纹监测技术在新能源汽车的应用场景解析
  • Volcano 进阶实战 (三) - (多集群 / 离线混部)调度
  • windows程序转鲲鹏服务器踩坑记【持续更新中】
  • 如何在WordPress网站中设置双重验证,提升安全性
  • Leetcode594.最长和谐子序列
  • 小米云服务安卓版数据同步稳定性与安全性能测评
  • 安卓基础(接口interface)
  • 模板--进阶
  • 提高营销活动ROI:大数据驱动的精准决策
  • 使用 Electron 打包 Windows 可执行程序
  • Darvas Box黄金交易算法详解:基于XAU/USD的实战应用
  • 武装Burp Suite工具:APIKit插件_接口安全扫描.
  • 算法备案材料拟公示内容涉及什么?如何撰写?
  • opendds的配置
  • IDEA2022.3开启热部署
  • 第16节:传统分类模型-支持向量机(SVM)在图像分类中的应用
  • sources.list.d目录
  • C++(初阶)(十三)——继承
  • 【学习笔记】机器学习(Machine Learning) | 第四章(3)| 多变量线性回归