diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index b24a04ce..a756f0e9 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -7,6 +7,9 @@ jobs: if: ${{ !contains(github.event.head_commit.message, '[skip.all]') }} runs-on: self-hosted timeout-minutes: 60 + strategy: + matrix: + arch: [ amd64, arm64 ] steps: - name: Clone uses: actions/checkout@v4 @@ -21,13 +24,17 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: QEMU + if: ${{ matrix.arch == 'arm64' }} + uses: docker/setup-qemu-action@v3 - name: Buildx uses: docker/setup-buildx-action@v3 - - name: Build + - name: Build ${{ matrix.arch }} uses: docker/build-push-action@v6 with: context: . - file: ./Script/Rocky.Dockerfile + file: ./Script/Rocky.${{ matrix.arch }}.Dockerfile + platforms: linux/${{ matrix.arch }} push: true tags: | tlcfem/suanpan:latest diff --git a/.github/workflows/docker-master.yml b/.github/workflows/docker-master.yml index 2ae341d7..638da3cb 100644 --- a/.github/workflows/docker-master.yml +++ b/.github/workflows/docker-master.yml @@ -27,7 +27,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - file: ./Script/Rocky.Dockerfile + file: ./Script/Rocky.amd64.Dockerfile push: true tags: | tlcfem/suanpan:stable diff --git a/Option.cmake b/Option.cmake index f245c8e5..09a9215a 100644 --- a/Option.cmake +++ b/Option.cmake @@ -229,9 +229,9 @@ if (USE_HDF5) endif () else () if (USE_SYS_LIB) - find_package(HDF5 REQUIRED) + find_package(HDF5 REQUIRED COMPONENTS C HL) include_directories(${HDF5_INCLUDE_DIRS}) - link_libraries(${HDF5_LIBRARIES}) + link_libraries(${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) else () include_directories(Include/hdf5) include_directories(Include/hdf5-${SP_EXTERNAL_LIB_PATH}) @@ -261,7 +261,7 @@ if (BUILD_MULTITHREAD) if (USE_SYS_LIB) find_package(TBB REQUIRED) include_directories(${TBB_INCLUDE_DIRS}) - link_libraries(${TBB_LIBRARIES}) + link_libraries(TBB::tbb TBB::tbbmalloc TBB::tbbmalloc_proxy) else () if (COMPILER_IDENTIFIER MATCHES "gcc-win") link_libraries(tbb12) diff --git a/Script/Rocky.Dockerfile b/Script/Rocky.amd64.Dockerfile similarity index 100% rename from Script/Rocky.Dockerfile rename to Script/Rocky.amd64.Dockerfile diff --git a/Script/Rocky.arm64.Dockerfile b/Script/Rocky.arm64.Dockerfile new file mode 100644 index 00000000..82ebab19 --- /dev/null +++ b/Script/Rocky.arm64.Dockerfile @@ -0,0 +1,32 @@ +FROM arm64v8/rockylinux:9 AS build + +RUN dnf install -y epel-release && crb enable +RUN dnf install -y gcc g++ gfortran cmake wget git hdf5-devel + +# part 1: openblas +RUN git clone --depth 1 --branch v0.3.28 https://github.com/OpenMathLib/OpenBLAS.git + +# change the following configurations to match your needs +RUN cd OpenBLAS && make TARGET=ARMV8 DYNAMIC_ARCH=1 BINARY=64 USE_THREAD=1 USE_OPENMP=1 NUM_THREADS=20 NO_SHARED=1 NO_CBLAS=1 NO_LAPACKE=1 GEMM_MULTITHREAD_THRESHOLD=64 + +# part 2: tbb +RUN git clone --depth 1 --branch v2021.12.0 https://github.com/oneapi-src/oneTBB.git +RUN mkdir tbb-build && cd tbb-build && cmake -DCMAKE_BUILD_TYPE=Release -DTBB_TEST=OFF ../oneTBB && cmake --build . --target install --config Release --parallel "$(nproc)" + +# part 3: suanpan +RUN git clone --depth 1 --branch dev https://github.com/TLCFEM/suanPan.git + +RUN cd suanPan && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYS_LIB=ON -DCUSTOM_OPENBLAS=/OpenBLAS -DBUILD_MULTITHREAD=ON -DUSE_HDF5=ON -DUSE_VTK=OFF -DUSE_AVX2=OFF .. && make -j"$(nproc)" + +FROM arm64v8/rockylinux:9 AS runtime + +RUN dnf install -y epel-release && crb enable +RUN dnf install -y libgomp hdf5 + +COPY --from=build /tbb-build /tbb-build + +RUN cd /tbb-build && make install && cd .. && rm -rf tbb-build + +COPY --from=build /suanPan/build/suanPan /usr/local/bin/suanPan + +RUN suanPan -v