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
80 changes: 19 additions & 61 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- '**.c'
- '**.cpp'
- '**.cppm'
- '**.h'
- '**.hpp'
- '**.cmake'
Expand All @@ -14,97 +15,54 @@ on:
paths:
- '**.c'
- '**.cpp'
- '**.cppm'
- '**.h'
- '**.hpp'
- '**.cmake'
- '**/CMakeLists.txt'
- '.github/workflows/Build.yml'
jobs:
generate:
name: ${{ matrix.os }}/${{ matrix.compiler }}/MPI${{ matrix.mpi }}/${{ matrix.mode }}
runs-on: ${{ matrix.os }}
name: MPI${{ matrix.mpi }}/${{ matrix.mode }}
runs-on: ubuntu-24.04
container:
image: luohaothu/gcc-trunk:latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-12]
compiler: [clang, gcc]
mpi: [ON, OFF]
mode: [Debug, Release]
exclude :
- os: macos-12
compiler: clang
mpi: ON
mode: Release # clang tends to emit illegal inst for macOS with MPI on release mode (-O3)
if: "!contains(github.event.head_commit.message, 'skip build')"
steps:
- name: Checkout
uses: actions/checkout@master
with:
submodules: recursive
fetch-depth: 0
- name: Install dependence
run: |
export INPUT_MPI=${{ matrix.mpi }}
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install doxygen tbb llvm
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update && sudo apt install -y gcc-12 g++-12 python3-pip python3-sphinx lcov libboost-all-dev libomp-12-dev clang-12
if [ "$INPUT_MPI" == "ON" ]; then
sudo apt install -y libopenmpi-dev libhdf5-mpi-dev
else
sudo apt install -y libhdf5-dev
fi
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install lcov boost
if [ "$INPUT_MPI" == "ON" ]; then
brew install open-mpi hdf5-mpi
else
brew install hdf5
fi
else
echo "$RUNNER_OS not supported"
exit 1
fi
python3 -m pip install sphinx sphinx-rtd-dark-mode breathe
- name: Make directory
run: mkdir -p build
- name: Generate
working-directory: ./build
run: |
# need to add the python path to the environment
if [ "$RUNNER_OS" == "macOS" ]; then
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin"
fi
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
if [ "${{ matrix.compiler }}" == "clang" ]; then
if [ "$RUNNER_OS" == "Linux" ]; then
cmake -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 \
-DOPFLOW_WITH_HDF5=ON -DBENCHMARK_ENABLE_TESTING=OFF -DOPFLOW_BUILD_ALL=ON -DOPFLOW_INSTALL=OFF \
-DOPFLOW_WITH_VTK=OFF -DOPFLOW_TBB_EXTERNAL=ON -DDOXYGEN_DIR=$(brew --prefix doxygen)/bin \
-DTBB_DIR=$(brew --prefix tbb)/lib/cmake/TBB -DOPFLOW_WITH_MPI=${{ matrix.mpi }} ..
else
cmake -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ \
-DOPFLOW_WITH_HDF5=ON -DBENCHMARK_ENABLE_TESTING=OFF -DOPFLOW_BUILD_ALL=ON -DOPFLOW_INSTALL=OFF \
-DOPFLOW_WITH_VTK=OFF -DOPFLOW_TBB_EXTERNAL=ON -DDOXYGEN_DIR=$(brew --prefix doxygen)/bin \
-DTBB_DIR=$(brew --prefix tbb)/lib/cmake/TBB -DOPFLOW_WITH_MPI=${{ matrix.mpi }} ..
fi
else
cmake -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 \
-DOPFLOW_WITH_HDF5=ON -DBENCHMARK_ENABLE_TESTING=OFF -DOPFLOW_BUILD_ALL=ON -DOPFLOW_INSTALL=OFF \
-DOPFLOW_WITH_VTK=OFF -DOPFLOW_TBB_EXTERNAL=ON -DDOXYGEN_DIR=$(brew --prefix doxygen)/bin \
-DTBB_DIR=$(brew --prefix tbb)/lib/cmake/TBB -DOPFLOW_WITH_MPI=${{ matrix.mpi }} ..
fi
wget https://github.com/Kitware/CMake/releases/download/v4.0.2/cmake-4.0.2-linux-x86_64.sh
chmod +x cmake-4.0.2-linux-x86_64.sh
mkdir -p cmake
./cmake-4.0.2-linux-x86_64.sh --skip-license --prefix=$(pwd)/cmake
apt update && apt install -y ninja-build libhdf5-dev libhdf5-openmpi-dev libboost-all-dev python3-pip python3-sphinx doxygen
export PATH=$(pwd)/cmake/bin:$PATH
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -G Ninja -B build \
-DCMAKE_INSTALL_PREFIX=$(pwd)/install -DOPFLOW_BUILD_ALL=ON -DOPFLOW_ENABLE_MODULE=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DOPFLOW_WITH_HDF5=ON -DOPFLOW_WITH_MPI=${{ matrix.mpi }}
if [ "$RUNNER_OS" == "Linux" ]; then
cmake --build . -t All_CI --parallel 2 --config ${{ matrix.mode }}
cmake --build build -t All_CI --parallel $(nproc) --config ${{ matrix.mode }}
else
cmake --build . -t All_CI --parallel 3 --config ${{ matrix.mode }}
cmake --build build -t All_CI --parallel $(nproc) --config ${{ matrix.mode }}
fi
- name: Test
working-directory: ./build
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
ctest --parallel 2 -C ${{ matrix.mode }} -VV
ctest --parallel $(nproc) -C ${{ matrix.mode }} -VV
else
ctest --parallel 3 -C ${{ matrix.mode }} -VV
ctest --parallel $(nproc) -C ${{ matrix.mode }} -VV
fi
7 changes: 2 additions & 5 deletions examples/AMR/Poisson.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include "Poisson.hpp"
#define FMT_HEADER_ONLY
#include "fmt/chrono.h"
#include "fmt/compile.h"
#include "pch.hpp"
#include <filesystem>

