File: extract_MPI_dependency

package info (click to toggle)
petsc 3.7.5%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 163,864 kB
  • ctags: 618,438
  • sloc: ansic: 515,133; python: 29,793; makefile: 20,458; fortran: 18,998; cpp: 6,515; f90: 3,914; sh: 1,012; xml: 621; objc: 445; csh: 240; java: 13
file content (35 lines) | stat: -rwxr-xr-x 1,380 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

# PETSc depends on the specific MPI version (including release/patch version)
# that it was built against, whether OpenMPI or MPICH.
#
# This script returns a string identifying the required dependency,
# intended to be inserted as a Dependency for the version-specific PETSc -dev packages.

source <(sed "s/=/=\"/; s/$/\"/"  /usr/share/mpi-default-dev/debian_defaults)

if [ "x$ARCH_DEFAULT_MPI_IMPL" != "xopenmpi" ]; then
    # "not OpenMPI", assume MPICH
    MPI_DEV_PACKAGE=libmpich-dev
else
    # OpenMPI
    MPI_DEV_PACKAGE=libopenmpi-dev
fi

MPI_DEB_VERSION=$(dpkg -s $MPI_DEV_PACKAGE | awk '/Version:/ {print $2}')

# extract the current MPI version (drop epoch and debian package version)
MPI_VERSION=$(echo $MPI_DEB_VERSION | sed "s/^.[^:]*://; s/-[^-]*$//")

# "Main" version is upstream version up to the last '.'
MPI_MAIN_VERSION=$(echo $MPI_VERSION | sed "s/.[^.]*$//")
# "Release" version is upstream version after the last '.'
MPI_RELEASE_VERSION=$(echo $MPI_VERSION | sed "s/^.*\.//")

# Hopefully the release version is just a number. Use it to form the "next" version.
MPI_NEXT_VERSION=${MPI_MAIN_VERSION}.$(( $MPI_RELEASE_VERSION + 1 ))

# MPI_DEV_DEPENDS is a string like "libopenmpi-dev (>= 1.10.3), libopenmpi-dev (<< 1.10.4)"
MPI_DEV_DEPENDS="$MPI_DEV_PACKAGE (>= $MPI_VERSION), $MPI_DEV_PACKAGE (<< $MPI_NEXT_VERSION)"

echo $MPI_DEV_DEPENDS