gengxin
This commit is contained in:
1 parent
7bc9aeb73b
commit
eef210bcb1
3 files changed
+140
No files matched your search
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,140 @@
|
||||
# deepflame安装
|
||||
本文数据来源于https://deepflame.deepmodeling.com/en/latest/qs/install.html
|
||||
|
||||
## 1.准备工作
|
||||
***pre:*** 如果是在windows下运行,笔者建议使用wsl运行,其他的虚拟机在gpu调用方面多少会有问题。如果是在linux下运行,推荐使用ubuntu,使用源码编译的方式更加稳妥
|
||||
|
||||
#### 安装wsl2
|
||||
在开始之前,首先需要确保你的 Windows 系统已经启用了 WSL 功能。请按照以下步骤进行操作:
|
||||
1. 打开 “控制面板”,选择 “程序”,然后点击 “启动或关闭 Windows 功能”。
|
||||
2. 在显示的列表中找到 “适用于 Linux 的 Windows 子系统”,勾选该选项。
|
||||
3. 点击 “确定”,等待系统完成配置。
|
||||
|
||||
接下来使用管理员权限打开powershell
|
||||
|
||||
`wsl --install -d Ubuntu`
|
||||
|
||||
如果想要安装指定版本的linux发行版,使用以下命令查找
|
||||
|
||||
`wsl --list --online`
|
||||
|
||||
删除版本
|
||||
|
||||
`wsl --unregister <发行版名称>`
|
||||
|
||||
#### 安装miniconda
|
||||
下载 Miniconda 的最新安装脚本
|
||||
|
||||
`wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh`
|
||||
|
||||
运行安装脚本
|
||||
|
||||
`bash Miniconda3-latest-Linux-x86_64.sh`
|
||||
|
||||
如果你忘记了初始化,使用下面的命令完成init
|
||||
|
||||
`~/miniconda3/bin/conda init`
|
||||
|
||||
#### (1)对于ubuntu20.04版本,从apt源进行安装
|
||||
`//Install OpenFOAM release by apt`
|
||||
|
||||
`sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"`
|
||||
|
||||
`sudo add-apt-repository http://dl.openfoam.org/ubuntu`
|
||||
`sudo apt-get update`
|
||||
|
||||
`sudo apt-get -y install openfoam7`
|
||||
|
||||
***OpenFOAM-7 和 ParaView-5.6.0 将被安装在 /opt 目录.***
|
||||
|
||||
#### (2)由于实际部署环境的不同,因此推荐采用源码编译的方式
|
||||
Deepflame需要OpenFOAM-7, LibCantera, PyTorch.
|
||||
##### *---------- 安装OpenFOAM-7 ----------*
|
||||
`gcc --version`
|
||||
|
||||
`sudo apt-get install build-essential cmake git ca-certificates`
|
||||
|
||||
`sudo apt-get install flex libfl-dev bison zlib1g-dev libboost-system-dev libboost-thread-dev libopenmpi-dev openmpi-bin gnuplot libreadline-dev libncurses-dev libxt-dev`
|
||||
|
||||
`cd $HOME # 根据自己的安装路径`
|
||||
|
||||
`wget -O - http://dl.openfoam.org/source/7 | tar xz`
|
||||
|
||||
`wget -O - http://dl.openfoam.org/third-party/7 | tar xz`
|
||||
|
||||
|
||||
`mv OpenFOAM-7-version-7 OpenFOAM-7`
|
||||
|
||||
`mv ThirdParty-7-version-7 ThirdParty-7`
|
||||
|
||||
`source OpenFOAM-7/etc/bashrc`
|
||||
|
||||
`./OpenFOAM-7/Allwmake -j`
|
||||
|
||||
***//注意编译时间可能会比较长***
|
||||
##### *---------- 安装LibCantera和PyTorch ----------*
|
||||
|
||||
//通过conda安装
|
||||
|
||||
`conda create -n deepflame python=3.8`
|
||||
|
||||
`conda activate deepflame`
|
||||
|
||||
`conda install -c cantera libcantera-devel=2.6 cantera`
|
||||
|
||||
`pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118`
|
||||
|
||||
`conda install pybind11 pkg-config`
|
||||
|
||||
//对于支持cuda的平台
|
||||
`conda create -n deepflame \
|
||||
pytorch torchvision torchaudio libcantera-devel easydict pybind11 pkg-config \
|
||||
-c pytorch -c nvidia -c cantera -c conda-forge`
|
||||
|
||||
`conda activate deepflame`
|
||||
|
||||
## 2.配置
|
||||
#### (1)配置OpenFOAM-7
|
||||
|
||||
对于源码编译
|
||||
|
||||
`source $HOME/OpenFOAM/OpenFOAM-7/etc/bashrc`
|
||||
|
||||
对于ubuntu20.04
|
||||
|
||||
`source /opt/openfoam7/etc/bashrc`
|
||||
|
||||
接下来
|
||||
|
||||
`source ~/.bashrc`
|
||||
|
||||
#### (2)克隆deepflame
|
||||
|
||||
`git clone https://github.com/deepmodeling/deepflame-dev.git`
|
||||
|
||||
如果需要别的模块the WENO scheme and the libROUNDSchemes ,使用下面的
|
||||
`git clone --recursive https://github.com/deepmodeling/deepflame-dev.git`
|
||||
#### (3)配置deepflame环境
|
||||
`cd deepflame-dev`
|
||||
`. configure.sh --use_pytorch`
|
||||
`source ./bashrc`
|
||||
## 3.安装
|
||||
|
||||
`. install.sh`
|
||||
|
||||
如果出现报错fmt 或者 eigen无法被找到,使用conda安装
|
||||
|
||||
`conda install fmt`
|
||||
|
||||
`conda install eigen`
|
||||
|
||||
通过 cantera 方式安装 libcantera 时,可能还会遇到有关共享库 libmkl_rt.so.2 的错误。如果是这样, 检查conda 环境 libmkl_rt.so.2 和 libmkl_rt.so.1 是否存在,然后将 libmkl_rt.so.2 链接到 libmkl_rt.so.1。
|
||||
|
||||
`cd ~/miniconda3/envs/deepflame/lib`
|
||||
`ln -s libmkl_rt.so.1 libmkl_rt.so.2`
|
||||
|
||||
如果成功安装
|
||||

|
||||
如果有更多的问题需要解答,可以到github上去查看issue,或者访问https://deepflame.deepmodeling.com/en/latest/qs/install.html获得更多支持
|
||||
|
||||
@author xiangyukang
|
||||
Reference in new issue
Block a user