Expand Down Expand Up @@ -86,8 +83,8 @@ void Poisson() {
.build();
//p.initBy([](auto&& x) { return std::sqrt(Math::pow2(x[0] - 0.5) + Math::pow2(x[1] - 0.75)) - 0.15; });
p = 0;
auto _fmt = FMT_COMPILE("Result_{:%m-%d_%H-%M-%S}");
auto root = fmt::format(_fmt, fmt::localtime(std::time(nullptr)));
auto root = std::format("Result_{:%m-%d_%H-%M-%S}/",
std::chrono::current_zone()->to_local(std::chrono::system_clock::now()));
std::filesystem::create_directory(root);

SemiStructSolverParams<SemiStructSolverType::FAC> params;
Expand Down
4 changes: 2 additions & 2 deletions examples/AMR/SSHypre.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "SSHypre.hpp"
#include "fmt/format.h"
#include <HYPRE.h>
#include <HYPRE_sstruct_ls.h>
#include <HYPRE_sstruct_mv.h>
#include <format>
#include <iostream>

void sshypre_d2() {
Expand Down Expand Up @@ -242,5 +242,5 @@ void sshypre_d2() {
HYPRE_SStructFACGetNumIterations(solver, &num_iterations);
HYPRE_SStructFACGetFinalRelativeResidualNorm(solver, &final_res_norm);
HYPRE_SStructFACDestroy2(solver);
std::cout << fmt::format("Iter = {}, Res = {}\n", num_iterations, final_res_norm);
std::cout << std::format("Iter = {}, Res = {}\n", num_iterations, final_res_norm);
}
12 changes: 6 additions & 6 deletions examples/LevelSet/AMRLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// ----------------------------------------------------------------------------

#include <OpFlow>
#include <fmt/chrono.h>
#include <fmt/compile.h>
#include <chrono>
#include <format>

using namespace OpFlow;

Expand Down Expand Up @@ -95,8 +95,8 @@ void amrls() {
return -2 * std::sin(PI * x[0]) * std::cos(PI * x[0]) * Math::pow2(std::sin(PI * x[1]));
});

auto _fmt = FMT_COMPILE("Result_{:%m-%d_%H-%M-%S}/");
auto root = fmt::format(_fmt, fmt::localtime(std::time(nullptr)));
auto root = std::format("Result_{:%m-%d_%H-%M-%S}/",
std::chrono::current_zone()->to_local(std::chrono::system_clock::now()));
Utils::VTKAMRStream uf(root + "u"), vf(root + "v"), pf(root + "p"), p1f(root + "p1"), p2f(root + "p2"),
p3f(root + "p3");
uf << Utils::TimeStamp(0) << u;
Expand Down Expand Up @@ -290,8 +290,8 @@ void amrls_3d() {
return -std::sin(2 * PI * x[0]) * std::sin(2 * PI * x[1]) * Math::pow2(std::sin(PI * x[2]));
});

auto _fmt = FMT_COMPILE("Result_{:%m-%d_%H-%M-%S}/");
auto root = fmt::format(_fmt, fmt::localtime(std::time(nullptr)));
auto root = std::format("Result_{:%m-%d_%H-%M-%S}/",
std::chrono::current_zone()->to_local(std::chrono::system_clock::now()));
Utils::VTKAMRStream uf(root + "u"), vf(root + "v"), wf(root + "w"), pf(root + "p"), p1f(root + "p1"),
p2f(root + "p2"), p3f(root + "p3");
uf << Utils::TimeStamp(0) << u;
Expand Down
4 changes: 2 additions & 2 deletions examples/LevelSet/UniLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// ----------------------------------------------------------------------------

#include <OpFlow>
#include <fmt/chrono.h>

using namespace OpFlow;

Expand Down Expand Up @@ -182,7 +181,8 @@ void ls_3d() {
return -std::sin(2 * PI * x[0]) * std::sin(2 * PI * x[1]) * Math::pow2(std::sin(PI * x[2]));
});

auto root = fmt::format("Result_{:%m-%d_%H-%M-%S}/", fmt::localtime(std::time(nullptr)));
auto root = std::format("Result_{:%m-%d_%H-%M-%S}/",
std::chrono::current_zone()->to_local(std::chrono::system_clock::now()));
Utils::TecplotASCIIStream uf("u.tec"), vf("v.tec"), wf("w.tec"), pf("p.tec");
uf << Utils::TimeStamp(0) << u;
vf << Utils::TimeStamp(0) << v;
Expand Down
Loading
Loading