Skip to content
Open
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
3 changes: 3 additions & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ jobs:
cd docs/doxygen
doxygen
- name: Deploy doxygen docs
if: >-
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
Comment on lines +74 to +76

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to prevent deploying from PRs?

uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,103 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && always() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15

macos-smoke:
name: macos-latest - smoke - Julia 1.11 - ${{ github.event_name }}
runs-on: macos-latest
env:
JULIA_DEPOT_PATH: ~/.julia
T8CODE_VERSION: '3.0.1'
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Enable Julia cache
uses: julia-actions/cache@v3

- name: Enable t8code cache
id: cache-t8code
uses: actions/cache@v5
with:
path: ./t8code-local
key: ${{ runner.os }}-t8code-${{ env.T8CODE_VERSION }}

- name: Install Julia
uses: julia-actions/setup-julia@v3
with:
version: '1.11'

- name: Install dependencies available with Homebrew
run: |
brew install cmake gcc open-mpi hdf5
# Point Open MPI at Homebrew GCC's Fortran compiler
GFORTRAN="$(command -v gfortran || true)"
if [ -z "$GFORTRAN" ]; then
GFORTRAN="$(find "$(brew --prefix gcc)/bin" -name 'gfortran-*' | head -n 1)"
fi
if [ -z "$GFORTRAN" ]; then
echo "gfortran not found" >&2
exit 1
fi
echo "FC=$GFORTRAN" >> "$GITHUB_ENV"
echo "OMPI_FC=$GFORTRAN" >> "$GITHUB_ENV"

- name: Install t8code
if: steps.cache-t8code.outputs.cache-hit != 'true'
run: |
mkdir t8code-local
cd t8code-local
T8CODE_SOURCE=T8CODE-${T8CODE_VERSION}-Source
T8CODE_URL=https://github.com/DLR-AMR/t8code/releases/download
curl -L -O "$T8CODE_URL/v${T8CODE_VERSION}/$T8CODE_SOURCE.tar.gz"
tar xf "$T8CODE_SOURCE.tar.gz"
cmake -S "$T8CODE_SOURCE" -B build \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_CXX_COMPILER=mpicxx \
-DCMAKE_Fortran_COMPILER=mpifort \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PWD/prefix" \
-DT8CODE_BUILD_TESTS=OFF \
-DT8CODE_BUILD_TUTORIALS=OFF \
-DT8CODE_BUILD_EXAMPLES=OFF \
-DT8CODE_BUILD_BENCHMARKS=OFF \
-DT8CODE_ENABLE_MPI=ON \
-DT8CODE_BUILD_FORTRAN_INTERFACE=ON
cmake --build build --parallel 2
cmake --install build

- name: Build
run: |
cmake -S . -B build \
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
-DCMAKE_BUILD_TYPE=Release \
-DT8CODE_ROOT="$PWD/t8code-local/prefix"
cmake --build build --parallel 2
cmake --install build

- name: Run examples
run: |
mkdir libtrixi-julia
cd libtrixi-julia
EXAMPLES_DIR=../install/share/libtrixi/LibTrixi.jl/examples
cp "$EXAMPLES_DIR/libelixir_t8code2d_euler_tracer_amr.jl" .
HDF5_PREFIX="$(brew --prefix hdf5)"
MPI_PREFIX="$(brew --prefix open-mpi)"
../install/bin/libtrixi-init-julia .. \
--hdf5-library "$HDF5_PREFIX/lib/libhdf5.dylib" \
--mpi-library "$MPI_PREFIX/lib/libmpi.dylib" \
--t8code-library ../t8code-local/prefix/lib/libt8.dylib \
--julia-depot ~/.julia \
--skip-precompile \
--force
mkdir run-c run-f
PROJECT_DIR="$PWD"
LIBELIXIR_PATH="$PROJECT_DIR/libelixir_t8code2d_euler_tracer_amr.jl"
cd run-c
../../build/examples/trixi_controller_t8code_c \
"$PROJECT_DIR" "$LIBELIXIR_PATH"
cd ../run-f
../../build/examples/trixi_controller_t8code_f \
"$PROJECT_DIR" "$LIBELIXIR_PATH"
env:
LIBTRIXI_DEBUG: all
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

### Prerequisites

Currently, libtrixi is only developed and tested for Linux. Furthermore, the following
Currently, libtrixi is developed and tested for Linux and macOS. Furthermore, the following

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Currently, libtrixi is developed and tested for Linux and macOS. Furthermore, the following
Currently, libtrixi is developed and tested for Linux and (experimentally) for macOS. Furthermore, the following

