Skip to content
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/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ jobs:
- name: Install HDF5
run: |
sudo apt-get install -y libhdf5-openmpi-dev
- name: Install p4est
- name: Install t8code
run: |
P4EST_RELEASE=2.8.5
mkdir p4est-local
cd p4est-local
wget https://p4est.github.io/release/p4est-${P4EST_RELEASE}.tar.gz
tar xf p4est-${P4EST_RELEASE}.tar.gz
T8CODE_RELEASE=1.4.1
mkdir t8code-local
cd t8code-local
wget https://github.com/DLR-AMR/t8code/releases/download/v${T8CODE_RELEASE}/t8-${T8CODE_RELEASE}.tar.gz
tar xf t8-${T8CODE_RELEASE}.tar.gz
mkdir build
cd build
CC=mpicc CXX=mpicxx FC=mpif90 F77=mpif77 ../p4est-${P4EST_RELEASE}/configure \
CC=mpicc CXX=mpicxx ../t8-${T8CODE_RELEASE}/configure \
--prefix=$PWD/../prefix --enable-mpi
make -j 2
make install
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
cd libtrixi-julia
../install/bin/libtrixi-init-julia .. \
--hdf5-library /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so \
--p4est-library ../p4est-local/prefix/lib/libp4est.so \
--t8code-library ../t8code-local/prefix/lib/libt8.so \
--julia-depot ~/.julia \
--force
cp ../install/share/libtrixi/LibTrixi.jl/examples/libelixir_tree1d_dgsem_advection_basic.jl .
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Nevertheless, basic functionality is already implemented and actively tested.**

