Linux下编译Kratos

本文记录在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 安装依赖

bash 复制代码
apt-get update
apt-get install vim openssh-server openssh-client ssh \
  build-essential cmake git doxygen \
  libboost-all-dev intel-basekit intel-hpckit
bash 复制代码
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py

1.2 下载代码

bash 复制代码
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 Git Graph Remote Developement Remote X11 | |
| C/C++ Extension Pack C++ TestMate | |
| Modern Fortran FORTRAN InstelliSense Fortran Breakpoint Support | |
| Python Extension Pack | |
| 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

bash 复制代码
{
    "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

bash 复制代码
[
  {
    "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

相关推荐
北京海得康14 小时前
培唑帕尼:靶向药物中的多靶点抗癌新选择
其他
t057772 天前
致同上海审计合伙人林晓玲深度解读企业赴港上市与“A+H”落地实践
其他
huaxiu52 天前
ubuntu22.04安装dev-sidecar证书:
其他
m0_485614673 天前
Linux--MySQL数据库管理
其他
孙严Pay3 天前
快捷支付和网关支付到底哪个更安全呢?
笔记·科技·计算机网络·其他·微信
影林握雪4 天前
M|大佛普拉斯 (2017)
经验分享·笔记·其他·生活
gavin_gxh4 天前
SAP CO CK 465 用于物料/批 工厂 不能确定价格
运维·经验分享·其他
影林握雪4 天前
M|窃听风暴 Das Leben der Anderen (2006)
经验分享·笔记·其他·生活
jyan_敬言5 天前
【Docker】Kubernetes部署容器化应用程序
c++·笔记·其他·docker·容器·kubernetes·学习方法
m0_485614675 天前
Linux--mysql数据库与编译安装
其他