Linux Swap交换分区

在我们自己的购买的服务器环境中,一般是买的1g的内存,但是当服务器里面的东西装的比较多的时候就会导致内存不够用了,这个时候可以通过增加虚拟内存来夸大内存容量。

设置

0、查看内存使用情况

1
2
3
4
$ free -m
total used free shared buff/cache available
Mem: 3914 161 1110 0 2643 3479
Swap: 8703 64 8639

1、检查 Swap 空间,先检查一下系统里有没有既存的 Swap 文件

Read More

gitignore文件的顺序

发现.gitignore里面条目顺序是有意义的。

1
2
3
4
5
*.c
*.cpp
!skts.c
!np_datetime.c
!np_datetime_strings.c

!的几项生效

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .gitignore

Untracked files:
(use "git add <file>..." to include in what will be committed)
__init__.pxd
pandas_helper/_libs/tslibs/src/datetime/np_datetime.c
pandas_helper/_libs/tslibs/src/datetime/np_datetime_strings.c

no changes added to commit (use "git add" and/or "git commit -a")

如果反过来

Read More

Ubuntu 22.04安装Cuda Toolkit

Nvidia现在要求安装CuDNN和NICC都得登录Nvidia Developer网站,国内巨慢。药丸。

CUDA

1
2
3
4
sudo -i # 切换root权限
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
dpkg -i cuda-keyring_1.0-1_all.deb
apt update && apt install cuda -y

NICC

1
apt install libnccl2=2.15.5-1+cuda11.8 libnccl-dev=2.15.5-1+cuda11.8

Read More

修复MongoDB设置导致mongod无法启动

缘起

为了解决使用Arctic[1] MongoDB的日志里出现

1
SASL SCRAM-SHA-1 authentication failed for myAdminUser on admin from client 192.168.3.100:9560 ; UserNotFound: Could not find user "myAdminUser" for db "admin"

错误的问题,参考了数个连接(包括StackOverflow[2]),都提示要将authSchema.currentVersion5改成3。照做以后就杯具了,mongod服务完全打不开了,提示错误

1
This server is using MONGODB-CR, an authentication mechanism which has been removed from MongoDB 4.0. In order to upgrade the auth schema, first downgrade MongoDB binaries to version 3.6 and then run the authSchemaUpgrade command. See http://dochub.mongodb.org/core/3.0-upgrade-to-scram-sha-1

Read More

消除&lt;frozen importlib._bootstrap&gt;:228: RuntimeWarning: scipy._lib.messagestream.MessageStream size changed, may indicate binary incompatibility.

问题

import scipy.stats的时候报警告:

1
2
3
4
5
6
Python 3.9.12 (main, Apr  5 2022, 06:56:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.stats import percentileofscore
<frozen importlib._bootstrap>:228: RuntimeWarning: scipy._lib.messagestream.MessageStream size changed, may indicate binary incompatibility. Expected 56 from C header, got 64 from PyObject
>>> exit()

解决

这个的原因之一是pip在升级numpy,scipy的时候(pip install -U numpy scipy),对旧的package的删除可能不干净的问题。需要多次用uninstall直至无残留:

Read More

Ubuntu 22.04安装MongoDB 4.2

问题在于Ubuntu 22.04开始移除了libssl1.1的支持。所以需要先安装libssl1.1

1
2
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.1_1.1.

然后将18.04 boinic的source加入source list

1
2
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

更新apt并安装

Read More