From 51349e85ff7a064e344ca612904cbd4c876c8956 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Thu, 23 Mar 2023 10:30:38 +0200 Subject: [PATCH] Add support for riscv64 Initial support. Also properly check valgrind arches. Signed-off-by: David Abdurachmanov --- 0001-Add-initial-support-for-riscv64.patch | 61 ++++++++++++++++++++++ openmpi.spec | 20 ++++++- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 0001-Add-initial-support-for-riscv64.patch diff --git a/0001-Add-initial-support-for-riscv64.patch b/0001-Add-initial-support-for-riscv64.patch new file mode 100644 index 0000000..1c6d9db --- /dev/null +++ b/0001-Add-initial-support-for-riscv64.patch @@ -0,0 +1,61 @@ +From 0693a0dc91b5b2dbd7a83ac298d7c3a437d76327 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Fri, 23 Sep 2022 11:08:32 +0300 +Subject: [PATCH] Add initial support for riscv64 + +Signed-off-by: David Abdurachmanov +--- + config/opal_config_asm.m4 | 5 +++++ + opal/include/opal/sys/architecture.h | 1 + + opal/include/opal/sys/cma.h | 7 +++++++ + 3 files changed, 13 insertions(+) + +diff --git a/config/opal_config_asm.m4 b/config/opal_config_asm.m4 +index 5183c7e..d8640e0 100644 +--- a/config/opal_config_asm.m4 ++++ b/config/opal_config_asm.m4 +@@ -1148,6 +1148,11 @@ AC_DEFUN([OPAL_CONFIG_ASM],[ + AC_MSG_WARN([$opal_cv_asm_arch: gcc atomics have been known to perform poorly on powerpc.]) + fi + ++ ;; ++ riscv64*) ++ opal_cv_asm_arch="RISCV64" ++ OPAL_ASM_SUPPORT_64BIT=1 ++ OPAL_GCC_INLINE_ASSIGN='"li %0, 0" : "=&r"(ret)' + ;; + # There is no current difference between s390 and s390x + # But use two different defines in case some come later +diff --git a/opal/include/opal/sys/architecture.h b/opal/include/opal/sys/architecture.h +index ee9aa96..8a9fc53 100644 +--- a/opal/include/opal/sys/architecture.h ++++ b/opal/include/opal/sys/architecture.h +@@ -44,6 +44,7 @@ + #define OPAL_ARM64 0101 + #define OPAL_S390 0110 + #define OPAL_S390X 0111 ++#define OPAL_RISCV64 0120 + #define OPAL_BUILTIN_SYNC 0200 + #define OPAL_BUILTIN_GCC 0202 + #define OPAL_BUILTIN_NO 0203 +diff --git a/opal/include/opal/sys/cma.h b/opal/include/opal/sys/cma.h +index 4211013..9e02f99 100644 +--- a/opal/include/opal/sys/cma.h ++++ b/opal/include/opal/sys/cma.h +@@ -92,6 +92,13 @@ + #define __NR_process_vm_readv 340 + #define __NR_process_vm_writev 341 + ++#elif OPAL_ASSEMBLY_ARCH == OPAL_RISCV64 ++ ++/* RISCV64 uses the asm-generic syscall numbers */ ++ ++#define __NR_process_vm_readv 270 ++#define __NR_process_vm_writev 271 ++ + #else + #error "Unsupported architecture for process_vm_readv and process_vm_writev syscalls" + #endif +-- +2.35.1 + diff --git a/openmpi.spec b/openmpi.spec index c69be5e..99abd0d 100644 --- a/openmpi.spec +++ b/openmpi.spec @@ -37,7 +37,7 @@ Name: openmpi%{?_cc_name_suffix} Version: 4.1.4 -Release: 8%{?dist} +Release: 8.0.riscv64%{?dist} Summary: Open Message Passing Interface License: BSD and MIT and Romio URL: http://www.open-mpi.org/ @@ -49,6 +49,8 @@ Source2: openmpi.pth.py2 Source3: openmpi.pth.py3 Source4: macros.openmpi +Patch10: 0001-Add-initial-support-for-riscv64.patch + BuildRequires: gcc-c++ BuildRequires: gcc-gfortran BuildRequires: make @@ -57,7 +59,9 @@ BuildRequires: libtool BuildRequires: perl(Data::Dumper) BuildRequires: perl(File::Find) %endif +%ifarch %{valgrind_arches} BuildRequires: valgrind-devel +%endif %if %{with rdma} BuildRequires: opensm-devel > 3.3.0 BuildRequires: rdma-core-devel @@ -101,6 +105,14 @@ BuildRequires: zlib-devel BuildRequires: rpm-mpi-hooks %endif +%ifarch riscv64 +BuildRequires: automake +BuildRequires: autoconf +BuildRequires: libtool +BuildRequires: gettext +BuildRequires: perl-interpreter +%endif + Provides: mpi %if 0%{?rhel} == 7 # Need this for /etc/profile.d/modules.sh @@ -203,8 +215,10 @@ OpenMPI support for Python 3. %endif --enable-mpi1-compatibility \ --with-sge \ +%ifarch %{valgrind_arches} --with-valgrind \ --enable-memchecker \ +%endif --with-hwloc=/usr \ %if !0%{?el7} --with-libevent=external \ @@ -380,6 +394,10 @@ make check %changelog +* Thu Mar 23 2023 David Abdurachmanov - 4.1.4-8.0.riscv64 +- Add initial support for riscv64 +- Properly check valgrind arches + * Thu Jan 19 2023 Fedora Release Engineering - 4.1.4-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild