ubuntu 安装 lotus 1.14.1

Ubuntu

  • 依赖安装
apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y

go

wget https://studygolang.com/dl/golang/go1.16.4.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.4.linux-amd64.tar.gz

echo "export PATH=$PATH:/usr/local/go/bin" >> .profile
source .profile
go version
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=on

rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

nvidia

# update-pciids
# lspci | grep -i nvidia
NVIDIA-Linux-x86_64-460.56.run
sh NVIDIA-Linux-x86_64-460.56.run

显卡驱动安装成功

# nvidia-smi

禁用nouveau

lsmod | grep nouveau
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
update-initramfs -u
reboot

cuda

wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_460.32.03_linux.run
sh cuda_11.2.2_460.32.03_linux.run
选择 accept

取消显卡驱动,选择Install安装
CUDA Installer                                                               │
│ - [ ] Driver                                                                 │
│      [ ] 460.32.03                                                           │
│ + [X] CUDA Toolkit 11.2                                                      │
│   [X] CUDA Samples 11.2                                                      │
│   [X] CUDA Demo Suite 11.2                                                   │
│   [X] CUDA Documentation 11.2                                                │
│   Options                                                                    │
│   Install
  • 设置环境变量

vim .bashrc

# CUDA
export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda
# vim .bashrc
# source .bashrc
# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0
  • 设置时区和ulimit
timedatectl set-timezone Asia/Shanghai
echo "DefaultLimitNOFILE=1048576" >> /etc/systemd/user.conf
echo "DefaultLimitNOFILE=1048576" >> /etc/systemd/system.conf

vim /etc/security/limits.conf

* soft     nproc          1048576
* hard     nproc          1048576
* soft     nofile         1048576
* hard     nofile         1048576

root soft     nproc          1048576
root hard     nproc          1048576
root soft     nofile         1048576
root hard     nofile         1048576
reboot
# ulimit -n
1048576

lotus

git clone https://github.com/filecoin-project/lotus.git
# cd lotus/
# git checkout v1.14.1
# git show
commit d2dca7b21718048e1a6dc15b90a44b3d298852fb (HEAD, tag: v1.14.1, origin/releases)
  • 源码编译
env RUSTFLAGS="-C target-cpu=native -g" FFI_BUILD_FROM_SOURCE=1 make clean all lotus-shed
env RUSTFLAGS="-C target-cpu=native -g" FFI_BUILD_FROM_SOURCE=1 FFI_USE_CUDA=1 make clean all
  • 取消IPFS_GATEWAYJD的网关默认使用官方的
unset IPFS_GATEWAY

32.09 GiB的文件需要更新 https://proofs.filecoin.io/ipfs/

lotus-shed fetch-params --proving-params 32GiB

参考:

  1. v1.14.1
  2. bellperson
  3. filecoin-ffi CUDA
  4. Building from source