Currently, libtrixi is only developed and tested for Linux.
Furthermore, a local installation of `MPI`,
[`p4est`](https://github.com/cburstedde/p4est) (see steps 5-7 in its README), and
[`t8code`](https://github.com/DLR-AMR/t8code), and
[`Julia`](https://julialang.org/downloads/platform/) is required.

### Get the sources
Expand Down Expand Up @@ -82,7 +82,7 @@ available at `<install_directory>/bin`) to do the rest for you. A minimal exampl
mkdir libtrixi-julia
cd libtrixi-julia
<install_directory>/bin/libtrixi-init-julia \
--p4est-library <p4est_install_directory>/lib/libp4est.so
--t8code-library <t8code_install_directory>/lib/libt8.so
<install_directory>
```
Use `libtrixi-init-julia -h` to get help.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Nevertheless, basic functionality is already implemented and actively tested.**

Currently, libtrixi is only developed and tested for Linux.
Furthermore, a local installation of `MPI`,
[`p4est`](https://github.com/cburstedde/p4est) (see steps 5-7 in its README), and
[`t8code`](https://github.com/DLR-AMR/t8code), and
[`Julia`](https://julialang.org/downloads/platform/) is required.

### Get the sources
Expand Down Expand Up @@ -84,7 +84,7 @@ would be:
mkdir libtrixi-julia
cd libtrixi-julia
<install_directory>/bin/libtrixi-init-julia \
--p4est-library <p4est_install_directory>/lib/libp4est.so
--t8code-library <t8code_install_directory>/lib/libt8.so
<install_directory>
```
Use `libtrixi-init-julia -h` to get help.
Expand Down
67 changes: 52 additions & 15 deletions utils/libtrixi-init-julia
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ usage: libtrixi-init-julia [-h] [-f]
[--julia-depot JULIA_DEPOT]
[--julia-exec JULIA_EXEC]
[--mpi-library MPI_LIBRARY]
[--t8code-library T8CODE_LIBRARY]
[--p4est-library P4EST_LIBRARY]
[--sc-library P4EST_LIBRARY]
[--sc-library SC_LIBRARY]
PREFIX_OR_REPO

Set up all necessary project files in the current working directory and set appropriate
Expand Down Expand Up @@ -55,15 +56,22 @@ optional arguments:
'path/to/libmpi.so'. If empty, Julia will try to figure out the path
automatically. (default: '')

--t8code-library T8CODE_LIBRARY
Path to the t8code shared library, i.e., something like
'path/to/libt8.so'. If empty, Julia will try to figure out the path
automatically. (default: '')

--p4est-library P4EST_LIBRARY
Path to the p4est shared library, i.e., something like
'path/to/libp4est.so'. If empty, Julia will try to figure out the path
automatically. (default: '')
'path/to/libp4est.so'. If omitted, it will be assumed to be located
next to the t8code library. (default: '\$(dirname \$T8CODE_LIBRARY)/
libp4est.so')

--sc-library SC_LIBRARY
Path to the sc shared library, i.e., something like
'path/to/libsc.so'. If omitted, it will be assumed to be located next
to the p4est library. (default: '\$(dirname \$P4EST_LIBRARY)/libsc.so')
to the t8code library. (default: '\$(dirname \$T8CODE_LIBRARY)/
libsc.so')
EOF
}

Expand Down Expand Up @@ -113,6 +121,10 @@ while [[ $# -gt 0 ]]; do
LIBTRIXI_MPI_LIBRARY="$2"
shift 2
;;
--t8code-library)
LIBTRIXI_T8CODE_LIBRARY="$2"
shift 2
;;
--p4est-library)
LIBTRIXI_P4EST_LIBRARY="$2"
shift 2
Expand Down Expand Up @@ -180,12 +192,24 @@ if [ ! -f "$mpi_library" ]; then
die "MPI library '$mpi_library' not found" 2
fi

# Check if libpest.so was given by the user or try to find it using Julia
if [ -z "$LIBTRIXI_P4EST_LIBRARY" ]; then
p4est_libdir="$($julia_exec -e 'using Libdl; find_library("libp4est") |> dlpath |> dirname |> println')"
if [ -z "$p4est_libdir" ]; then
die "location of p4est library could not be determined automatically (use '--p4est-library' instead)"
# Check if libt8.so was given by the user or try to find it using Julia
if [ -z "$LIBTRIXI_T8CODE_LIBRARY" ]; then
t8code_libdir="$($julia_exec -e 'using Libdl; find_library("libt8") |> dlpath |> dirname |> println')"
if [ -z "$t8code_libdir" ]; then
die "location of t8code library could not be determined automatically (use '--t8code-library' instead)"
fi
else
t8code_libdir="$(dirname $LIBTRIXI_T8CODE_LIBRARY)"
fi
t8code_libdir_abs="$(cd $t8code_libdir && pwd)"
t8code_library="$t8code_libdir_abs/libt8.so"
if [ ! -f "$t8code_library" ]; then
die "t8code library '$t8code_library' not found" 2
fi

# Check if libp4est.so was given by the user or else assume it is next to libt8.so
if [ -z "$LIBTRIXI_P4EST_LIBRARY" ]; then
p4est_libdir="$t8code_libdir"
else
p4est_libdir="$(dirname $LIBTRIXI_P4EST_LIBRARY)"
fi
Expand All @@ -195,9 +219,9 @@ if [ ! -f "$p4est_library" ]; then
die "p4est library '$p4est_library' not found" 2
fi

# Check if libsc.so was given by the user or else assume it is next to libp4est.so
# Check if libsc.so was given by the user or else assume it is next to libt8.so
if [ -z "$LIBTRIXI_SC_LIBRARY" ]; then
sc_libdir="$p4est_libdir"
sc_libdir="$t8code_libdir"
else
sc_libdir="$(dirname $LIBTRIXI_SC_LIBRARY)"
fi
Expand Down Expand Up @@ -236,9 +260,8 @@ JULIA_DEPOT_PATH="$julia_depot" JULIA_PKG_PRECOMPILE_AUTO=0 \
$julia_exec --project=. \
-e "
using Pkg
Pkg.add([\"Preferences\", \"UUIDs\", \"MPIPreferences\", \"P4est\", \"HDF5\", \
\"MPI\"])
"
Pkg.add([\"Preferences\", \"UUIDs\", \"MPIPreferences\", \"T8code\", \
\"P4est\", \"HDF5\", \"MPI\"])"
[ $? -eq 0 ] || die "could not install dependencies"
echo

Expand All @@ -252,14 +275,28 @@ MPIPreferences.use_system_binary(; library_names=\"$mpi_library\")
[ $? -eq 0 ] || die "could not configure system MPI library for Julia"
echo

# Set system t8code library
echo "Use system t8code for Julia... "
JULIA_DEPOT_PATH="$julia_depot" $julia_exec --project=. \
-e "
using Preferences, UUIDs
set_preferences!(UUID(\"d0cc0030-9a40-4274-8435-baadcfd54fa1\"),
\"libt8\" => \"$t8code_library\",
\"libp4est\" => \"$p4est_library\",
\"libsc\" => \"$sc_library\",
force = true)
"
[ $? -eq 0 ] || die "could not configure system t8code library for Julia"
echo

# Set system p4est library
echo "Use system p4est for Julia... "
JULIA_DEPOT_PATH="$julia_depot" $julia_exec --project=. \
-e "
using Preferences, UUIDs
set_preferences!(UUID(\"7d669430-f675-4ae7-b43e-fab78ec5a902\"),
\"libp4est\" => \"$p4est_library\",
\"libpsc\" => \"$sc_library\",
\"libsc\" => \"$sc_library\",
force = true)
"
[ $? -eq 0 ] || die "could not configure system p4est library for Julia"
Expand Down