diff --git a/0001-mvapich2-2.3.6-add-support-for-loongarch64.patch b/0001-mvapich2-2.3.6-add-support-for-loongarch64.patch new file mode 100644 index 0000000000000000000000000000000000000000..102f94c2cfadabb92882f0d7a556dc97f0cf60cd --- /dev/null +++ b/0001-mvapich2-2.3.6-add-support-for-loongarch64.patch @@ -0,0 +1,37 @@ +From f9aedeaeadd84f2c5e949a148e82d2a18d1e45d8 Mon Sep 17 00:00:00 2001 +From: test +Date: Thu, 25 Apr 2024 07:45:52 +0000 +Subject: [PATCH] mvapich2 2.3.6 add support for loongarch64 + +--- + src/mpid/ch3/channels/common/include/mv2_clock.h | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/src/mpid/ch3/channels/common/include/mv2_clock.h b/src/mpid/ch3/channels/common/include/mv2_clock.h +index 77552c4..0ad6b43 100644 +--- a/src/mpid/ch3/channels/common/include/mv2_clock.h ++++ b/src/mpid/ch3/channels/common/include/mv2_clock.h +@@ -81,6 +81,20 @@ static inline cycles_t get_cycles() + asm volatile ("mov %0=ar.itc" : "=r" (ret)); + return ret; + } ++#elif defined(__loongarch64) ++typedef unsigned long cycles_t; ++static inline cycles_t get_cycles() ++{ ++ int rID = 0; ++ cycles_t val = 0; ++ ++ __asm__ __volatile__( ++ "rdtime.d %0, %1 \n\t" ++ : "=r"(val), "=r"(rID) ++ : ++ ); ++ return val; ++} + #elif defined(__aarch64__) + typedef unsigned long cycles_t; + static inline cycles_t get_cycles() +-- +2.43.0 + diff --git a/1000-add-riscv-support.patch b/1000-add-riscv-support.patch deleted file mode 100644 index 707880f2a418d5ffdffa7bc75e153b94475db841..0000000000000000000000000000000000000000 --- a/1000-add-riscv-support.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- 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/1001-update-risv-support.patch b/1001-update-risv-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..cd438c9daf07f63c411a43c709d0d9680a935521 --- /dev/null +++ b/1001-update-risv-support.patch @@ -0,0 +1,62 @@ +diff --git a/src/mpid/ch3/channels/common/include/mv2_clock.h b/src/mpid/ch3/channels/common/include/mv2_clock.h +index 77552c4..b7e41a3 100644 +--- a/src/mpid/ch3/channels/common/include/mv2_clock.h ++++ b/src/mpid/ch3/channels/common/include/mv2_clock.h +@@ -93,6 +93,14 @@ static inline cycles_t get_cycles() + return ret; + } + ++#elif defined(__riscv) ++// this function don't call ++typedef unsigned long cycles_t; ++static inline cycles_t get_cycles() ++{ ++ return 0; ++} ++ + #else + #warning get_cycles not implemented for this architecture: attempt asm/timex.h + #include +diff --git a/src/mpid/ch3/channels/common/src/util/mv2_clock.c b/src/mpid/ch3/channels/common/src/util/mv2_clock.c +index 4d9eb0a..74d5686 100644 +--- a/src/mpid/ch3/channels/common/src/util/mv2_clock.c ++++ b/src/mpid/ch3/channels/common/src/util/mv2_clock.c +@@ -52,7 +52,7 @@ + /* For gettimeofday */ + #define _BSD_SOURCE + #include +- ++#include + #include + #include + #include +@@ -218,6 +218,21 @@ double get_cpu_mhz() + + #ifndef DISABLE_LOW_LEVEL_TIMERS + ++#if defined(__riscv) ++void mv2_init_timers() ++{ ++} ++double mv2_get_time_us() ++{ ++ struct timespec ts; ++ if (clock_gettime(CLOCK_REALTIME,&ts) == -1){ ++ PRINT_ERROR("Error in clock_gettime."); ++ exit(-1); ++ } ++ long long time_us = (long long )ts.tv_sec * 1000000 + ts.tv_nsec / 1000; ++ return (double)time_us; ++} ++#else + void mv2_init_timers() + { + global_mhz = get_cpu_mhz(); +@@ -231,6 +246,7 @@ double mv2_get_time_us() + { + return (get_cycles()/global_mhz); + } ++#endif + + #else + diff --git a/mvapich2.spec b/mvapich2.spec index 1180d6dd94200a2ce4b022553a9b802c3b05ce16..7b92241fef8166575a4e29933275e7ed00226740 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -2,7 +2,7 @@ Name: mvapich2 Version: 2.3.6 -Release: 3 +Release: 5 Summary: OSU MVAPICH2 MPI package License: BSD and MIT URL: http://mvapich.cse.ohio-state.edu @@ -12,8 +12,9 @@ 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 +Patch1000: 1001-update-risv-support.patch %endif +Patch1001: 0001-mvapich2-2.3.6-add-support-for-loongarch64.patch BuildRequires: gcc-gfortran python3-devel gcc-c++ BuildRequires: bison flex autoconf automake libtool BuildRequires: perl-Digest-MD5 hwloc-devel rdma-core-devel @@ -261,6 +262,12 @@ cd .. %changelog +* Mon Jul 8 2024 pSomng - 2.3.6-5 +- update risc-v support + +* Thu Apr 25 2024 Pengda Dou - 2.3.6-4 +- add support for loongarch64 + * Fri Sep 1 2023 renyi <977713017@qq.com> - 2.3.6-3 - Fix changelog error