Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v3.0.0 #55

Merged
merged 18 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/TestJuliaVersions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Building Package on stable Julia versions >1.4 and on the latest Julia version under development 'nightly'
name: Building package on the latest Julia version and on the latest Julia version under development 'nightly'
on:
workflow_dispatch:
schedule:
Expand All @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
julia-version: ['1.6', 'nightly']
julia-version: ['1.10.0', 'nightly']

steps:
- name: Update System
Expand All @@ -28,19 +28,19 @@ jobs:
id: cache-libprecice
uses: actions/cache@v2
with:
path: libprecice2_2.3.0_focal.deb
key: libprecice2_2.3.0_focal.deb1
restore-keys: libprecice2_2.3.0_focal.deb1
path: libprecice3_3.0.0_focal.deb
key: libprecice3_3.0.0_focal.deb1
restore-keys: libprecice3_3.0.0_focal.deb1

- name: Download preCICE
if: steps.cache-libprecice.outputs.cache-hit != 'true'
run: wget https://github.com/precice/precice/releases/download/v2.3.0/libprecice2_2.3.0_focal.deb
run: wget https://github.com/precice/precice/releases/download/v3.0.0/libprecice3_3.0.0_focal.deb

- name: Install preCICE
run: sudo apt install ./libprecice2_2.3.0_focal.deb
run: sudo apt install ./libprecice3_3.0.0_focal.deb

- name: Build Package
uses: julia-actions/julia-buildpkg@v1

- name: Run tests
uses: julia-actions/julia-runtest@v1
uses: julia-actions/julia-runtest@v1
47 changes: 28 additions & 19 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,64 @@
name: Run Tests
on: [push,pull_request]
on: # run on every push to main and develop, and on every pull request to main and develop
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
build:
runs-on: ubuntu-latest
container: precice/precice
strategy:
fail-fast: false
matrix:
julia-version: ['1.6.0','1.6.5','1.7.0','^1.7']
julia-version: ["1.8.0", "1.9.0", "1.10.0"]
julia-arch: [x64, x86]

steps:
- name: Install Julia
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: actions/checkout@v2
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4

- name: Build Package
uses: julia-actions/julia-buildpkg@v1

run_tests:
runs-on: ubuntu-latest
container: precice/precice
container: precice/precice:develop
needs: [build]
strategy:
fail-fast: false
matrix:
julia-version: ['1.6.0','1.6.5','1.7.0','^1.7']
julia-version: ["1.8.0", "1.9.0", "1.10.0"]
julia-arch: [x64, x86]

steps:
- name: Install Julia
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: actions/checkout@v2
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4

- name: Build Package
uses: julia-actions/julia-buildpkg@v1

- name: install make
run: |
apt update
apt install make

- name: Build Fake Solverinterface
- name: Build fake Solverinterface
run: |
cd test
make

- name: Add libprecice to LD_LIBRARY_PATH and adjust LD_PRELOAD
run: |
echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libcurl.so.4" >> $GITHUB_ENV

