diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d7f3a65d..c7ee362f 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -5,6 +5,7 @@ on: paths: - '**.c' - '**.cpp' + - '**.cppm' - '**.h' - '**.hpp' - '**.cmake' @@ -14,6 +15,7 @@ on: paths: - '**.c' - '**.cpp' + - '**.cppm' - '**.h' - '**.hpp' - '**.cmake' @@ -21,20 +23,15 @@ on: - '.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 @@ -42,69 +39,30 @@ jobs: 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 diff --git a/examples/AMR/Poisson.cpp b/examples/AMR/Poisson.cpp index 28d25ef2..688d87be 100644 --- a/examples/AMR/Poisson.cpp +++ b/examples/AMR/Poisson.cpp @@ -1,7 +1,4 @@ #include "Poisson.hpp" -#define FMT_HEADER_ONLY -#include "fmt/chrono.h" -#include "fmt/compile.h" #include "pch.hpp" #include @@ -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 params; diff --git a/examples/AMR/SSHypre.cpp b/examples/AMR/SSHypre.cpp index 668b4ab7..979fad35 100644 --- a/examples/AMR/SSHypre.cpp +++ b/examples/AMR/SSHypre.cpp @@ -1,8 +1,8 @@ #include "SSHypre.hpp" -#include "fmt/format.h" #include #include #include +#include #include void sshypre_d2() { @@ -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); } \ No newline at end of file diff --git a/examples/LevelSet/AMRLS.cpp b/examples/LevelSet/AMRLS.cpp index f14ecdfb..35cd33a5 100644 --- a/examples/LevelSet/AMRLS.cpp +++ b/examples/LevelSet/AMRLS.cpp @@ -11,8 +11,8 @@ // ---------------------------------------------------------------------------- #include -#include -#include +#include +#include using namespace OpFlow; @@ -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; @@ -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; diff --git a/examples/LevelSet/UniLS.cpp b/examples/LevelSet/UniLS.cpp index 4f56b49d..d07d6d8d 100644 --- a/examples/LevelSet/UniLS.cpp +++ b/examples/LevelSet/UniLS.cpp @@ -11,7 +11,6 @@ // ---------------------------------------------------------------------------- #include -#include using namespace OpFlow; @@ -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; diff --git a/external/hypre/src/struct_mv/_hypre_struct_mv.hpp b/external/hypre/src/struct_mv/_hypre_struct_mv.hpp index 672c45e3..f8775924 100644 --- a/external/hypre/src/struct_mv/_hypre_struct_mv.hpp +++ b/external/hypre/src/struct_mv/_hypre_struct_mv.hpp @@ -148,7 +148,7 @@ hypre_CheckErrorDevice(cudaDeviceSynchronize()); { #define zypre_newBoxLoop0End() \ - }); \ + }); \ hypre_fence(); \ } @@ -178,7 +178,7 @@ hypre_CheckErrorDevice(cudaDeviceSynchronize()); zypre_BoxLoopIncK(2,databox2,i2); #define zypre_newBoxLoop2End(i1, i2) \ - }); \ + }); \ hypre_fence(); \ } @@ -218,7 +218,7 @@ hypre_CheckErrorDevice(cudaDeviceSynchronize()); zypre_BoxLoopIncK(4,databox4,i4); #define zypre_newBoxLoop4End(i1, i2, i3, i4) \ - }); \ + }); \ hypre_fence(); \ } @@ -268,7 +268,7 @@ hypre_CheckErrorDevice(cudaDeviceSynchronize()); { #define hypre_LoopEnd() \ - }); \ + }); \ hypre_fence(); \ } @@ -426,7 +426,7 @@ typedef struct hypre_Boxloop_struct { { #define hypre_newBoxLoop0End(i1) \ - }); \ + }); \ hypre_fence(); \ } @@ -440,7 +440,7 @@ typedef struct hypre_Boxloop_struct { hypre_BoxLoopIncK(1,databox1,i1); #define hypre_newBoxLoop1End(i1) \ - }); \ + }); \ hypre_fence(); \ } @@ -456,7 +456,7 @@ typedef struct hypre_Boxloop_struct { hypre_BoxLoopIncK(2,databox2,i2); #define hypre_newBoxLoop2End(i1, i2) \ - }); \ + }); \ hypre_fence(); \ } @@ -475,7 +475,7 @@ typedef struct hypre_Boxloop_struct { hypre_BoxLoopIncK(3,databox3,i3); #define hypre_newBoxLoop3End(i1, i2, i3) \ - }); \ + }); \ hypre_fence(); \ } @@ -496,7 +496,7 @@ typedef struct hypre_Boxloop_struct { hypre_BoxLoopIncK(4,databox4,i4); #define hypre_newBoxLoop4End(i1, i2, i3, i4) \ - }); \ + }); \ hypre_fence(); \ } @@ -553,7 +553,7 @@ typedef struct hypre_Boxloop_struct { hypre_BoxLoopIncK(1,databox1,i1); #define hypre_BoxLoop1ReductionEnd(i1, HYPRE_BOX_REDUCTION) \ - }, HYPRE_BOX_REDUCTION); \ + }, HYPRE_BOX_REDUCTION); \ hypre_fence(); \ HYPRE_BOX_REDUCTION += __hypre_sum_tmp; \ } @@ -574,7 +574,7 @@ typedef struct hypre_Boxloop_struct { hypre_BoxLoopIncK(2,databox2,i2); #define hypre_BoxLoop2ReductionEnd(i1, i2, HYPRE_BOX_REDUCTION) \ - }, HYPRE_BOX_REDUCTION); \ + }, HYPRE_BOX_REDUCTION); \ hypre_fence(); \ HYPRE_BOX_REDUCTION += __hypre_sum_tmp; \ } @@ -585,7 +585,7 @@ typedef struct hypre_Boxloop_struct { { #define hypre_LoopEnd() \ - }); \ + }); \ hypre_fence(); \ } @@ -872,7 +872,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b { #define hypre_BoxLoop0EndCUDA() \ - }); \ + }); \ } /* BoxLoop 1 */ @@ -886,7 +886,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b hypre_BoxLoopIncK(1, databox1, i1); #define hypre_BoxLoop1EndCUDA(i1) \ - }); \ + }); \ } /* BoxLoop 2 */ @@ -902,7 +902,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b hypre_BoxLoopIncK(2, databox2, i2); #define hypre_BoxLoop2EndCUDA(i1, i2) \ - }); \ + }); \ } /* BoxLoop 3 */ @@ -921,7 +921,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b hypre_BoxLoopIncK(3, databox3, i3); #define hypre_BoxLoop3EndCUDA(i1, i2, i3) \ - }); \ + }); \ } /* BoxLoop 4 */ @@ -942,7 +942,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b hypre_BoxLoopIncK(4, databox4, i4); #define hypre_BoxLoop4EndCUDA(i1, i2, i3, i4) \ - }); \ + }); \ } /* Basic BoxLoops have no boxes */ @@ -975,7 +975,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b { #define hypre_LoopEndCUDA() \ - }); \ + }); \ } /* Reduction BoxLoop1 */ @@ -989,7 +989,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b hypre_BoxLoopIncK(1, databox1, i1); #define hypre_BoxLoop1ReductionEndCUDA(i1, reducesum) \ - }); \ + }); \ } /* Reduction BoxLoop2 */ @@ -1006,7 +1006,7 @@ void ReductionBoxLoopforall(HYPRE_Int length, REDUCER &reducer, LOOP_BODY loop_b hypre_BoxLoopIncK(2, databox2, i2); #define hypre_BoxLoop2ReductionEndCUDA(i1, i2, reducesum) \ - }); \ + }); \ } /* Renamings */ @@ -1237,7 +1237,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_newBoxLoop0End() \ } \ - }); \ + }); \ } /* BoxLoop 1 */ @@ -1255,7 +1255,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_newBoxLoop1End(i1) \ } \ - }); \ + }); \ } /* BoxLoop 2 */ @@ -1275,7 +1275,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_newBoxLoop2End(i1, i2) \ } \ - }); \ + }); \ } /* BoxLoop 3 */ @@ -1298,7 +1298,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_newBoxLoop3End(i1, i2, i3) \ } \ - }); \ + }); \ } /* BoxLoop 4 */ @@ -1323,7 +1323,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_newBoxLoop4End(i1, i2, i3, i4) \ } \ - }); \ + }); \ } /* Basic BoxLoops have no boxes */ @@ -1372,7 +1372,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_newBoxLoop1ReductionEnd(i1, sum_var) \ } \ - }, hypre__tot, shared_sum_var); \ + }, hypre__tot, shared_sum_var); \ hypre_TMemcpy(&sum_var, shared_sum_var, HYPRE_Real, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); \ hypre_TFree(shared_sum_var, HYPRE_MEMORY_DEVICE); \ } @@ -1397,7 +1397,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_newBoxLoop2ReductionEnd(i1, i2, sum_var) \ } \ - }, hypre__tot, shared_sum_var); \ + }, hypre__tot, shared_sum_var); \ hypre_TMemcpy(&sum_var, shared_sum_var, HYPRE_Real, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); \ hypre_TFree(shared_sum_var, HYPRE_MEMORY_DEVICE); \ } @@ -1414,7 +1414,7 @@ void ReductionBoxLoopforall(LOOP_BODY loop_body, HYPRE_Int length, HYPRE_Real *s #define hypre_LoopEnd() \ } \ - }); \ + }); \ } /********************************************************************* diff --git a/external/tbb/src/tbbmalloc_proxy/proxy.cpp b/external/tbb/src/tbbmalloc_proxy/proxy.cpp index d2d4b2e4..ca1607ac 100644 --- a/external/tbb/src/tbbmalloc_proxy/proxy.cpp +++ b/external/tbb/src/tbbmalloc_proxy/proxy.cpp @@ -399,7 +399,7 @@ const char *known_bytecodes[] = { "4883EC384885C975", // release _msize() 9.0 "4C8BC1488B0DA6E4040033",// an old win64 SDK #endif -#else// _WIN32 +#else// _WIN32 \ // "========================================================" - 56 symbols "8BFF558BEC8B", // multiple "8BFF558BEC83", // release free() & _msize() 10.0.40219.325, _msize() ucrtbase.dll diff --git a/external/tbb/test/tbbmalloc/test_malloc_overload.cpp b/external/tbb/test/tbbmalloc/test_malloc_overload.cpp index 2311137b..714414dc 100644 --- a/external/tbb/test/tbbmalloc/test_malloc_overload.cpp +++ b/external/tbb/test/tbbmalloc/test_malloc_overload.cpp @@ -56,8 +56,8 @@ #if __GLIBC__ // aligned_alloc available since GLIBC 2.16 #define __TBB_ALIGNED_ALLOC_PRESENT __GLIBC_PREREQ(2, 16) -#endif// __GLIBC__ - // later Android doesn't have valloc or dlmalloc_usable_size +#endif// __GLIBC__ \ + // later Android doesn't have valloc or dlmalloc_usable_size #define __TBB_VALLOC_PRESENT (__unix__ && __ANDROID_API__ < 21) || __APPLE__ #define __TBB_DLMALLOC_USABLE_SIZE_PRESENT __ANDROID__ &&__ANDROID_API__ < 21