diff --git a/.github/workflows/test_t8code_macos.yml b/.github/workflows/test_t8code_macos.yml new file mode 100644 index 0000000000..b96a42cb89 --- /dev/null +++ b/.github/workflows/test_t8code_macos.yml @@ -0,0 +1,172 @@ +name: CMake tests t8code on Mac OS + + +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2026 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# This workflow checks whether building and testing works on Mac OS. +# In the past, this meant that Mac-OS-specific problems in t8code became +# apparrent only in Trixi and T8Code.jl, where they are very hard and +# cumbersome to debug. This workflow is intended to avoid that by catching +# such problems as early as possible, i.e., within t8code's CI. +# not just all of t8code's remaining CI workflows rely +# To reduce runtime, (for now) only one configuration is run, that is, Debug mode +# with MPI, mesh handle, and Fortran interface. The main reason the external +# libraries (VTK, OpenCASCADE) are deactivated is that github's Mac OS runners +# do not use containers, meaning we would have to install the libraries in every +# single CI run (or cache them). + +env: + DEBUG_CONFIG: "-O1" + +on: + workflow_call: + # Note: To simplify adding more configurations of this workflow later, the MPI mode and the BUILD_TYPE + # are passed as input, although currently only MPI on and Debug mode are tested. + inputs: + MAKEFLAGS: + required: true + type: string + description: 'Make flags to use for compilation (like -j4)' + MPI: + required: true + type: string + description: 'Use MPI for compilation (ON/OFF)' + BUILD_TYPE: + required: true + type: string + description: 'Build type (Release/Debug)' + TEST_LEVEL: + required: true + type: string + description: 'Test level used for configuring (T8_TEST_LEVEL_FULL, T8_TEST_LEVEL_MEDIUM, or T8_TEST_LEVEL_BASIC)' + default: 'T8_TEST_LEVEL_FULL' + +jobs: + t8code_cmake_tests: + # + # Container setup: To avoid unwanted side effects of gcc or mpich, an own Clang version of the + # t8-dependencies Docker image is used. Aside from some basic packages, it contains a manually built + # Clang version of OpenMPI. + timeout-minutes: 60 + runs-on: macos-latest + steps: + # + # Part 1: Preparation + # ------------------------------------- + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Update packages + run: brew update + - name: Install missing packages via Homebrew + run: | + brew install open-mpi ninja cmake googletest openssl + - name: Export correct OpenMPI path to environment variables + run: | + export OPENMPI_BIN="/opt/homebrew/opt/open-mpi/bin" + echo OPENMPI_BIN="$OPENMPI_BIN" >> $GITHUB_ENV + - name: Reinstall gfortran + run: brew reinstall gfortran + - name: Show gfortran version + run: $OPENMPI_BIN/mpifort --version + # which gfortran + # - name: Show Clang version + # run: clang --version + - name: Show mpicc version + run: $OPENMPI_BIN/mpicc --version + - name: init submodules + run: git submodule init + - name: update submodules + run: git submodule update + - name: Get input vars + run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" + && export MPI="${{ inputs.MPI }}" + && export BUILD_TYPE="${{ inputs.BUILD_TYPE }}" + && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV + && echo MPI="$MPI" >> $GITHUB_ENV + && echo BUILD_TYPE="$BUILD_TYPE" >> $GITHUB_ENV + # + # Part 2: Build t8code + # -------------------- + # Define build config + - name: Set test level + run: export TEST_LEVEL_FLAG="-DT8CODE_TEST_LEVEL=${{ inputs.TEST_LEVEL }}" + && echo TEST_LEVEL_FLAG="$TEST_LEVEL_FLAG" >> $GITHUB_ENV + - name: build config variables + run: | + export CONFIG_OPTIONS="-GNinja -DCMAKE_INSTALL_PREFIX=$(pwd)/install \ + -DT8CODE_ENABLE_MPI=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE ${TEST_LEVEL_FLAG} -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} \ + -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=OFF -DT8CODE_BUILD_WEXTRA=ON \ + -DT8CODE_BUILD_FORTRAN_INTERFACE=OFF -DT8CODE_BUILD_MESH_HANDLE=ON \ + -DT8CODE_ENABLE_OCC=OFF -DT8CODE_ENABLE_VTK=OFF" + echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV + # Run cmake + # Note that DT8CODE_CUSTOM_PARALLEL_TEST_COMMAND is not included in $CONFIG_OPTIONS because of whitespace issues. + - name: echo cmake line + run: echo 'cmake ../ $CONFIG_OPTIONS' + - name: cmake + run: mkdir build && cd build && cmake ../ $CONFIG_OPTIONS + # On failure, upload logs + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v7 + with: + name: cmake_w_clang_and_ompi_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}.log + path: build/CMakeFiles/CMakeOutput.log + # Build with ninja + - name: ninja + run: cd build && ninja $MAKEFLAGS + - name: ninja install + run: cd build && ninja install $MAKEFLAGS + # + # Part 3: Run t8code tests + # ------------------------ + # - name: Manual test + # run: | + # cd build/test/t8_cmesh/ + # ./t8_gtest_compute_first_element_serial + - name: serial tests (if MPI is enabled) + run: cd build && ctest -R _serial + # # if: ${{ inputs.MPI == 'ON' }} + # - name: parallel tests (if MPI is enabled) + # run: | + # cd build + # ctest -R _parallel + + # env: + # # Note: These openmpi options are required to ensure stable runs in github workflows and avoid stalling. + # # In particular, they activate oversubscription and define the communication channels, here tcp (and self). + # OMPI_ALLOW_RUN_AS_ROOT: 1 + # OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 + # OMPI_MCA_rmaps_base_oversubscribe: 1 + # OMPI_MCA_btl: self,tcp + # OMPI_MCA_pml: ob1 + if: ${{ inputs.MPI == 'ON' }} + - name: tests (if MPI is disabled) + run: cd build && ctest $MAKEFLAGS + if: ${{ inputs.MPI == 'OFF' }} + # On failure, upload logs + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v7 + with: + name: test-suite_w_clang_and_ompi_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}.log + path: build/Testing/Temporary/LastTest.log diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 631f7f48e8..a054020008 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -106,129 +106,150 @@ jobs: fi # Preparation step for tests. Repo is cloned and sc + p4est are compiled with and without MPI. - preparation: - needs: [fine_grained_trigger] - secrets: inherit - if: needs.fine_grained_trigger.outputs.run_ci == 'true' - uses: ./.github/workflows/test_preparation.yml - strategy: - fail-fast: false - matrix: - MPI: [OFF, ON] - include: - - MAKEFLAGS: -j4 - with: - MAKEFLAGS: ${{ matrix.MAKEFLAGS }} - IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run - CACHE_COUNTER: 0 # Increase this number to force a new installation of sc and p4est and to update the cache once - MPI: ${{ matrix.MPI }} + # preparation: + # needs: [fine_grained_trigger] + # secrets: inherit + # if: needs.fine_grained_trigger.outputs.run_ci == 'true' + # uses: ./.github/workflows/test_preparation.yml + # strategy: + # fail-fast: false + # matrix: + # MPI: [OFF, ON] + # include: + # - MAKEFLAGS: -j4 + # with: + # MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + # IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run + # CACHE_COUNTER: 0 # Increase this number to force a new installation of sc and p4est and to update the cache once + # MPI: ${{ matrix.MPI }} - # Run parallel tests for sc and p4est with and without MPI - sc_p4est_tests: - needs: preparation - uses: ./.github/workflows/test_sc_p4est.yml - strategy: - fail-fast: false - matrix: - MPI: [OFF, ON] - include: - - MAKEFLAGS: -j4 - with: - MAKEFLAGS: ${{ matrix.MAKEFLAGS }} - MPI: ${{ matrix.MPI }} + # # Run parallel tests for sc and p4est with and without MPI + # sc_p4est_tests: + # needs: preparation + # uses: ./.github/workflows/test_sc_p4est.yml + # strategy: + # fail-fast: false + # matrix: + # MPI: [OFF, ON] + # include: + # - MAKEFLAGS: -j4 + # with: + # MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + # MPI: ${{ matrix.MPI }} - # Run t8code tests with and without MPI and in serial and debug mode - t8code_tests: - needs: preparation - uses: ./.github/workflows/test_t8code.yml - strategy: - fail-fast: false - matrix: - MPI: [OFF, ON] - BUILD_TYPE: [Debug, Release] - include: - - MAKEFLAGS: -j4 - with: - MAKEFLAGS: ${{ matrix.MAKEFLAGS }} - MPI: ${{ matrix.MPI }} - BUILD_TYPE: ${{ matrix.BUILD_TYPE }} - TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. + # # Run t8code tests with and without MPI and in serial and debug mode + # t8code_tests: + # needs: preparation + # uses: ./.github/workflows/test_t8code.yml + # strategy: + # fail-fast: false + # matrix: + # MPI: [OFF, ON] + # BUILD_TYPE: [Debug, Release] + # include: + # - MAKEFLAGS: -j4 + # with: + # MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + # MPI: ${{ matrix.MPI }} + # BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + # TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. - # Run t8code linkage tests with and without MPI and in serial and debug mode - t8code_linkage_tests: - needs: preparation - uses: ./.github/workflows/test_t8code_linkage.yml - strategy: - fail-fast: false - matrix: - MPI: [OFF, ON] - BUILD_TYPE: [Debug, Release] - include: - - MAKEFLAGS: -j4 - with: - MAKEFLAGS: ${{ matrix.MAKEFLAGS }} - MPI: ${{ matrix.MPI }} - BUILD_TYPE: ${{ matrix.BUILD_TYPE }} - TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. + # # Run t8code linkage tests with and without MPI and in serial and debug mode + # t8code_linkage_tests: + # needs: preparation + # uses: ./.github/workflows/test_t8code_linkage.yml + # strategy: + # fail-fast: false + # matrix: + # MPI: [OFF, ON] + # BUILD_TYPE: [Debug, Release] + # include: + # - MAKEFLAGS: -j4 + # with: + # MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + # MPI: ${{ matrix.MPI }} + # BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + # TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. - # Run t8code linkage tests with and without MPI and in serial and debug mode - t8code_api_tests: - needs: preparation - uses: ./.github/workflows/test_t8code_api.yml - strategy: - fail-fast: false - matrix: - MPI: [ON] # For now the fortran API only supports building with MPI - BUILD_TYPE: [Debug, Release] - include: - - MAKEFLAGS: -j4 - with: - MAKEFLAGS: ${{ matrix.MAKEFLAGS }} - MPI: ${{ matrix.MPI }} - BUILD_TYPE: ${{ matrix.BUILD_TYPE }} - TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. + # # Run t8code linkage tests with and without MPI and in serial and debug mode + # t8code_api_tests: + # needs: preparation + # uses: ./.github/workflows/test_t8code_api.yml + # strategy: + # fail-fast: false + # matrix: + # MPI: [ON] # For now the fortran API only supports building with MPI + # BUILD_TYPE: [Debug, Release] + # include: + # - MAKEFLAGS: -j4 + # with: + # MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + # MPI: ${{ matrix.MPI }} + # BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + # TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. - # Run Valgrind check for every t8code test binary. - t8code_valgrind_tests: - if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') # Only run the Valgrind check in the scheduled run. - needs: preparation - uses: ./.github/workflows/test_valgrind.yml - with: - TEST_LEVEL: T8_TEST_LEVEL_BASIC # Do Valgrind check for test level T8_TEST_LEVEL_BASIC for performance reasons. + # # Run Valgrind check for every t8code test binary. + # t8code_valgrind_tests: + # if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') # Only run the Valgrind check in the scheduled run. + # needs: preparation + # uses: ./.github/workflows/test_valgrind.yml + # with: + # TEST_LEVEL: T8_TEST_LEVEL_BASIC # Do Valgrind check for test level T8_TEST_LEVEL_BASIC for performance reasons. - # Generate code coverage and deploy to Codecov. - t8code_code_coverage: - if: (github.event_name != 'merge_group') - needs: preparation - uses: ./.github/workflows/code_coverage.yml - with: - MAKEFLAGS: -j4 - MPI: ON - BUILD_TYPE: Debug - TEST_LEVEL: T8_TEST_LEVEL_BASIC - secrets: - CODE_COV: ${{ secrets.CODE_COV }} - - # Run t8code tests with shipped submodules. This test is only for the build system, so only one config is tested. - t8code_w_shipped_submodules_tests: - needs: fine_grained_trigger - secrets: inherit - if: ${{ needs.fine_grained_trigger.outputs.run_ci == 'true' }} - uses: ./.github/workflows/test_t8code_w_shipped_submodules.yml - with: - MAKEFLAGS: -j4 - MPI: ON - BUILD_TYPE: Debug - TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. + # # Generate code coverage and deploy to Codecov. + # t8code_code_coverage: + # if: (github.event_name != 'merge_group') + # needs: preparation + # uses: ./.github/workflows/code_coverage.yml + # with: + # MAKEFLAGS: -j4 + # MPI: ON + # BUILD_TYPE: Debug + # TEST_LEVEL: T8_TEST_LEVEL_BASIC + # secrets: + # CODE_COV: ${{ secrets.CODE_COV }} + + # # Run t8code tests with shipped submodules. This test is only for the build system, so only one config is tested. + # t8code_w_shipped_submodules_tests: + # needs: fine_grained_trigger + # secrets: inherit + # if: ${{ needs.fine_grained_trigger.outputs.run_ci == 'true' }} + # uses: ./.github/workflows/test_t8code_w_shipped_submodules.yml + # with: + # MAKEFLAGS: -j4 + # MPI: ON + # BUILD_TYPE: Debug + # TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. + + # # Check t8code building and testing with the Clang compiler and openmpi. + # # Note: This workflow is meant to detect Clang- or openmpi-specific issues missed by the remaining (gcc- and mpich-based) workflows. + # # To reduce its runtime, it currently only uses one run in Debug mode with MPI activated and all external libraries like VTK or OpenCASCADE. + # t8code_w_clang_and_ompi_tests: + # needs: fine_grained_trigger + # secrets: inherit + # if: ${{ needs.fine_grained_trigger.outputs.run_ci == 'true' }} + # uses: ./.github/workflows/test_t8code_w_clang_and_ompi.yml + # strategy: + # fail-fast: false + # matrix: + # MPI: [ON] + # BUILD_TYPE: [Debug] + # include: + # - MAKEFLAGS: -j4 + # with: + # MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + # MPI: ${{ matrix.MPI }} + # BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + # TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. # Check t8code building and testing with the Clang compiler and openmpi. # Note: This workflow is meant to detect Clang- or openmpi-specific issues missed by the remaining (gcc- and mpich-based) workflows. # To reduce its runtime, it currently only uses one run in Debug mode with MPI activated and all external libraries like VTK or OpenCASCADE. - t8code_w_clang_and_ompi_tests: + t8code_macos_tests: needs: fine_grained_trigger secrets: inherit if: ${{ needs.fine_grained_trigger.outputs.run_ci == 'true' }} - uses: ./.github/workflows/test_t8code_w_clang_and_ompi.yml + uses: ./.github/workflows/test_t8code_macos.yml strategy: fail-fast: false matrix: @@ -242,12 +263,14 @@ jobs: BUILD_TYPE: ${{ matrix.BUILD_TYPE }} TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. - # Build doxygen documentation and check for errors / warnings. - t8code_doxygen_check: - uses: ./.github/workflows/check_doxygen.yml - t8code_tarball: - if: github.event.pull_request.draft == false - uses: ./.github/workflows/test_tarball.yml - with: - TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. + + # # Build doxygen documentation and check for errors / warnings. + # t8code_doxygen_check: + # uses: ./.github/workflows/check_doxygen.yml + + # t8code_tarball: + # if: github.event.pull_request.draft == false + # uses: ./.github/workflows/test_tarball.yml + # with: + # TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6aecf7f639..b119207b06 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -112,61 +112,7 @@ configure_file( @ONLY ) -add_t8_cpp_test( NAME t8_gtest_cmesh_bcast_parallel SOURCES t8_cmesh/t8_gtest_bcast.cxx ) -add_t8_cpp_test( NAME t8_gtest_eclass_serial SOURCES t8_gtest_eclass.cxx ) -add_t8_cpp_test( NAME t8_gtest_mat_serial SOURCES t8_gtest_mat.cxx ) -add_t8_cpp_test( NAME t8_gtest_refcount_serial SOURCES t8_gtest_refcount.cxx ) -add_t8_cpp_test( NAME t8_gtest_occ_linkage_serial SOURCES t8_gtest_occ_linkage.cxx ) -add_t8_cpp_test( NAME t8_gtest_version_serial SOURCES t8_gtest_version.cxx ) -add_t8_cpp_test( NAME t8_gtest_basics_serial SOURCES t8_gtest_basics.cxx ) -add_t8_cpp_test( NAME t8_gtest_vtk_linkage_serial SOURCES t8_gtest_vtk_linkage.cxx ) - -add_t8_cpp_test( NAME t8_gtest_type_serial SOURCES t8_types/t8_gtest_type.cxx ) -add_t8_cpp_test( NAME t8_gtest_vec_serial SOURCES t8_types/t8_gtest_vec.cxx ) - -add_t8_cpp_test( NAME t8_gtest_hypercube_parallel SOURCES t8_cmesh/t8_gtest_hypercube.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_readmshfile_serial SOURCES t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_copy_serial SOURCES t8_cmesh/t8_gtest_cmesh_copy.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_face_is_boundary_parallel SOURCES t8_cmesh/t8_gtest_cmesh_face_is_boundary.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_partition_parallel SOURCES t8_cmesh/t8_gtest_cmesh_partition.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_set_partition_offsets_parallel SOURCES t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_set_join_by_vertices_serial SOURCES t8_cmesh/t8_gtest_cmesh_set_join_by_vertices.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_add_attributes_when_derive_parallel SOURCES t8_cmesh/t8_gtest_cmesh_add_attributes_when_derive.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_vertex_conn_tree_to_vertex_parallel SOURCES t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_vertex_conn_vertex_to_tree_parallel SOURCES t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_vertex_conn_serial SOURCES t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx ) add_t8_cpp_test( NAME t8_gtest_compute_first_element_serial SOURCES t8_cmesh/t8_gtest_compute_first_element.cxx ) -add_t8_cpp_test( NAME t8_gtest_multiple_attributes_parallel SOURCES t8_cmesh/t8_gtest_multiple_attributes.cxx ) -add_t8_cpp_test( NAME t8_gtest_attribute_gloidx_array_serial SOURCES t8_cmesh/t8_gtest_attribute_gloidx_array.cxx ) -add_t8_cpp_test( NAME t8_gtest_cmesh_bounding_box_serial SOURCES t8_cmesh/t8_gtest_cmesh_bounding_box.cxx ) - -add_t8_cpp_test( NAME t8_gtest_shmem_parallel SOURCES t8_data/t8_gtest_shmem.cxx ) -add_t8_cpp_test( NAME t8_gtest_data_pack_parallel SOURCES t8_data/t8_gtest_data_handler.cxx t8_data/t8_data_handler_specs.cxx) - -add_t8_cpp_test( NAME t8_gtest_bin_search_parallel SOURCES t8_forest/t8_gtest_bin_search.cxx t8_gtest_adapt_callbacks.cxx ) -add_t8_cpp_test( NAME t8_gtest_element_volume_serial SOURCES t8_forest/t8_gtest_element_volume.cxx ) -add_t8_cpp_test( NAME t8_gtest_search_parallel SOURCES t8_forest/t8_gtest_search.cxx ) -add_t8_cpp_test( NAME t8_gtest_half_neighbors_parallel SOURCES t8_forest/t8_gtest_half_neighbors.cxx ) -add_t8_cpp_test( NAME t8_gtest_find_owner_parallel SOURCES t8_forest/t8_gtest_find_owner.cxx ) -add_t8_cpp_test( NAME t8_gtest_user_data_parallel SOURCES t8_forest/t8_gtest_user_data.cxx ) -add_t8_cpp_test( NAME t8_gtest_transform_serial SOURCES t8_forest/t8_gtest_transform.cxx ) -add_t8_cpp_test( NAME t8_gtest_ghost_exchange_parallel SOURCES t8_forest/t8_gtest_ghost_exchange.cxx ) -add_t8_cpp_test( NAME t8_gtest_ghost_delete_parallel SOURCES t8_forest/t8_gtest_ghost_delete.cxx ) -add_t8_cpp_test( NAME t8_gtest_ghost_and_owner_parallel SOURCES t8_forest/t8_gtest_ghost_and_owner.cxx ) -add_t8_cpp_test( NAME t8_gtest_balance_parallel SOURCES t8_forest/t8_gtest_balance.cxx ) -add_t8_cpp_test( NAME t8_gtest_forest_commit_parallel SOURCES t8_forest/t8_gtest_forest_commit.cxx ) -add_t8_cpp_test( NAME t8_gtest_forest_face_normal_serial SOURCES t8_forest/t8_gtest_forest_face_normal.cxx ) -add_t8_cpp_test( NAME t8_gtest_partition_data_parallel SOURCES t8_forest/t8_gtest_partition_data.cxx ) -add_t8_cpp_test( NAME t8_gtest_set_partition_offset_parallel SOURCES t8_forest/t8_gtest_set_partition_offset.cxx ) -add_t8_cpp_test( NAME t8_gtest_partition_for_coarsening_parallel SOURCES t8_forest/t8_gtest_partition_for_coarsening.cxx ) -add_t8_cpp_test( NAME t8_gtest_weighted_partitioning_parallel SOURCES t8_forest/t8_gtest_weighted_partitioning.cxx ) - -add_t8_cpp_test( NAME t8_gtest_element_is_leaf_parallel SOURCES t8_forest/t8_gtest_element_is_leaf.cxx t8_gtest_adapt_callbacks.cxx ) -add_t8_cpp_test( NAME t8_gtest_permute_hole_serial SOURCES t8_forest_incomplete/t8_gtest_permute_hole.cxx ) -add_t8_cpp_test( NAME t8_gtest_recursive_serial SOURCES t8_forest_incomplete/t8_gtest_recursive.cxx ) -add_t8_cpp_test( NAME t8_gtest_iterate_replace_parallel SOURCES t8_forest_incomplete/t8_gtest_iterate_replace.cxx ) -add_t8_cpp_test( NAME t8_gtest_empty_local_tree_parallel SOURCES t8_forest_incomplete/t8_gtest_empty_local_tree.cxx ) -add_t8_cpp_test( NAME t8_gtest_empty_global_tree_parallel SOURCES t8_forest_incomplete/t8_gtest_empty_global_tree.cxx ) if( CMAKE_BUILD_TYPE STREQUAL "Debug" ) add_t8_cpp_test( NAME t8_gtest_geometry_negative_volume_serial SOURCES t8_geometry/t8_gtest_geometry_negative_volume.cxx ) diff --git a/test/t8_cmesh/t8_gtest_compute_first_element.cxx b/test/t8_cmesh/t8_gtest_compute_first_element.cxx index 9ba0ca1f98..fe2acf4d02 100644 --- a/test/t8_cmesh/t8_gtest_compute_first_element.cxx +++ b/test/t8_cmesh/t8_gtest_compute_first_element.cxx @@ -135,8 +135,15 @@ TEST_P (t8_gtest_rank_times_global_num_elems_over_size, large_numbers) * We use integer division, therefore we store the remainder of each update to * prevent rounding errors. */ + bool success = true; + uint32_t fail_rank; + uint64_t fail_num; + uint64_t fail_size; + + // t8_global_productionf ("Debug print 1\n"); uint64_t size = 1; for (uint32_t isize = 1; isize < size_iter; ++isize) { + // t8_global_productionf ("isize = %i \n", isize); /* The very first result is 1 * 1 / size */ uint64_t check_result_elem = 1 / size; /* The remainder of the element update */ @@ -145,6 +152,7 @@ TEST_P (t8_gtest_rank_times_global_num_elems_over_size, large_numbers) uint64_t num_elems = 1; /* Initialize factors */ for (uint32_t ielem = 1; ielem < elem_iter; ++ielem) { + // t8_global_productionf ("ielem = %i \n", ielem); uint32_t rank = 1; /** Used to compute elem^n * rank^m / size, where n is fixed. */ @@ -152,11 +160,20 @@ TEST_P (t8_gtest_rank_times_global_num_elems_over_size, large_numbers) /* The remainder of the rank update */ uint64_t rank_remainder = check_result_elem_remain; for (uint32_t irank = 1; irank < rank_iter && rank <= size; ++irank) { + + // t8_global_productionf ("irank = %i \n", irank); const uint64_t computed_result = t8_cmesh_get_first_element_of_process (rank, size, num_elems); check_result = (rank == size) ? num_elems : check_result; - ASSERT_EQ (computed_result, check_result) - << "rank: " << rank << " num_elems: " << num_elems << " size: " << size; + // ASSERT_EQ (computed_result, check_result) + // << "rank: " << rank << " num_elems: " << num_elems << " size: " << size; + if (computed_result != check_result) { + success = false; + fail_rank = rank; + fail_num = num_elems; + fail_size = size; + break; + } /* Update the result with respect to the updated rank */ check_result *= rank_growth; @@ -165,16 +182,26 @@ TEST_P (t8_gtest_rank_times_global_num_elems_over_size, large_numbers) /* Update the rank */ rank *= rank_growth; } + // t8_global_productionf ("Left irank loop\n"); /* Update the result with respect to the updated number of elements. */ check_result_elem *= elem_growth; check_result_elem += elem_growth * check_result_elem_remain / size; check_result_elem_remain = (elem_growth * check_result_elem_remain) % size; /* Update the number of elements */ num_elems *= elem_growth; + + if (not success) + break; } /* Update mpisize */ size *= size_growth; + + if (not success) + break; } + // t8_global_productionf ("Left isize loop\n"); + + ASSERT_TRUE (success) << "Failure at rank: " << fail_rank << " num_elems: " << fail_num << " size: " << fail_size; } INSTANTIATE_TEST_SUITE_P (t8_gtest_rank_times_global_num_elems_over_size, diff --git a/test/t8_schemes/t8_gtest_pack_unpack.cxx b/test/t8_schemes/t8_gtest_pack_unpack.cxx index 33fcbdde1c..a1725bf325 100644 --- a/test/t8_schemes/t8_gtest_pack_unpack.cxx +++ b/test/t8_schemes/t8_gtest_pack_unpack.cxx @@ -76,7 +76,7 @@ struct class_test_pack: public TestDFS SC_CHECK_MPI (mpiret); #else /* just copy the data, if we did not compile with MPI*/ - mempcpy (recvbuf, sendbuf, pack_size); + memcpy (recvbuf, sendbuf, pack_size); #endif /* Unpack data */ position = 0;