From d80fa8cf2c8dd248275f15650df1d355635cf297 Mon Sep 17 00:00:00 2001 From: Jingyun Hua Date: Wed, 31 May 2023 01:13:56 +0000 Subject: [PATCH] add loongarch64 support Signed-off-by: Jingyun Hua --- openmpi-2.1.1-add-loongarch64-support.patch | 261 ++++++++++++++++++++ openmpi.spec | 12 +- 2 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 openmpi-2.1.1-add-loongarch64-support.patch diff --git a/openmpi-2.1.1-add-loongarch64-support.patch b/openmpi-2.1.1-add-loongarch64-support.patch new file mode 100644 index 0000000..959525f --- /dev/null +++ b/openmpi-2.1.1-add-loongarch64-support.patch @@ -0,0 +1,261 @@ +From 9de935e3617f13083105655071c1280d625dc48c Mon Sep 17 00:00:00 2001 +From: Jingyun Hua +Date: Tue, 30 May 2023 09:06:22 +0000 +Subject: [PATCH] openmpi 2.1.1: add loongarch64 support + +Signed-off-by: Jingyun Hua +--- + aclocal.m4 | 8 ++++---- + config/opal_config_asm.m4 | 6 ++++++ + configure | 9 ++++++++- + ompi/mca/io/romio314/romio/aclocal.m4 | 8 ++++---- + ompi/mca/io/romio314/romio/configure | 2 +- + opal/include/opal/sys/architecture.h | 1 + + opal/include/opal/sys/cma.h | 4 ++++ + opal/mca/event/libevent2022/libevent/aclocal.m4 | 8 ++++---- + opal/mca/event/libevent2022/libevent/configure | 2 +- + opal/mca/pmix/pmix112/pmix/aclocal.m4 | 8 ++++---- + opal/mca/pmix/pmix112/pmix/configure | 2 +- + 11 files changed, 38 insertions(+), 20 deletions(-) + +diff --git a/aclocal.m4 b/aclocal.m4 +index 47d269f..9ae7180 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -1,4 +1,4 @@ +-# generated automatically by aclocal 1.15 -*- Autoconf -*- ++# generated automatically by aclocal 1.16 -*- Autoconf -*- + + # Copyright (C) 1996-2014 Free Software Foundation, Inc. + +@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) + # generated from the m4 files accompanying Automake X.Y. + # (This private macro should not be called outside this file.) + AC_DEFUN([AM_AUTOMAKE_VERSION], +-[am__api_version='1.15' ++[am__api_version='1.16' + dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to + dnl require some minimum version. Point them to the right macro. +-m4_if([$1], [1.15], [], ++m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl + ]) + +@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) + # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. + # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. + AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +-[AM_AUTOMAKE_VERSION([1.15])dnl ++[AM_AUTOMAKE_VERSION([1.16.5])dnl + m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl + _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +diff --git a/config/opal_config_asm.m4 b/config/opal_config_asm.m4 +index e2cfd97..56b1aed 100644 +--- a/config/opal_config_asm.m4 ++++ b/config/opal_config_asm.m4 +@@ -1020,6 +1020,12 @@ AC_DEFUN([OPAL_CONFIG_ASM],[ + OPAL_ASM_SUPPORT_64BIT=1 + OPAL_GCC_INLINE_ASSIGN='"mov %0=r0\n;;\n" : "=&r"(ret)' + ;; ++ loongarch64*) ++ opal_cv_asm_arch="LOONGARCH64" ++ OPAL_ASM_SUPPORT_64BIT=1 ++ OPAL_GCC_INLINE_ASSIGN='"li.d %0, 0" : "=&r"(ret)' ++ ;; ++ + aarch64*) + opal_cv_asm_arch="ARM64" + OPAL_ASM_SUPPORT_64BIT=1 +diff --git a/configure b/configure +index d48afbf..e72a3fb 100755 +--- a/configure ++++ b/configure +@@ -7233,7 +7233,7 @@ $as_echo "$as_me: WARNING: This usually indicates an error in configure." >&2;} + # + # Init automake + # +-am__api_version='1.15' ++am__api_version='1.16' + + # Find a good install program. We prefer a C program (faster), + # so one script is as good as another. But avoid the broken or +@@ -32858,6 +32858,13 @@ $as_echo "$as_me: WARNING: This usually indicates an error in configure." >&2;} + OPAL_ASM_SUPPORT_64BIT=1 + OPAL_GCC_INLINE_ASSIGN='"mov %0=r0\n;;\n" : "=&r"(ret)' + ;; ++ ++ loongarch64*) ++ opal_cv_asm_arch="LOONGARCH64" ++ OPAL_ASM_SUPPORT_64BIT=1 ++ OPAL_GCC_INLINE_ASSIGN='"li.d %0, 0" : "=&r"(ret)' ++ ;; ++ + aarch64*) + opal_cv_asm_arch="ARM64" + OPAL_ASM_SUPPORT_64BIT=1 +diff --git a/ompi/mca/io/romio314/romio/aclocal.m4 b/ompi/mca/io/romio314/romio/aclocal.m4 +index 7afc615..edd74ef 100644 +--- a/ompi/mca/io/romio314/romio/aclocal.m4 ++++ b/ompi/mca/io/romio314/romio/aclocal.m4 +@@ -1,4 +1,4 @@ +-# generated automatically by aclocal 1.15 -*- Autoconf -*- ++# generated automatically by aclocal 1.16 -*- Autoconf -*- + + # Copyright (C) 1996-2014 Free Software Foundation, Inc. + +@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) + # generated from the m4 files accompanying Automake X.Y. + # (This private macro should not be called outside this file.) + AC_DEFUN([AM_AUTOMAKE_VERSION], +-[am__api_version='1.15' ++[am__api_version='1.16' + dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to + dnl require some minimum version. Point them to the right macro. +-m4_if([$1], [1.15], [], ++m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl + ]) + +@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) + # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. + # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. + AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +-[AM_AUTOMAKE_VERSION([1.15])dnl ++[AM_AUTOMAKE_VERSION([1.16.5])dnl + m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl + _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +diff --git a/ompi/mca/io/romio314/romio/configure b/ompi/mca/io/romio314/romio/configure +index eebc8b6..fa8c038 100755 +--- a/ompi/mca/io/romio314/romio/configure ++++ b/ompi/mca/io/romio314/romio/configure +@@ -2917,7 +2917,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +-am__api_version='1.15' ++am__api_version='1.16' + + # Find a good install program. We prefer a C program (faster), + # so one script is as good as another. But avoid the broken or +diff --git a/opal/include/opal/sys/architecture.h b/opal/include/opal/sys/architecture.h +index ff4fbc9..27f85e4 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_LOONGARCH64 0120 + #define OPAL_BUILTIN_SYNC 0200 + #define OPAL_BUILTIN_OSX 0201 + #define OPAL_BUILTIN_GCC 0202 +diff --git a/opal/include/opal/sys/cma.h b/opal/include/opal/sys/cma.h +index eda529f..e690f24 100644 +--- a/opal/include/opal/sys/cma.h ++++ b/opal/include/opal/sys/cma.h +@@ -97,6 +97,10 @@ + #define __NR_process_vm_readv 340 + #define __NR_process_vm_writev 341 + ++#elif OPAL_ASSEMBLY_ARCH == OPAL_LOONGARCH64 ++#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 +diff --git a/opal/mca/event/libevent2022/libevent/aclocal.m4 b/opal/mca/event/libevent2022/libevent/aclocal.m4 +index 6d8aa8f..0b0f9af 100644 +--- a/opal/mca/event/libevent2022/libevent/aclocal.m4 ++++ b/opal/mca/event/libevent2022/libevent/aclocal.m4 +@@ -1,4 +1,4 @@ +-# generated automatically by aclocal 1.15 -*- Autoconf -*- ++# generated automatically by aclocal 1.16 -*- Autoconf -*- + + # Copyright (C) 1996-2014 Free Software Foundation, Inc. + +@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) + # generated from the m4 files accompanying Automake X.Y. + # (This private macro should not be called outside this file.) + AC_DEFUN([AM_AUTOMAKE_VERSION], +-[am__api_version='1.15' ++[am__api_version='1.16' + dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to + dnl require some minimum version. Point them to the right macro. +-m4_if([$1], [1.15], [], ++m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl + ]) + +@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) + # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. + # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. + AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +-[AM_AUTOMAKE_VERSION([1.15])dnl ++[AM_AUTOMAKE_VERSION([1.16.5])dnl + m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl + _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +diff --git a/opal/mca/event/libevent2022/libevent/configure b/opal/mca/event/libevent2022/libevent/configure +index 19cdda1..b69d045 100755 +--- a/opal/mca/event/libevent2022/libevent/configure ++++ b/opal/mca/event/libevent2022/libevent/configure +@@ -2642,7 +2642,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # Open MPI: changed to one 1 arg AM INIT_AUTOMAKE +-am__api_version='1.15' ++am__api_version='1.16' + + ac_aux_dir= + for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do +diff --git a/opal/mca/pmix/pmix112/pmix/aclocal.m4 b/opal/mca/pmix/pmix112/pmix/aclocal.m4 +index 18b241c..e343835 100644 +--- a/opal/mca/pmix/pmix112/pmix/aclocal.m4 ++++ b/opal/mca/pmix/pmix112/pmix/aclocal.m4 +@@ -1,4 +1,4 @@ +-# generated automatically by aclocal 1.15 -*- Autoconf -*- ++# generated automatically by aclocal 1.16 -*- Autoconf -*- + + # Copyright (C) 1996-2014 Free Software Foundation, Inc. + +@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) + # generated from the m4 files accompanying Automake X.Y. + # (This private macro should not be called outside this file.) + AC_DEFUN([AM_AUTOMAKE_VERSION], +-[am__api_version='1.15' ++[am__api_version='1.16' + dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to + dnl require some minimum version. Point them to the right macro. +-m4_if([$1], [1.15], [], ++m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl + ]) + +@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) + # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. + # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. + AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +-[AM_AUTOMAKE_VERSION([1.15])dnl ++[AM_AUTOMAKE_VERSION([1.16.5])dnl + m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl + _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +diff --git a/opal/mca/pmix/pmix112/pmix/configure b/opal/mca/pmix/pmix112/pmix/configure +index ce6a720..b2250a6 100755 +--- a/opal/mca/pmix/pmix112/pmix/configure ++++ b/opal/mca/pmix/pmix112/pmix/configure +@@ -3121,7 +3121,7 @@ test -n "$target_alias" && + program_prefix=${target_alias}- + + # Init automake +-am__api_version='1.15' ++am__api_version='1.16' + + # Find a good install program. We prefer a C program (faster), + # so one script is as good as another. But avoid the broken or +-- +2.33.0 + diff --git a/openmpi.spec b/openmpi.spec index 8f416dd..13dc4d5 100644 --- a/openmpi.spec +++ b/openmpi.spec @@ -1,6 +1,6 @@ Name: openmpi Version: 2.1.1 -Release: 22 +Release: 23 Summary: Open Source High Performance Computing License: BSD and MIT and Romio URL: http://www.open-mpi.org/ @@ -11,6 +11,9 @@ Source3: macros.openmpi %ifarch sw_64 Patch1: openmpi-2.1.1-sw.patch %endif +%ifarch loongarch64 +Patch2: openmpi-2.1.1-add-loongarch64-support.patch +%endif BuildRequires: gcc-c++, gcc-gfortran BuildRequires: valgrind-devel, hwloc-devel, java-1.8.0-openjdk-devel, libfabric-devel, papi-devel @@ -71,6 +74,10 @@ This contains man files for the using of openmpi. %prep %autosetup -n openmpi-%{version} -p1 +%ifarch loongarch64 +%_update_config_guess +%_update_config_sub +%endif %build ./configure --prefix=%{_libdir}/%{name} \ @@ -220,6 +227,9 @@ make check %{_mandir}/%{name_all}/man*/* %changelog +* Wed May 31 2023 huajingyun - 2.1.1-23 +- Add loongarch64 support + * Tue Oct 25 2022 wuzx - 2.1.1-22 - Add sw64 architecture -- Gitee