{"id":21044344,"url":"https://github.com/trixi-framework/talk-2024-derse-libtrixi","last_synced_at":"2026-03-19T18:35:56.821Z","repository":{"id":226125613,"uuid":"767433649","full_name":"trixi-framework/talk-2024-deRSE-libtrixi","owner":"trixi-framework","description":"deRSE24: Controlling parallel simulations in Julia from C/C++/Fortran programs with libtrixi","archived":false,"fork":false,"pushed_at":"2024-03-06T07:35:45.000Z","size":12015,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-20T17:28:46.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trixi-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-05T09:35:25.000Z","updated_at":"2024-03-08T11:07:35.000Z","dependencies_parsed_at":"2024-03-06T02:01:21.831Z","dependency_job_id":null,"html_url":"https://github.com/trixi-framework/talk-2024-deRSE-libtrixi","commit_stats":null,"previous_names":["trixi-framework/talk-2024-derse-libtrixi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2024-deRSE-libtrixi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2024-deRSE-libtrixi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2024-deRSE-libtrixi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2024-deRSE-libtrixi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trixi-framework","download_url":"https://codeload.github.com/trixi-framework/talk-2024-deRSE-libtrixi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243489898,"owners_count":20299001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T14:16:29.366Z","updated_at":"2026-01-31T23:04:36.507Z","avatar_url":"https://github.com/trixi-framework.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# deRSE24: Controlling parallel simulations in Julia from C/C++/Fortran programs with libtrixi\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/licenses/MIT)\n\nThis is the companion repository for the talk\n\n**Controlling parallel simulations in Julia from C/C++/Fortran programs with libtrixi**  \n[*Michael Schlottke-Lakemper*](https://lakemper.eu), [*Benedict Geihe*](https://www.mi.uni-koeln.de/NumSim/dr-benedict-geihe/)  \n[University of Würzburg, HS3, 6th March 2024, 11:30 AM](https://events.hifis.net/event/994/contributions/7970/)  \n\n(see abstract [below](#abstract)). The talk is part of the session\n[Cross-Platform Development with C/C++](https://events.hifis.net/event/994/sessions/2730) at\n[*deRSE24 - Conference for Research Software Engineering in Germany*](https://go.uniwue.de/derse24),\nwhich takes place in Würzburg, Germany from 5th to 7th March 2024.\n\nBesides the presentations slides ([talk-2024-deRSE-libtrixi.pdf](talk-2024-deRSE-libtrixi.pdf)),\nthis repository contains instructions and files that allow one to\n[reproduce](#reproducibility) (some of) the results in the talk.\n\n## Abstract\nThe Julia programming language aims to provide a modern approach to scientific high-performance\ncomputing by combining a high-level, accessible syntax with the runtime efficiency of traditional\ncompiled languages. Due to its native ability to call C and Fortran functions, Julia often acts as a\nglue code in multi-language projects, enabling the reuse of existing libraries implemented in\nC/Fortran. With the software library [libtrixi](https://github.com/trixi-framework/libtrixi), we\nreverse this workflow: It allows one to control\n[Trixi.jl](https://github.com/trixi-framework/Trixi.jl), a complex Julia package for parallel,\nadaptive numerical simulations, from a main program written in C/C++/Fortran. In this talk, we will\npresent the overall design of libtrixi, show some of the challenges we had to overcome, and discuss\ncontinuing limitations. Furthermore, we will provide some insights into the Julia C API and into the\nPackageCompiler.jl project for static compilation of Julia code. Besides the implications for our\nspecific use case, these experiences can serve as a foundation for other projects that aim to\nintegrate Julia-based libraries into existing code environments, opening up new avenues for\nsustainable software workflows.\n\n\n## Reproducibility\n\nThe instructions are written based on a x64 machine with Ubuntu Linux 22.04, on which the results\nused in the talk were obtained as well.\n\n### Getting started\n\nThe following standard software packages need to be made available locally before installing\n[libtrixi](https://github.com/trixi-framework/libtrixi):\n* C compiler with support for C11 or later (e.g., [GCC](https://gcc.gnu.org/) or [Clang](https://clang.llvm.org/))\n  (we used GCC v10.5)\n* Fortran compiler with support for Fortran 2018 or later (e.g., [Gfortran](https://gcc.gnu.org/fortran/))\n  (we used Gfortran v10.5)\n* [CMake](https://cmake.org/)\n  (we used cmake v3.16.3)\n* MPI (e.g., [Open MPI](https://www.open-mpi.org/) or [MPICH](https://www.mpich.org/))\n  (we used Open MPI v3.1)\n* [HDF5](https://www.hdfgroup.org/solutions/hdf5/)\n  (we used hdf5-openmpi v1.10)\n* [Julia](https://julialang.org/downloads/platform/) v1.10\n  (it is advised to use tarballs from the official website or the `juliaup` manager, we used v1.10.0)\n* [Paraview](https://paraview.org) for visualization\n  (we used v5.11.2)\n\nThe following software packages require manual compilation and installation. To simplify\nthe installation instructions, we assume that the environment variable `WORKDIR` was set to the\ndirectory, where all the code is downloaded to and compiled, and `PREFIX` was set to an installation\nprefix. For example,\n```shell\nexport WORKDIR=$HOME/repro-talk-2024-deRSE-libtrixi\nexport PREFIX=$WORKDIR/install\n```\n\n\n#### t8code\n\nt8code is a meshing library which is used in `Trixi.jl`. The source code can be obtained from the official\n[website](https://github.com/DLR-AMR/t8code). Here is an example for compiling and installing it (we used v1.6.1):\n\n```shell\ncd $WORKDIR\ngit clone --branch 'v1.6.1' --depth 1 https://github.com/DLR-AMR/t8code.git\ncd t8code\ngit submodule init\ngit submodule update\n./bootstrap\n./configure --prefix=\"${PREFIX}/t8code\" \\\n            CFLAGS=\"-Wall -O0 -g\" \\\n            CXXFLAGS=\"-Wall -O0 -g\" \\\n            --enable-mpi \\\n            --enable-debug \\\n            CXX=mpicxx \\\n            CC=mpicc \\\n            --enable-static \\\n            --without-blas \\\n            --without-lapack\nmake\nmake install\n```\n\n\n#### libtrixi\n\nHere is an example for compiling and installing `libtrixi` (we used v0.1.4):\n\n```shell\ncd $WORKDIR\ngit clone --branch 'v0.1.5' --depth 1 https://github.com/trixi-framework/libtrixi.git\ncd libtrixi\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release \\\n      -DCMAKE_INSTALL_PREFIX=${PREFIX}/libtrixi ..\nmake\nmake install\n```\n\nA separate Julia project for use with libtrixi has to be set up:\n\n```shell\nmkdir ${PREFIX}/libtrixi-julia\ncd ${PREFIX}/libtrixi-julia\n${PREFIX}/libtrixi/bin/libtrixi-init-julia \\\n  --t8code-library ${PREFIX}/t8code/lib/libt8.so \\\n  --hdf5-library /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so \\\n  ${PREFIX}/libtrixi\n```\n\nTo exactly reproduce the results presented in the talk, the provided [Manifest.toml](Manifest.toml)\ncan be used to install the same package versions for all Julia dependencies:\n\n```shell\ncp Manifest.toml ${PREFIX}/libtrixi-julia/\ncd ${PREFIX}/libtrixi-julia\nJULIA_DEPOT_PATH=./julia-depot \\\n  julia --project=. -e 'import Pkg; Pkg.instantiate()'\n```\n\n\n#### Trixi2Vtk\n\n[Trixi2Vtk](https://github.com/trixi-framework/Trixi2Vtk.jl)\nneeds to be installed for later post processing (we used v0.3.12):\n\n```shell\ncd ${PREFIX}/libtrixi-julia\nJULIA_DEPOT_PATH=./julia-depot \\\n  julia --project=. -e 'import Pkg; Pkg.add(name=\"Trixi2Vtk\", version=\"0.3.12\")'\n```\n\n\n### Running the examples\n\n#### Rising thermal perturbation\n\n```shell\ncd ${PREFIX}/libtrixi\nmpirun -n 2 ./bin/trixi_controller_simple_f \\\n  ${PREFIX}/libtrixi-julia \\\n  ${PREFIX}/libtrixi/share/libtrixi/LibTrixi.jl/examples/libelixir_tree2d_warm_bubble.jl\n```\n\nOutput files will be written to `${PREFIX}/libtrixi/out_bubble` and need to be post processed:\n\n```shell\ncd ${PREFIX}/libtrixi/out_bubble\nJULIA_DEPOT_PATH=${PREFIX}/libtrixi-julia/julia-depot \\\n   julia --project=${PREFIX}/libtrixi-julia -e 'using Trixi2Vtk; trixi2vtk(\"solution*.h5\")'\n```\n\nThe results can now be viewed using, e.g, paraview.\nWe used [Tpotpert_contour.pvsm](Tpotpert_contour.pvsm) and [Tpotpert.pvsm](Tpotpert.pvsm)\nto generate our results.\n\n\n#### Baroclinic instability\n\n```shell\ncd ${PREFIX}/libtrixi\nmpirun -n 12 ./bin/trixi_controller_simple_f \\\n  ${PREFIX}/libtrixi-julia \\\n  ${PREFIX}/libtrixi/share/libtrixi/LibTrixi.jl/examples/libelixir_p4est3d_euler_baroclinic_instability.jl\n```\n\nOutput files will be written to `${PREFIX}/libtrixi/out_baroclinic` and need to be post processed:\n\n```shell\ncd ${PREFIX}/libtrixi/out_bubble\nJULIA_DEPOT_PATH=${PREFIX}/libtrixi-julia/julia-depot \\\n   julia --project=${PREFIX}/libtrixi-julia -e 'using Trixi2Vtk; trixi2vtk(\"solution*.h5\")'\n```\n\nThe results can now be viewed using, e.g, paraview.\nWe used [pressure.pvsm](pressure.pvsm) to generate our results.\n\n\n## Authors\nThis repository was initiated by\n[Benedict Geihe](https://www.mi.uni-koeln.de/NumSim/dr-benedict-geihe/)\nand [Michael Schlottke-Lakemper](https://lakemper.eu).\n\n\n## License\nThe contents of this repository are licensed under the MIT license (see [LICENSE.md](LICENSE.md)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrixi-framework%2Ftalk-2024-derse-libtrixi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrixi-framework%2Ftalk-2024-derse-libtrixi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrixi-framework%2Ftalk-2024-derse-libtrixi/lists"}