本文记录在Linux下编译Kratos的流程。
零、环境
操作系统 | Ubuntu 22.04.4 LTS |
VS Code | 1.92.1 |
Git | 2.34.1 |
GCC | 11.4.0 |
CMake | 3.22.1 |
Boost | 1.74.0 |
oneAPI | 2024.2.1 |
一、依赖与代码
1.1 安装依赖
apt-get update
apt-get install vim openssh-server openssh-client ssh \
build-essential cmake git doxygen \
libboost-all-dev intel-basekit intel-hpckit
1.2 下载代码
git clone --progress --recursive -v https://github.com/KratosMultiphysics/Kratos.git
cd ./Kratos/
git checkout -b Kratos-v9.5 v9.5
二、VS Code
下载VS Code,然后安装以下插件,
Task Explorer Output Colorizer Git Extension Pack Remote Developement Remote X11 | |
C/C++ Extension Pack C++ TestMate | |
Modern Fortran FORTRAN InstelliSense Fortran Breakpoint Support | |
Environment Configurator for Intel Software Developer Tools Extension Pack for Intel Software Developer Tools |
三、编译
按附录I新建CMakeUserPrersets.json,在CMake Tools中,选择'GCC 11.4.0 x86_64-linux-gnu' Kit,完成Kratos编译与安装。
EXCLUDE_KRATOS_CORE | ON |
四、测试
附录I: CMakeUserPresets.json
{
"version": 4,
"configurePresets": [
{
"name": "linux_default",
"hidden": true,
"displayName": "Default Linux Config",
"description": "Default build using Unix Makefiles generator",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "linux_gcc",
"inherits": "linux_default",
"displayName": "linux_gcc",
"description": "Using compilers: C = /usr/bin/gcc, CXX = /usr/bin/g++",
"cacheVariables": {
"CMAKE_C_COMPILER": "/usr/bin/gcc",
"CMAKE_CXX_COMPILER": "/usr/bin/g++",
"CMAKE_MAKE_PROGRAM": "/usr/bin/make",
"MKL_INTERFACE": "lp64"
},
"environment": {
"KRATOS_APPLICATIONS": "applications/FluidDynamicsApplication;applications/FreeSurfaceApplication"
}
}
],
"buildPresets": [
{
"name": "linux_gcc",
"displayName": "linux_gcc",
"description": "Using compilers: C = /usr/bin/gcc, CXX = /usr/bin/g++",
"configurePreset": "linux_gcc"
}
]
}
附录II:cmake-tools-kits.json
[
{
"name": "GCC 11.4.0 x86_64-linux-gnu",
"compilers": {
"C": "/usr/bin/gcc",
"CXX": "/usr/bin/g++"
},
"isTrusted": true
}
]
参考资料
- Pooyan Dadvand. A Framework for Developing Finite Element Codes for Multi-Disciplinary Applications. Monograph CIMNE, January 2008.
网络资料
Kratoshttps://github.com/KratosMultiphysics/Kratos
Using Visual Studio Code with Intel® oneAPI Toolkits User Guidehttps://www.intel.com/content/www/us/en/docs/oneapi/user-guide-vs-code/2024-2/overview.html