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

相关推荐
Yo_Becky11 小时前
【PyTorch】PyTorch预训练模型缓存位置迁移,也可拓展应用于其他文件的迁移
人工智能·pytorch·经验分享·笔记·python·程序人生·其他
cwtlw11 天前
Excel学习03
笔记·学习·其他·excel
老陈头聊SEO14 天前
AI与SEO关键词协同进化
其他
学视线12314 天前
汽车加气站操作工考试题库含答案【最新】
其他
nikoni2314 天前
Return ratio法计算环路增益
笔记·其他·硬件工程
cwtlw15 天前
Excel学习01
笔记·学习·其他·excel
职坐标在线15 天前
职坐标IT培训:嵌入式AI物联网开源项目精选
其他
老陈头聊SEO16 天前
AI时代SEO关键词革新
其他
binbinaijishu8820 天前
PyTorch:让深度学习飞入寻常百姓家(从零开始玩转张量与神经网络!)
pytorch·深度学习·神经网络·其他
zkinglin20 天前
AORSA编译指南
笔记·其他·能源