From fc4692fc9eda000668ae4a7ebca19edd50fedc98 Mon Sep 17 00:00:00 2001 From: misaka00251 Date: Thu, 20 Jul 2023 14:34:26 +0800 Subject: [PATCH] Fix riscv64 support & Fix build using llvm --- 1000-add-riscv-support.patch | 18 ++++++++++++++++++ mvapich2.spec | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 1000-add-riscv-support.patch diff --git a/1000-add-riscv-support.patch b/1000-add-riscv-support.patch new file mode 100644 index 0000000..707880f --- /dev/null +++ b/1000-add-riscv-support.patch @@ -0,0 +1,18 @@ +--- a/src/mpid/ch3/channels/common/include/mv2_clock.h 2018-07-24 22:30:00.000000000 +0800 ++++ b/src/mpid/ch3/channels/common/include/mv2_clock.h 2022-03-03 14:19:52.430980863 +0800 +@@ -92,7 +92,14 @@ + + return ret; + } +- ++#elif defined(__riscv) ++typedef unsigned long cycles_t; ++static inline cycles_t get_cycles() ++{ ++ unsigned long clk; ++ asm volatile("rdcycle %0" : "=r" (clk)); ++ return clk; ++} + #else + #warning get_cycles not implemented for this architecture: attempt asm/timex.h + #include diff --git a/mvapich2.spec b/mvapich2.spec index 7cdff61..6b0222a 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -2,7 +2,7 @@ Name: mvapich2 Version: 2.3.6 -Release: 1 +Release: 2 Summary: OSU MVAPICH2 MPI package License: BSD and MIT URL: http://mvapich.cse.ohio-state.edu @@ -11,6 +11,9 @@ Source1: mvapich2.module.in Source2: mvapich2.macros.in Patch0001: 0001-mvapich23-unbundle-contrib-hwloc.patch Patch0002: 0002-mvapich23-unbundle-osu_benchmarks.patch +%ifarch riscv64 +Patch1000: 1000-add-riscv-support.patch +%endif BuildRequires: gcc-gfortran python3-devel gcc-c++ BuildRequires: bison flex autoconf automake libtool BuildRequires: perl-Digest-MD5 hwloc-devel rdma-core-devel @@ -91,6 +94,17 @@ cp -pr default psm2 export FFLAGS="$FFLAGS -fallow-argument-mismatch" export AR=ar +%if "%toolchain" == "clang" +export FFLAGS=$(echo $FFLAGS | sed -e 's|--config \/usr\/lib\/rpm\/generic-hardened-clang.cfg ||g') +export FFLAGS=$(echo $FFLAGS | sed -e 's|-Werror=format-security ||g') +export FCFLAGS=$(echo $FCFLAGS | sed -e 's|--config \/usr\/lib\/rpm\/generic-hardened-clang.cfg ||g') +%ifarch riscv64 +export LDFLAGS=$(echo $LDFLAGS | sed -e 's|-fno-openmp-implicit-rpath|-fPIE -fPIC|g') +%else +export LDFLAGS=$(echo $LDFLAGS | sed -e 's|-fno-openmp-implicit-rpath ||g') +%endif +%endif + %ifarch x86_64 cd psm2 %configure --prefix=%{_libdir}/mvapich2-psm2 --exec-prefix=%{_libdir}/mvapich2-psm2 \ @@ -247,6 +261,9 @@ cd .. %changelog +* Mon Jul 17 2023 misaka00251 - 2.3.6-2 +- Fix riscv64 support & Fix build using llvm + * Mon Jun 20 2022 liyanan - 2.3.6-1 - Update to 2.3.6 -- Gitee