容器
容器化部署多节点 FoundationDB 及运维
· ☕ 3 分钟
1. 生成集群ID 1 cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1 下面以 CLUSTER_ID=fKbIga9RHP79OIx1 为例 2. 第一个节点上 配置环境变量 1 2 3 4 5 6 7 8 9 10 export CONTAINER_CLI=nerdctl export IMAGE=foundationdb/foundationdb:7.1.26 export CLUSTER_ID=fKbIga9RHP79OIx1 export FDB_INSTANCE_NAME=fdb_server export FDB_CLUSTER_FIRST_IP=$(hostname -I | awk '{print $1}') export FDB_PUBLIC_IP=$(hostname -I | awk '{print $1}') export FDB_PORT=4500 export FDB_DIR=/data/ops/fdb/$FDB_INSTANCE_NAME 清理旧数据 1 2 3 $CONTAINER_CLI rm -f $FDB_INSTANCE_NAME mv $FDB_DIR $FDB_DIR.$(date +%Y%m%d%H%M%S).bak mkdir -p $FDB_DIR 创建 cluster 文件 1 2 3 mkdir -p $FDB_DIR echo "${FDB_INSTANCE_NAME}:${CLUSTER_ID}@${FDB_CLUSTER_FIRST_IP}:4500" > $FDB_DIR/fdb.cluster cat $FDB_DIR/fdb.cluster 启动服务器节点

使用 PyTorch 在 MNIST 数据集训练模型
· ☕ 3 分钟
1. 创建训练脚本 创建训练脚本 mnist.py,内容如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93

常用 AI 基础镜像及启动命令
· ☕ 2 分钟
1. 镜像 Tag 标识的含义 base/cuda: 包括 CUDA 运行时 runtime: 在 base 的基础上,新增了 CUDA math 库和 NCCL、cuDNN 运行时 devel: 在 runtime 的基础上,新增了头文件和用于构建 CUDA 镜像的开发工具,对于多阶段构建特别有用 cuddn: 在上面基础上,新增了 cuDNN 神经网络加速库 py3: Python 3 环境 2. CUDA 镜像 镜像 AMD64 镜像大小 ARM64 镜

容器下使用 Triton Server 和 TensorRT-LLM 进行大模型推理
· ☕ 8 分钟
1. TensorRT-LLM 编译模型 1.1 TensorRT-LLM 简介 使用 TensorRT 时,通常需要将模型转换为 ONNX 格式,再将 ONNX 转换为 TensorRT 格式,然后在 TensorRT、Triton Server 中进行推理。 但这个转换过程并不简单,经常会遇到各种报错,需要对模型结构、平台算子有一定的掌握,具备转换和调试能力。而 TensorRT-LLM 的目标

容器下的 Go 应用程序优化
· ☕ 2 分钟
1. 内存对齐 结构体内字段,从大到小排列 减少内存占用 安装 fieldalignment 工具 1 go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest 分析并修复内存对齐 1 2 3 4 5 6 7 8 9 fieldalignment -fix ./... /Users/shaowenchen/Code/app/config/config.go:136:14: struct with 32 pointer bytes could be 24 /Users/shaowenchen/Code/app/config/config.go:150:11: struct of size 96 could be 88 /Users/shaowenchen/Code/app/config/config.go:166:14: struct of size 152 could be 144 /Users/shaowenchen/Code/app/config/config.go:194:12: struct with 80 pointer bytes could be 72 /Users/shaowenchen/Code/app/config/config.go:209:12: struct with 56 pointer bytes could be 40 /Users/shaowenchen/Code/app/dao/gormx/gorm.go:12:13: struct with 16 pointer bytes could be 8 /Users/shaowenchen/Code/app/dao/gormx/entity/cluster.go:5:14: struct with 128 pointer bytes could be 104 查看 fieldalignment 进行