- name: Run tests
uses: julia-actions/julia-runtest@v1
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.6.0]
julia-version: [1.10.0]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ solverdummy/*.json
solverdummy/precice-run/
*.o
*.so
deps/build.log
deps/build.log
build/
.vscode/
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name = "PreCICE"
uuid = "57fbd4af-5cc3-4712-aac0-6930e7658184"
authors = ["preCICE <https://precice.org/> and contributors"]
version = "2.5.0"
version = "3.0.0"

[compat]
julia = "1.6"
julia = "1.10"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
66 changes: 64 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This package provides Julia language bindings for the C++ library [preCICE](http

Note that the first two digits of the version number of the bindings indicate the preCICE major and minor version that the bindings support. The last digit represents the version of the bindings. Example: `v2.5.1` and `v2.5.2` of the bindings represent versions `1` and `2` of the bindings that are compatible with preCICE `v2.5.0`.

Technical information about the initial design of these bindings can be found in the [Bachelor thesis of Pavel Kharitenko](http://dx.doi.org/10.18419/opus-11836).

## Adding and using the package

The Julia bindings for preCICE can be used by either by adding them as a package in a Julia environment or also directly including the package in a Julia script. For both type of usages preCICE needs to be installed on the system. For preCICE installation, have a look at the [installation documentation](https://precice.org/installation-overview.html).
Expand Down Expand Up @@ -49,6 +51,8 @@ pkg> add https://github.com/precice/PreCICE.jl#<branch-name>

## Troubleshooting

### Custom preCICE installation path

If preCICE is installed at a custom path, errors of the form ```ERROR: could not load library "/..."``` can occur after adding the Julia bindings package. Make sure the preCICE library is in the system library path through `echo $LD_LIBRARY_PATH` and otherwise update the variable with the correct path.

```bash
Expand All @@ -66,6 +70,64 @@ julia> using PreCICE
...
```

### Incompatible version of libstdc++

If you get an error message like:

```julia-repl
ERROR: LoadError: could not load library "libprecice"
/usr/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /usr/local/lib/libprecice.so)
```

It is caused by an incompatible version of `libstdc++` as described [in the issue](https://github.com/precice/PreCICE.jl/issues/44#issuecomment-1259655654). Julia ships its own libraries, which are older than the ones shipped by the system or the ones used to compile preCICE.

As a first solution, consider updating your julia version. The versions used in Julia are fairly up to date and should work with older systems. The problem is also known to the developers of Julia and they are [working on a solution](https://github.com/JuliaGL/GLFW.jl/issues/198). From Julia `v1.8.3` on, the problem [should be fixed](https://github.com/JuliaLang/julia/pull/46976).

If you cannot update your julia version, or the problem persists, you can try preloading the system `libstdc++`:

<details>
<summary>Click to expand</summary>

Preload the system `libstdc++` with

```bash
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 julia
```

You may have to [compile preCICE from source](https://precice.org/installation-source-preparation.html) for this to work.

On newer systems, preloading only the system `libstdc++` may not be sufficient. Errors of the form

```julia-repl
ERROR: ERROR: LoadError: LoadError: could not load library "libprecice"
/path/to/julia-1.8.1/bin/../lib/julia/libcurl.so: version `CURL_OPENSSL_4' not found (required by /lib/x86_64-linux-gnu/libhdf5_openmpi.so.103)could not load library "libprecice"
/path/to/julia-1.8.1/bin/../lib/julia/libcurl.so: version `CURL_OPENSSL_4' not found (required by /lib/x86_64-linux-gnu/libhdf5_openmpi.so.103)
```

can be resolved by preloading the system `libcurl`:

```bash
LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libcurl.so.4" julia
```

Again, you may have to [compile preCICE from source](https://precice.org/installation-source-preparation.html).

Adding the following lines to your `~/.bashrc` will help to avoid this error in the future:

```bash
alias julia='LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libcurl.so.4" julia'
```

You could instead move the julia libraries out of the way and create a symlink to the system libraries:

```bash
mv /path/to/julia/lib/julia/libstdc++.so.6 /path/to/julia/lib/julia/libstdc++.so.6.bak
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /path/to/julia/lib/julia/libstdc++.so.6
```

If the above approaches do not work, you may have to [compile preCICE from source](https://precice.org/installation-source-preparation.html) using the version of `libstdc++` that is shipped with Julia.
</details>

## Usage

The [solverdummy](https://github.com/precice/julia-bindings/tree/main/solverdummy) shows an example of how to use the Julia bindings for preCICE.
Expand All @@ -82,7 +144,7 @@ pkg> test PreCICE
This checks if the preCICE bindings can be found and accessed correctly.
You can also test the full functionality of PreCICE.jl. If not set up, the output of the previous test shows an info on what command you need to execute. It will be along the lines of:

```
```bash
cd /home/<user>/.julia/packages/PreCICE/<code>/test && make
```

Expand All @@ -94,6 +156,6 @@ This package works with official Julia binaries listed below. See the [Platform

## Supported versions

The package is tested for Julia versions `1.6.0`, `1.6.5`, `1.7.0` and the two newest [Julia releases](https://github.com/JuliaLang/julia/releases). Julia versions prior to `v1.6.0` are not supported.
The package is actively tested for Julia versions `1.8.0`, `1.9.0`, and `1.10.0`. Julia versions prior to `1.6.0` are not supported.

[Unofficial Julia binaries](https://julialang.org/downloads/platform/#platform_specific_instructions_for_unofficial_binaries) may not be compatible.
86 changes: 42 additions & 44 deletions solverdummy/precice-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,51 @@
enabled="true" />
</log>

<solver-interface dimensions="3">
<data:vector name="dataOne" />
<data:vector name="dataTwo" />
<data:vector name="Data-One" />
<data:vector name="Data-Two" />

<mesh name="MeshOne">
<use-data name="dataOne" />
<use-data name="dataTwo" />
</mesh>
<mesh name="SolverOne-Mesh" dimensions="3">
<use-data name="Data-One" />
<use-data name="Data-Two" />
</mesh>

<mesh name="MeshTwo">
<use-data name="dataOne" />
<use-data name="dataTwo" />
</mesh>
<mesh name="SolverTwo-Mesh" dimensions="3">
<use-data name="Data-One" />
<use-data name="Data-Two" />
</mesh>

<participant name="SolverOne">
<use-mesh name="MeshOne" provide="yes" />
<write-data name="dataOne" mesh="MeshOne" />
<read-data name="dataTwo" mesh="MeshOne" />
</participant>
<participant name="SolverOne">
<provide-mesh name="SolverOne-Mesh" />
<write-data name="Data-One" mesh="SolverOne-Mesh" />
<read-data name="Data-Two" mesh="SolverOne-Mesh" />
</participant>

<participant name="SolverTwo">
<use-mesh name="MeshOne" from="SolverOne" />
<use-mesh name="MeshTwo" provide="yes" />
<mapping:nearest-neighbor
direction="write"
from="MeshTwo"
to="MeshOne"
constraint="conservative" />
<mapping:nearest-neighbor
direction="read"
from="MeshOne"
to="MeshTwo"
constraint="consistent" />
<write-data name="dataTwo" mesh="MeshTwo" />
<read-data name="dataOne" mesh="MeshTwo" />
</participant>
<participant name="SolverTwo">
<receive-mesh name="SolverOne-Mesh" from="SolverOne" />
<provide-mesh name="SolverTwo-Mesh" />
<mapping:nearest-neighbor
direction="write"
from="SolverTwo-Mesh"
to="SolverOne-Mesh"
constraint="conservative" />
<mapping:nearest-neighbor
direction="read"
from="SolverOne-Mesh"
to="SolverTwo-Mesh"
constraint="consistent" />
<write-data name="Data-Two" mesh="SolverTwo-Mesh" />
<read-data name="Data-One" mesh="SolverTwo-Mesh" />
</participant>

<m2n:sockets from="SolverOne" to="SolverTwo" />
<m2n:sockets acceptor="SolverOne" connector="SolverTwo" />

<coupling-scheme:serial-implicit>
<participants first="SolverOne" second="SolverTwo" />
<max-time-windows value="2" />
<time-window-size value="1.0" />
<max-iterations value="2" />
<min-iteration-convergence-measure min-iterations="5" data="dataOne" mesh="MeshOne" />
<exchange data="dataOne" mesh="MeshOne" from="SolverOne" to="SolverTwo" />
<exchange data="dataTwo" mesh="MeshOne" from="SolverTwo" to="SolverOne" />
</coupling-scheme:serial-implicit>
</solver-interface>
</precice-configuration>
<coupling-scheme:serial-implicit>
<participants first="SolverOne" second="SolverTwo" />
<max-time-windows value="2" />
<time-window-size value="1.0" />
<max-iterations value="2" />
<min-iterations value="2"/>
<exchange data="Data-One" mesh="SolverOne-Mesh" from="SolverOne" to="SolverTwo" />
<exchange data="Data-Two" mesh="SolverOne-Mesh" from="SolverTwo" to="SolverOne" />
</coupling-scheme:serial-implicit>
</precice-configuration>
Loading
Loading