From 8ded6b7ce349488a13f46e329c4b31c6cf8699b3 Mon Sep 17 00:00:00 2001 From: Andrew <51118083+ArionThinker@users.noreply.github.com> Date: Thu, 7 Sep 2023 19:32:16 +0300 Subject: [PATCH] open-mpi.org (#2306) * open-mpi.org * test * autoconf for darwin & MACOSX_DEPLOYMENT_TARGET env * sed * CXX & CC * without sed * modified: projects/open-mpi.org/package.yml * replace hardcoded paths * wip * wip * wip * OPAL_PREFIX * make check fails due to unfixed @rpaths * env * more env * try letting it find stuff * let's see what we can give it * more flags * hmmmm * suggested possibility * compiler and linker flags * this shouldn't be linux-only * gha runs as root --------- Co-authored-by: Jacob Heider --- projects/open-mpi.org/hello.c | 14 +++ projects/open-mpi.org/hellof.f90 | 9 ++ projects/open-mpi.org/hellousempi.f90 | 9 ++ projects/open-mpi.org/hellousempif08.f90 | 9 ++ projects/open-mpi.org/package.yml | 107 +++++++++++++++++++++++ 5 files changed, 148 insertions(+) create mode 100644 projects/open-mpi.org/hello.c create mode 100644 projects/open-mpi.org/hellof.f90 create mode 100644 projects/open-mpi.org/hellousempi.f90 create mode 100644 projects/open-mpi.org/hellousempif08.f90 create mode 100644 projects/open-mpi.org/package.yml diff --git a/projects/open-mpi.org/hello.c b/projects/open-mpi.org/hello.c new file mode 100644 index 00000000..9caf592e --- /dev/null +++ b/projects/open-mpi.org/hello.c @@ -0,0 +1,14 @@ +#include +#include + +int main() { + int size, rank, nameLen; + char name[MPI_MAX_PROCESSOR_NAME]; + MPI_Init(NULL, NULL); + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Get_processor_name(name, &nameLen); + printf("[%d/%d] Hello, world! My name is %s.\\n", rank, size, name); + MPI_Finalize(); + return 0; +} \ No newline at end of file diff --git a/projects/open-mpi.org/hellof.f90 b/projects/open-mpi.org/hellof.f90 new file mode 100644 index 00000000..48ab42a2 --- /dev/null +++ b/projects/open-mpi.org/hellof.f90 @@ -0,0 +1,9 @@ +program hello +include 'mpif.h' +integer rank, size, ierror, tag, status(MPI_STATUS_SIZE) +call MPI_INIT(ierror) +call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror) +call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror) +print*, 'node', rank, ': Hello Fortran world' +call MPI_FINALIZE(ierror) +end \ No newline at end of file diff --git a/projects/open-mpi.org/hellousempi.f90 b/projects/open-mpi.org/hellousempi.f90 new file mode 100644 index 00000000..eb2b1853 --- /dev/null +++ b/projects/open-mpi.org/hellousempi.f90 @@ -0,0 +1,9 @@ +program hello +use mpi +integer rank, size, ierror, tag, status(MPI_STATUS_SIZE) +call MPI_INIT(ierror) +call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror) +call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror) +print*, 'node', rank, ': Hello Fortran world' +call MPI_FINALIZE(ierror) +end \ No newline at end of file diff --git a/projects/open-mpi.org/hellousempif08.f90 b/projects/open-mpi.org/hellousempif08.f90 new file mode 100644 index 00000000..464a3b35 --- /dev/null +++ b/projects/open-mpi.org/hellousempif08.f90 @@ -0,0 +1,9 @@ +program hello +use mpi_f08 +integer rank, size, tag, status(MPI_STATUS_SIZE) +call MPI_INIT() +call MPI_COMM_SIZE(MPI_COMM_WORLD, size) +call MPI_COMM_RANK(MPI_COMM_WORLD, rank) +print*, 'node', rank, ': Hello Fortran world' +call MPI_FINALIZE() +end \ No newline at end of file diff --git a/projects/open-mpi.org/package.yml b/projects/open-mpi.org/package.yml new file mode 100644 index 00000000..6c4081cb --- /dev/null +++ b/projects/open-mpi.org/package.yml @@ -0,0 +1,107 @@ +distributable: + url: https://download.open-mpi.org/release/open-mpi/v{{version.marketing}}/openmpi-{{version}}.tar.bz2 + strip-components: 1 + +versions: + github: open-mpi/ompi/tags + +dependencies: + open-mpi.org/hwloc: '*' + libevent.org: '*' + gnu.org/gcc: '*' # for gfortran + gnu.org/inetutils: '*' # for rsh + +runtime: + env: + OPAL_PREFIX: "{{prefix}}" + OMPI_CC: gcc + OMPI_CXX: g++ + OMPI_FC: gfortran + OMPI_CFLAGS: $CFLAGS + OMPI_CXXFLAGS: $CXXFLAGS + OMPI_FCFLAGS: $FCFLAGS -I{{prefix}}/include + OMPI_CPPFLAGS: $CPPFLAGS + OMPI_LDFLAGS: $LDFLAGS + # OMPI_LIBS: $LIBRARY_PATH + OMPI_F77FLAGS: $FCFLAGS -I{{prefix}}/include + OMPI_F90FLAGS: $FCFLAGS -I{{prefix}}/include + # OMPI_FFLAGS: $OMPI_CFLAGS + # ORTE_CFLAGS: $OMPI_CFLAGS + # ORTE_CXXFLAGS: $OMPI_CFLAGS + # OPAL_CFLAGS: $OMPI_CFLAGS + # OPAL_CXXFLAGS: $OMPI_CFLAGS + # OMPI_LDFLAGS: "-L{{prefix}}/lib" + +build: + dependencies: + tea.xyz/gx/make: '*' + script: + - ./configure $CONFIGURE_ARGS + - make --jobs {{ hw.concurrency }} all + - make --jobs {{ hw.concurrency }} install + - run: | + sed -i.bak "s|$TEA_PREFIX|\${pcfiledir}/../../../..|g" ompi-c.pc ompi-cxx.pc ompi-fort.pc ompi.pc orte.pc pmix.pc + rm ./*.bak + working-directory: "{{prefix}}/lib/pkgconfig" + - run: | + sed -i.bak "s|linker_flags=.*|linker_flags=|g" mpic++-wrapper-data.txt mpicc-wrapper-data.txt mpifort-wrapper-data.txt ortecc-wrapper-data.txt + rm ./*.bak + working-directory: "{{prefix}}/share/openmpi" + - install {{prefix}}/lib/*.mod {{prefix}}/include/ + env: + CXXFLAGS: -std=c++11 + CONFIGURE_ARGS: + - --disable-debug + - --disable-dependency-tracking + - --prefix="{{prefix}}" + - --libdir="{{prefix}}/lib" + - --disable-silent-rules + - --enable-ipv6 + - --enable-mca-no-build=reachable-netlink + - --sysconfdir="{{prefix}}/etc" + - --with-libevent="{{deps.libevent.org.prefix}}" + - --with-sge + - --disable-dlopen + +provides: + - bin/mpic++ + - bin/mpiCC + - bin/mpicc + - bin/mpicxx + - bin/mpiexec + - bin/mpif77 + - bin/mpif90 + - bin/mpifort + - bin/mpirun + - bin/ompi-clean + - bin/ompi_info + - bin/ompi-server + - bin/opal_wrapper + - bin/ortecc + - bin/orte-clean + - bin/orted + - bin/orte-info + - bin/orterun + - bin/orte-server + +test: + dependencies: + freedesktop.org/pkg-config: '*' + script: + - mpicc hello.c -o hello + - ./hello + - mpirun ./hello + - mpifort hellof.f90 -o hellof + - ./hellof + - mpirun ./hellof + - mpifort hellousempi.f90 -o hellousempi + - ./hellousempi + - mpirun ./hellousempi + - mpifort hellousempif08.f90 -o hellousempif08 + - ./hellousempif08 + - mpirun ./hellousempif08 + - pkg-config --modversion ompi + env: + linux/x86-64: # GHA hosts run as root + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1