Ubuntu下的科学计算环境
本人在聚变等离子体方向做理论模拟。本文旨在提供在Ubuntu下搭建基本的c&python开发环境。Ubuntu系统版本18&20都可以(建议不要使用最新版的)。
(vim/gcc/g++/gdb/gfortran/make/cmake/ccmake/ipython/fftw/blas/lapack/mumps/petsc/eigen/openmpi/openmp)
where | URL |
---|---|
官方下载地址(不推荐) | https://www.ubuntu.com/download |
中国官网(推荐) | https://cn.ubuntu.com/ |
中科大源 | http://mirrors.ustc.edu.cn/ubuntu-releases/16.04/ |
阿里云开源镜像站 | http://mirrors.aliyun.com/ubuntu-releases/16.04/ |
兰州大学开源镜像站 | http://mirror.lzu.edu.cn/ubuntu-releases/16.04/ |
北京理工大学开源 | http://mirror.bit.edu.cn/ubuntu-releases/16.04/ |
浙江大学 | http://mirrors.zju.edu.cn/ubuntu-releases/16.04/ |
- 更换mirror
用国外源,安装软件极其费时,可能一天就安了几个软件。某个大佬写了一个脚本(quanweiGithub/Ubuntu-China-Source)用于切换Ubuntu的镜像到国内源。
- 安装git
sudo apt install git
- 安装neovim
sudo apt install neovim
Vim 之所以强大,一个很重要的原因是存在很多插件,在 Vim 漫长的发展过程中,无数开发者为 Vim 贡献了插件,这些插件可以实现各种各样的功能。如果安装插件很多,插件管理成为一个麻烦的问题。Neovim 和 Vim 一样,并没有自带插件管理器,我们需要自己安装插件管理器。经过搜索和比较,发现有两款比较有名的插件管理器在 Nvim 用户中流行,分别是 dein 和vim-plug. Vim-plug 的 user base 更大,最后我决定安装 vim-plug,以下为 vim-plug 安装以及简单的使用说明。插件配置可见bilibili视频和vimrc-example。
Neovim 使用的配置文件和 Vim 不同,需要在 ~/.config/nvim/ 目录下创建文件 init.vim ,该文件就是 Neovim 的配置文件,Neovim 所有的配置都可以放入其中。由于 Neovim 是基于 Vim 开发的,所以 Neovim 和 Vim 的绝大多数配置都是相同的,如果之前使用过 Vim,可以把之前的配置的大部分拷贝过来使用。Vim-Plug的有效文件就是plug.vim!!!
vim
- 将plug.vim文件下载下来
- 复制到~/.vim/autoread/文件夹下
- 安装Vim-Plug插件管理器:编辑/home/username/.vimrc文件
call plug#begin(’~/.vim/plugged’)
Plug ‘itchyny/lightline.vim’
call plug#end()
nvim
- 将plug.vim文件下载下来
- 复制到~/.local/share/nvim/site/autoread/文件夹下
- 安装Vim-Plug插件管理器:编辑 init.vim 文件
call plug#begin(’~/.local/share/nvim/site/plugged/’)
Plug ‘itchyny/lightline.vim’
call plug#end()
- Ubuntu的编译链接工具链
cmake用于生成makefile,构建系统。学习cmake,你可能喜欢cmake-examples。cmake: A command line interface (CLI) 。ccmake: An ncurses (terminal) GUI. (only available on Unix-like systems)。cmake-gui: A Qt-based GUI。
sudo apt update
sudo apt install build-essential
sudo apt-get install gfortran
sudo apt-get install cmake
sudo apt-get install cmake-curses-gui
- Ubuntu安装QQ for Linux
wget http://down.qq.com/qqweb/LinuxQQ/linuxqq_2.0.0-b2-1084_amd64.deb
sudo dpkg -i linuxqq_2.0.0-b2-1082_amd64.deb
sudo dpkg -r linuxqq
wget https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
or
wget https://repo.anaconda.com/archive/Anaconda2-2019.10-Linux-x86_64.sh
and then
bash Anaconda3-2019.03-Linux-x86_64.sh
下行可以查看安装脚本的选项
bash Anaconda2-2019.10-Linux-x86_64.sh -h
MUMPS (MUltifrontal Massively Parallel sparse direct Solver) is a software application for the solution of large sparse systems of linear algebraic equations on distributed memory parallel computers. It was developed in European project PARASOL (1996–1999) by CERFACS, IRIT-ENSEEIHT and RAL. The software implements the multifrontal method, which is a version of Gaussian elimination for large sparse systems of equations, especially those arising from the finite element method. It is written in Fortran 90 with parallelism by MPI and it uses BLAS and ScaLAPACK kernels for dense matrix computations. Since 1999, MUMPS has been supported by CERFACS, IRIT-ENSEEIHT, and INRIA. The importance of MUMPS lies in the fact that it is a rare public domain implementation of the multifrontal method, if not the only professional and supported one.
- 安装VSCODE
第一行下载包.第二行安装code.
wget https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64
sudo dpkg -i code_1.38.1-1568209190_amd64.deb
- 安装Code::Blocks
第一行安装CB.第二行安装插件.
sudo apt-get install codeblocks
sudo apt-get install codeblocks-contrib
使用VMware
如果你使用虚拟机啊其实挺好的。一旦你配置好环境,一般可以将虚拟机复制到若干其它计算机上。无需重复配置环境。当然,用docker也可以更好。我使用过的案例有:amd移植到Intel;amd移植到amd。
vmware Player 16 闪退+蓝屏:
- https://blog.csdn.net/qq_25777815/article/details/110385275
- https://blog.csdn.net/qq_42672132/article/details/118903457
- https://blog.csdn.net/csdn18740599042/article/details/114608442
- https://blog.csdn.net/hdjbdbfj/article/details/120402211
—更新中—