software packages need to be made available locally before installing libtrixi:
* [Julia](https://julialang.org/downloads/platform/) v1.8+
* C compiler with support for C11 or later (e.g., [gcc](https://gcc.gnu.org/) or [clang](https://clang.llvm.org/))
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindJulia.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ endif()
# Get flags
#
execute_process(
COMMAND ${JULIA_SHARE}/julia-config.jl --cflags
COMMAND ${JULIA_EXECUTABLE} ${JULIA_SHARE}/julia-config.jl --cflags
OUTPUT_VARIABLE JULIA_CFLAGS
RESULT_VARIABLE RESULT
)

execute_process(
COMMAND ${JULIA_SHARE}/julia-config.jl --ldflags
COMMAND ${JULIA_EXECUTABLE} ${JULIA_SHARE}/julia-config.jl --ldflags
OUTPUT_VARIABLE JULIA_LDFLAGS
RESULT_VARIABLE RESULT
)

execute_process(
COMMAND ${JULIA_SHARE}/julia-config.jl --ldlibs
COMMAND ${JULIA_EXECUTABLE} ${JULIA_SHARE}/julia-config.jl --ldlibs
OUTPUT_VARIABLE JULIA_LDLIBS
RESULT_VARIABLE RESULT
)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

### Prerequisites

Currently, libtrixi is only developed and tested for Linux. Furthermore, the following
Currently, libtrixi is developed and tested for Linux and macOS. Furthermore, the following

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Currently, libtrixi is developed and tested for Linux and macOS. Furthermore, the following
Currently, libtrixi is developed and tested for Linux and (experimentally) for macOS. Furthermore, the following

software packages need to be made available locally before installing libtrixi:
* [Julia](https://julialang.org/downloads/platform/) v1.8+
* C compiler with support for C11 or later (e.g., [gcc](https://gcc.gnu.org/) or [clang](https://clang.llvm.org/))
Expand Down
6 changes: 5 additions & 1 deletion examples/trixi_controller_t8code.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <stdio.h>
#include <inttypes.h>

#include <t8.h>
#include <t8_forest/t8_forest_general.h>
Expand All @@ -22,7 +23,10 @@ void t8_print_forest_information (t8_forest_t forest)
global_num_elements = t8_forest_get_global_num_elements (forest);

printf ("\n*** T8code *** Local number of elements:\t%i\n", local_num_elements);
printf ("*** T8code *** Global number of elements:\t%li\n", global_num_elements);

// Using PRId64 to print t8_gloidx_t portably across platforms
printf ("*** T8code *** Global number of elements:\t%" PRId64 "\n",
global_num_elements);
}


Expand Down
80 changes: 51 additions & 29 deletions utils/libtrixi-init-julia
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,28 @@ optional arguments:

--hdf5-library HDF5_LIBRARY
Path to the HDF5 shared library, i.e., something like
'path/to/libhdf5.so'. If empty, Julia will try to figure out the path
automatically. (default: '')
'path/to/libhdf5.so' or 'path/to/libhdf5.dylib'. If empty, Julia
will try to figure out the path automatically. (default: '')

--mpi-library MPI_LIBRARY
Path to the MPI C shared library, i.e., something like
'path/to/libmpi.so'. If empty, Julia will try to figure out the path
automatically. (default: '')
'path/to/libmpi.so' or 'path/to/libmpi.dylib'. 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: '')
'path/to/libt8.so' or 'path/to/libt8.dylib'. 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 omitted, it will be assumed to be located
next to the t8code library. (default: '\$(dirname \$T8CODE_LIBRARY)/
libp4est.so')
'path/to/libp4est.so' or 'path/to/libp4est.dylib'. If omitted, it
will be assumed to be located next to the t8code library.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the default?


--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 t8code library. (default: '\$(dirname \$T8CODE_LIBRARY)/
libsc.so')
'path/to/libsc.so' or 'path/to/libsc.dylib'. If omitted, it will be
assumed to be located next to the t8code library.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the default?

EOF
}

Expand Down Expand Up @@ -171,29 +169,50 @@ julia_exec="$LIBTRIXI_JULIA_EXEC"
# Save Julia depot path
julia_depot="$LIBTRIXI_JULIA_DEPOT"

# Check if libhdf5.so was given by the user or try to find it using Julia
# Determine platform shared library suffix
case "$(uname -s)" in
Linux)
shared_library_suffix=so
;;
Darwin)
shared_library_suffix=dylib
;;
*)
shared_library_suffix=so
;;
esac

# Check if the HDF5 library was given by the user or try to find it using Julia
if [ -z "$LIBTRIXI_HDF5_LIBRARY" ]; then
hdf5_libdir="$($julia_exec -e 'using Libdl; find_library("libhdf5") |> dlpath |> dirname |> println')"
if [ -z "$hdf5_libdir" ]; then
die "location of hdf5 library could not be determined automatically (use '--hdf5-library' instead)"
hdf5_library="$($julia_exec -e '
using Libdl
path = find_library("libhdf5")
isempty(path) || println(dlpath(path))')"
if [ -z "$hdf5_library" ]; then
die "location of hdf5 library could not be determined; use --hdf5-library"
fi
else
hdf5_libdir="$(dirname $LIBTRIXI_HDF5_LIBRARY)"
hdf5_library="$LIBTRIXI_HDF5_LIBRARY"
fi
hdf5_library="$hdf5_libdir/libhdf5.so"
if [ ! -f "$hdf5_library" ]; then
die "hdf5 library '$hdf5_library' not found" 2
fi
hdf5_hl_library="$hdf5_libdir/libhdf5_hl.so"
hdf5_libdir="$(dirname $hdf5_library)"
hdf5_hl_library="$hdf5_libdir/libhdf5_hl.$shared_library_suffix"
if [ ! -f "$hdf5_hl_library" ]; then
die "hdf5 library '$hdf5_hl_library' not found" 2
fi

# Check if MPI library was given by the user or try to find it using Julia
if [ -z "$LIBTRIXI_MPI_LIBRARY" ]; then
mpi_library="$($julia_exec -e 'using Libdl; find_library(["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpi_cray", "libmpitrampoline"]) |> dlpath |> println')"
mpi_library="$($julia_exec -e '
using Libdl
libraries = ["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpi_cray",
"libmpitrampoline"]
path = find_library(libraries)
isempty(path) || println(dlpath(path))')"
if [ -z "$mpi_library" ]; then
die "location of MPI library could not be determined automatically (use '--mpi-library' instead)"
die "location of MPI library could not be determined; use --mpi-library"
fi
else
mpi_library="$LIBTRIXI_MPI_LIBRARY"
Expand All @@ -202,41 +221,44 @@ if [ ! -f "$mpi_library" ]; then
die "MPI library '$mpi_library' not found" 2
fi

# Check if libt8.so was given by the user or try to find it using Julia
# Check if libt8 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')"
t8code_libdir="$($julia_exec -e '
using Libdl
path = find_library("libt8")
isempty(path) || println(dirname(dlpath(path)))')"
if [ -z "$t8code_libdir" ]; then
die "location of t8code library could not be determined automatically (use '--t8code-library' instead)"
die "location of t8code library could not be determined; use --t8code-library"
fi
else
t8code_libdir="$(dirname $LIBTRIXI_T8CODE_LIBRARY)"
fi
t8code_libdir_abs="$(cd $t8code_libdir && pwd)"
t8code_library="$t8code_libdir_abs/libt8.so"
t8code_library="$t8code_libdir_abs/libt8.$shared_library_suffix"
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
# Check if libp4est was given by the user or else assume it is next to libt8
if [ -z "$LIBTRIXI_P4EST_LIBRARY" ]; then
p4est_libdir="$t8code_libdir"
else
p4est_libdir="$(dirname $LIBTRIXI_P4EST_LIBRARY)"
fi
p4est_libdir_abs="$(cd $p4est_libdir && pwd)"
p4est_library="$p4est_libdir_abs/libp4est.so"
p4est_library="$p4est_libdir_abs/libp4est.$shared_library_suffix"
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 libt8.so
# Check if libsc was given by the user or else assume it is next to libt8
if [ -z "$LIBTRIXI_SC_LIBRARY" ]; then
sc_libdir="$t8code_libdir"
else
sc_libdir="$(dirname $LIBTRIXI_SC_LIBRARY)"
fi
sc_libdir_abs="$(cd $sc_libdir && pwd)"
sc_library="$sc_libdir_abs/libsc.so"
sc_library="$sc_libdir_abs/libsc.$shared_library_suffix"
if [ ! -f "$sc_library" ]; then
die "sc library '$sc_library' not found" 2
fi
Expand Down
Loading