summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Exequiel Pedone2024-03-07 23:31:07 -0300
committerGonzalo Exequiel Pedone2024-03-07 23:31:07 -0300
commit0acd50d3f482a726f61badd88e37967e23a021f6 (patch)
treeb0a1b18bebc8b4aa734791ee41d656f8de4d34fc
downloadaur-0acd50d3f482a726f61badd88e37967e23a021f6.tar.gz
New package.
-rw-r--r--.SRCINFO35
-rw-r--r--.gitignore7
-rw-r--r--0001-Remove-shmctl.patch19
-rw-r--r--0002-Remove-getdtablesize.patch98
-rw-r--r--0003-Disable-address-patch-in-x86.patch34
-rw-r--r--PKGBUILD190
6 files changed, 383 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..07b745c64f19
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,35 @@
+pkgbase = android-x86-openmpi
+ pkgdesc = High performance message passing library (MPI) (android)
+ pkgver = 4.1.6
+ pkgrel = 1
+ url = https://www.open-mpi.org
+ arch = any
+ license = BSD-3-Clause AND LicenseRef-MPICH
+ makedepends = android-x86-hwloc
+ makedepends = android-x86-libfabric
+ makedepends = android-x86-libnl
+ makedepends = android-x86-openpmix
+ makedepends = android-x86-prrte
+ makedepends = android-x86-zlib
+ depends = android-x86-hwloc
+ depends = android-x86-libevent
+ depends = android-x86-libfabric
+ depends = android-x86-libnl
+ depends = android-x86-openpmix
+ depends = android-x86-prrte
+ depends = android-x86-zlib
+ optdepends = android-x86-openssh: for execution on remote hosts via plm_ssh_agent
+ options = !strip
+ options = !buildflags
+ options = staticlibs
+ options = !emptydirs
+ source = https://www.open-mpi.org/software/ompi/v4.1/downloads/openmpi-4.1.6.tar.bz2
+ source = 0001-Remove-shmctl.patch
+ source = 0002-Remove-getdtablesize.patch
+ source = 0003-Disable-address-patch-in-x86.patch
+ md5sums = c9b1c974cfc23c77c0fbdb965cd58a1c
+ md5sums = 137c5041b5a3a47574b5630b0ff82b4e
+ md5sums = 34b93930fb47257b3a77e51bd2a13de6
+ md5sums = f4b8f79f3f0cc039d2fcfca113e419e8
+
+pkgname = android-x86-openmpi
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..f3ed6a151b9f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+glib/
+pkg/
+src/
+*.log
+*.tar
+*.xz
+*.pkg.tar.zst
diff --git a/0001-Remove-shmctl.patch b/0001-Remove-shmctl.patch
new file mode 100644
index 000000000000..8c562c94e05e
--- /dev/null
+++ b/0001-Remove-shmctl.patch
@@ -0,0 +1,19 @@
+--- a/opal/mca/memory/patcher/memory_patcher_component.c
++++ b/opal/mca/memory/patcher/memory_patcher_component.c
+@@ -461,15 +461,7 @@
+
+ static size_t get_shm_size(int shmid)
+ {
+- struct shmid_ds ds;
+- int ret;
+-
+- ret = shmctl(shmid, IPC_STAT, &ds);
+- if (ret < 0) {
+- return 0;
+- }
+-
+- return ds.shm_segsz;
++ return 0;
+ }
+ # endif
+ #endif
diff --git a/0002-Remove-getdtablesize.patch b/0002-Remove-getdtablesize.patch
new file mode 100644
index 000000000000..019ebfb205cb
--- /dev/null
+++ b/0002-Remove-getdtablesize.patch
@@ -0,0 +1,98 @@
+--- a/orte/mca/state/base/state_base_fns.c
++++ b/orte/mca/state/base/state_base_fns.c
+@@ -1068,95 +1068,4 @@
+
+ void orte_state_base_check_fds(orte_job_t *jdata)
+ {
+- int nfds, i, fdflags, flflags;
+- char path[1024], info[256], **list=NULL, *status, *result, *r2;
+- ssize_t rc;
+- struct flock fl;
+- bool flk;
+- int cnt = 0;
+-
+- /* get the number of available file descriptors
+- * for this daemon */
+- nfds = getdtablesize();
+- result = NULL;
+- /* loop over them and get their info */
+- for (i=0; i < nfds; i++) {
+- fdflags = fcntl(i, F_GETFD);
+- if (-1 == fdflags) {
+- /* no open fd in that slot */
+- continue;
+- }
+- flflags = fcntl(i, F_GETFL);
+- if (-1 == flflags) {
+- /* no open fd in that slot */
+- continue;
+- }
+- snprintf(path, 1024, "/proc/self/fd/%d", i);
+- memset(info, 0, 256);
+- /* read the info about this fd */
+- rc = readlink(path, info, 256);
+- if (-1 == rc) {
+- /* this fd is unavailable */
+- continue;
+- }
+- /* get any file locking status */
+- fl.l_type = F_WRLCK;
+- fl.l_whence = 0;
+- fl.l_start = 0;
+- fl.l_len = 0;
+- if (-1 == fcntl(i, F_GETLK, &fl)) {
+- flk = false;
+- } else {
+- flk = true;
+- }
+- /* construct the list of capabilities */
+- if (fdflags & FD_CLOEXEC) {
+- opal_argv_append_nosize(&list, "cloexec");
+- }
+- if (flflags & O_APPEND) {
+- opal_argv_append_nosize(&list, "append");
+- }
+- if (flflags & O_NONBLOCK) {
+- opal_argv_append_nosize(&list, "nonblock");
+- }
+- /* from the man page:
+- * Unlike the other values that can be specified in flags,
+- * the access mode values O_RDONLY, O_WRONLY, and O_RDWR,
+- * do not specify individual bits. Rather, they define
+- * the low order two bits of flags, and defined respectively
+- * as 0, 1, and 2. */
+- if (O_RDONLY == (flflags & 3)) {
+- opal_argv_append_nosize(&list, "rdonly");
+- } else if (O_WRONLY == (flflags & 3)) {
+- opal_argv_append_nosize(&list, "wronly");
+- } else {
+- opal_argv_append_nosize(&list, "rdwr");
+- }
+- if (flk && F_UNLCK != fl.l_type) {
+- if (F_WRLCK == fl.l_type) {
+- opal_argv_append_nosize(&list, "wrlock");
+- } else {
+- opal_argv_append_nosize(&list, "rdlock");
+- }
+- }
+- if (NULL != list) {
+- status = opal_argv_join(list, ' ');
+- opal_argv_free(list);
+- list = NULL;
+- if (NULL == result) {
+- asprintf(&result, " %d\t(%s)\t%s\n", i, info, status);
+- } else {
+- asprintf(&r2, "%s %d\t(%s)\t%s\n", result, i, info, status);
+- free(result);
+- result = r2;
+- }
+- free(status);
+- }
+- ++cnt;
+- }
+- asprintf(&r2, "%s: %d open file descriptors after job %d completed\n%s",
+- ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), cnt, ORTE_LOCAL_JOBID(jdata->jobid), result);
+- opal_output(0, "%s", r2);
+- free(result);
+- free(r2);
+ }
diff --git a/0003-Disable-address-patch-in-x86.patch b/0003-Disable-address-patch-in-x86.patch
new file mode 100644
index 000000000000..1e48a675915b
--- /dev/null
+++ b/0003-Disable-address-patch-in-x86.patch
@@ -0,0 +1,34 @@
+--- a/opal/mca/patcher/overwrite/patcher_overwrite_module.c
++++ b/opal/mca/patcher/overwrite/patcher_overwrite_module.c
+@@ -312,30 +312,7 @@
+
+ static int mca_patcher_overwrite_patch_address (uintptr_t sys_addr, uintptr_t hook_addr)
+ {
+- mca_patcher_base_patch_t *patch;
+- int rc;
+-
+- patch = OBJ_NEW(mca_patcher_base_patch_t);
+- if (OPAL_UNLIKELY(NULL == patch)) {
+- return OPAL_ERR_OUT_OF_RESOURCE;
+- }
+-
+- patch->patch_orig = sys_addr;
+- patch->patch_value = hook_addr;
+-
+- opal_mutex_lock (&mca_patcher_overwrite_module.patch_list_mutex);
+- do {
+- rc = mca_patcher_overwrite_apply_patch (patch);
+- if (OPAL_SUCCESS != rc) {
+- break;
+- }
+-
+- opal_list_append (&mca_patcher_overwrite_module.patch_list, &patch->super);
+- } while (0);
+-
+- opal_mutex_unlock (&mca_patcher_overwrite_module.patch_list_mutex);
+-
+- return OPAL_SUCCESS;
++ return OPAL_ERROR;
+ }
+
+ static int mca_patcher_overwrite_patch_symbol (const char *func_symbol_name, uintptr_t func_new_addr,
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..b88576cb5417
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,190 @@
+# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
+# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: David Runge <dvzrv@archlinux.org>
+# Contributor: Anatol Pomozov <anatol dot pomozov at gmail>
+# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
+
+_android_arch=x86
+
+pkgname=android-${_android_arch}-openmpi
+
+if [[ "${_android_arch}" == armv7a-eabi || "${_android_arch}" == x86 ]]; then
+ pkgver=4.1.6
+ is_32_bits=true
+else
+ pkgver=5.0.2
+fi
+
+pkgrel=1
+arch=('any')
+pkgdesc='High performance message passing library (MPI) (android)'
+url='https://www.open-mpi.org'
+license=('BSD-3-Clause AND LicenseRef-MPICH')
+depends=("android-${_android_arch}-hwloc"
+ "android-${_android_arch}-libevent"
+ "android-${_android_arch}-libfabric"
+ "android-${_android_arch}-libnl"
+ "android-${_android_arch}-openpmix"
+ "android-${_android_arch}-prrte"
+ "android-${_android_arch}-zlib")
+makedepends=("android-${_android_arch}-hwloc"
+ "android-${_android_arch}-libfabric"
+ "android-${_android_arch}-libnl"
+ "android-${_android_arch}-openpmix"
+ "android-${_android_arch}-prrte"
+ "android-${_android_arch}-zlib")
+optdepends=("android-${_android_arch}-openssh: for execution on remote hosts via plm_ssh_agent")
+options=(!strip !buildflags staticlibs !emptydirs)
+source=("https://www.open-mpi.org/software/ompi/v${pkgver%.*}/downloads/openmpi-$pkgver.tar.bz2"
+ '0001-Remove-shmctl.patch'
+ '0002-Remove-getdtablesize.patch'
+ '0003-Disable-address-patch-in-x86.patch')
+
+if [ "${is_32_bits}" == true ]; then
+ _src_md5sum='c9b1c974cfc23c77c0fbdb965cd58a1c'
+else
+ _src_md5sum='047ea0985b79d30d5a24ee72cbf5f4bf'
+fi
+
+md5sums=(${_src_md5sum}
+ '137c5041b5a3a47574b5630b0ff82b4e'
+ '34b93930fb47257b3a77e51bd2a13de6'
+ 'f4b8f79f3f0cc039d2fcfca113e419e8')
+
+prepare() {
+ cd "${srcdir}/openmpi-$pkgver"
+ source android-env ${_android_arch}
+
+ export PERL=perl
+
+ if [ "${is_32_bits}" == true ]; then
+ pushd config
+ autom4te --language=m4sh opal_get_version.m4sh -o opal_get_version.sh
+ popd
+
+ autoreconf -fi || true
+ fi
+
+ if [ "${ANDROID_MINIMUM_PLATFORM}" -lt 26 ]; then
+ patch -Np1 -i ../0001-Remove-shmctl.patch
+ fi
+
+ if [ "${is_32_bits}" == true ]; then
+ patch -Np1 -i ../0002-Remove-getdtablesize.patch
+
+ if [ "${_android_arch}" == x86 ]; then
+ patch -Np1 -i ../0003-Disable-address-patch-in-x86.patch
+ fi
+ fi
+
+ # workaround for https://github.com/open-mpi/ompi/issues/12257
+ sed -i 's|WRAPPER__FCFLAGS|WRAPPER_FCFLAGS|g' configure
+ sed -i 's|WRAPPER_EXTRA_FCFLAGS|WRAPPER_FCFLAGS|g' configure
+ sed -i "s|\"-I${ANDROID_PREFIX_INCLUDE}\",||" opal/tools/wrappers/opal_wrapper.c
+
+ malloc_fname=opal_malloc
+ mv -f opal/util/malloc.h "opal/util/${malloc_fname}.h"
+
+ if [ "${is_32_bits}" == true ]; then
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" opal/runtime/opal_cr.c
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" orte/mca/ess/env/ess_env_module.c
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" orte/mca/ess/hnp/ess_hnp_module.c
+ else
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" opal/runtime/opal_init_core.c
+ fi
+
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" opal/include/opal_config_bottom.h
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" opal/runtime/opal_finalize.c
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" opal/runtime/opal_init.c
+ sed -i "s|opal/util/malloc.h|opal/util/${malloc_fname}.h|g" opal/util/malloc.c
+
+ if [ "${is_32_bits}" == true ]; then
+ sed -i "s| malloc.h | ${malloc_fname}.h |g" configure
+ sed -i "s| malloc.h | ${malloc_fname}.h |g" configure.ac
+ fi
+
+ sed -i "s| malloc.h | ${malloc_fname}.h |g" opal/util/Makefile.am
+ sed -i "s| malloc.h | ${malloc_fname}.h |g" opal/util/Makefile.in
+ sed -i "s|rindex|strrchr|g" oshmem/mca/memheap/base/memheap_base_static.c
+
+ if [ "${is_32_bits}" == true ]; then
+ sed -i "s|rindex|strrchr|g" orte/mca/plm/rsh/plm_rsh_module.c
+ fi
+
+ if [ "${is_32_bits}" == true ]; then
+ sed -i 's|bcmp|memcmp|g' ompi/mca/topo/treematch/treematch/tm_malloc.c
+ else
+ sed -i 's|bcmp|memcmp|g' 3rd-party/treematch/tm_malloc.c
+ fi
+}
+
+build() {
+ cd "${srcdir}/openmpi-$pkgver"
+ source android-env ${_android_arch}
+
+ # set environment variables for reproducible build
+ # see https://github.com/open-mpi/ompi/blob/main/docs/release-notes/general.rst
+ export HOSTNAME=buildhost
+ export USER=builduser
+
+ # Platform specific patches
+ case "$_android_arch" in
+ aarch64)
+ host=armv8-unknown-linux
+ ;;
+ armv7a-eabi)
+ host=armv7-unknown-linux
+ ;;
+ x86)
+ host=x86-unknown-linux
+ ;;
+ x86-64)
+ host=x86_64-unknown-linux
+ ;;
+ *)
+ ;;
+ esac
+
+ default_android_pp_flags="-fPIC -D_FORTIFY_SOURCE=2 -DEXFS_SUPER_MAGIC=0x45584653 -I${ANDROID_PREFIX_INCLUDE}"
+ default_android_compiler_flags="-fPIC -DEXFS_SUPER_MAGIC=0x45584653 -O2 -pipe -fno-plt -fexceptions --param=ssp-buffer-size=4"
+ default_android_linker_flags="-DEXFS_SUPER_MAGIC=0x45584653 -Wl,-O1,--sort-common,--as-needed"
+
+ export CPPFLAGS="${CPPFLAGS} $default_android_pp_flags"
+ export CFLAGS="${CFLAGS} $default_android_compiler_flags"
+ export CXXFLAGS="${CXXFLAGS} $default_android_compiler_flags"
+ export LDFLAGS="${LDFLAGS} $default_android_linker_flags"
+
+ export PERL=perl
+
+ # TODO: remove ac_cv_func_sem_open=no when there is a glibc release fixing https://sourceware.org/bugzilla/show_bug.cgi?id=30789
+ ac_cv_func_sem_open=no ./configure \
+ --host=${host} \
+ --prefix=${ANDROID_PREFIX} \
+ --libdir=${ANDROID_PREFIX_LIB} \
+ --includedir=${ANDROID_PREFIX_INCLUDE} \
+ --sysconfdir="${ANDROID_PREFIX_ETC}/openmpi" \
+ --enable-shared \
+ --enable-static \
+ --enable-builtin-atomics \
+ --enable-pretty-print-stacktrace \
+ --disable-mpi-fortran \
+ --disable-oshmem-fortran \
+ --disable-sphinx \
+ --with-hwloc=external \
+ --with-libevent=external \
+ --with-pmix=external \
+ --with-prrte=external
+ make V=1 $MAKEFLAGS
+}
+
+package() {
+ cd "${srcdir}/openmpi-$pkgver"
+ source android-env ${_android_arch}
+
+ make DESTDIR="$pkgdir" install
+ rm -f "$pkgdir/${ANDROID_PREFIX_BIN}"/*
+ rm -rf "$pkgdir/${ANDROID_PREFIX_SHARE}"
+ ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}"/${ANDROID_PREFIX_LIB}/*.so
+ ${ANDROID_STRIP} -g "$pkgdir"/${ANDROID_PREFIX_LIB}/*.a
+ rm -f "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so.*
+}