File: libmkl-dev.postinst.in

package info (click to toggle)
intel-mkl 2020.4.304-7
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 566,272 kB
  • sloc: xml: 3,919; sh: 798; python: 252; cpp: 211; ansic: 169; lisp: 145; awk: 117; makefile: 46
file content (130 lines) | stat: -rw-r--r-- 5,231 bytes parent folder | download | duplicates (5)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#! /bin/sh
set -e

# source debconf library
. /usr/share/debconf/confmodule

# priority 1 is even lower than the netlib reference implementation
# This should be safe enough if the package depends on a free alternative.
_mkl_rt_priority=1

# MKL has no all-in-one static library.
update-alternatives --install /usr/lib/@DEB_HOST_MULTIARCH@/libblas.so \
                    libblas.so-@DEB_HOST_MULTIARCH@ \
                    /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so \
                    $_mkl_rt_priority \
                    --slave /usr/include/@DEB_HOST_MULTIARCH@/cblas.h \
                    cblas.h-@DEB_HOST_MULTIARCH@ \
                    /usr/include/mkl/mkl_cblas.h \
                    --slave /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/blas.pc \
                    blas.pc-@DEB_HOST_MULTIARCH@ \
                    /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/mkl-sdl-lp64.pc

update-alternatives --install /usr/lib/@DEB_HOST_MULTIARCH@/liblapack.so \
                    liblapack.so-@DEB_HOST_MULTIARCH@ \
                    /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so \
                    $_mkl_rt_priority \
                    --slave /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/lapack.pc \
                    lapack.pc-@DEB_HOST_MULTIARCH@ \
                    /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/mkl-sdl-lp64.pc

if [ "amd64" = "@DEB_HOST_ARCH@" ]; then

  update-alternatives --install /usr/lib/@DEB_HOST_MULTIARCH@/libblas64.so \
                      libblas64.so-@DEB_HOST_MULTIARCH@ \
                      /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so \
                      $_mkl_rt_priority \
                      --slave /usr/include/@DEB_HOST_MULTIARCH@/cblas64.h \
                      cblas64.h-@DEB_HOST_MULTIARCH@ \
                      /usr/include/mkl/mkl_cblas.h \
                      --slave /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/blas64.pc \
                      blas64.pc-@DEB_HOST_MULTIARCH@ \
                      /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/mkl-sdl-ilp64.pc
  
  update-alternatives --install /usr/lib/@DEB_HOST_MULTIARCH@/liblapack64.so \
                      liblapack64.so-@DEB_HOST_MULTIARCH@ \
                      /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so \
                      $_mkl_rt_priority \
                      --slave /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/lapack64.pc \
                      lapack64.pc-@DEB_HOST_MULTIARCH@ \
                      /usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/mkl-sdl-ilp64.pc

fi

db_get libmkl-rt/use-as-default-blas-lapack
if [ "$RET" = "true" ]; then

  # When user says "yes", we point the symlinks to MKL, and set the
  # alternative in manual mode.
  echo "Setting MKL as default BLAS/LAPACK implementation as requested." 1>&2
  db_get libmkl-rt/exact-so-3-selections

  if (echo "$RET" | grep "libblas.so" 1>/dev/null 2>&1); then
  update-alternatives --set libblas.so-@DEB_HOST_MULTIARCH@ \
                      /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so
  fi

  if (echo "$RET" | grep "liblapack.so" 1>/dev/null 2>&1); then
  update-alternatives --set liblapack.so-@DEB_HOST_MULTIARCH@ \
                      /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so
  fi

  if [ "amd64" = "@DEB_HOST_ARCH@" ]; then

    if (echo "$RET" | grep "libblas64.so" 1>/dev/null 2>&1); then
    update-alternatives --set libblas64.so-@DEB_HOST_MULTIARCH@ \
                        /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so
    fi

    if (echo "$RET" | grep "liblapack64.so" 1>/dev/null 2>&1); then
    update-alternatives --set liblapack64.so-@DEB_HOST_MULTIARCH@ \
                        /usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so
    fi

  fi

else

  # When user says "no", we do nothing. However if the user says "no" when
  # MKL is selected, we should literally unselect it even if it's in manual
  # mode.
  echo "Unselecting MKL if they were previously selected." 1>&2

  realblas=$(update-alternatives --query libblas.so-@DEB_HOST_MULTIARCH@ \
             | grep ^Value: | cut -d ' ' -f 2)
  reallapack=$(update-alternatives --query liblapack.so-@DEB_HOST_MULTIARCH@ \
               | grep ^Value: | cut -d ' ' -f 2)

  if [ "$realblas" = "/usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so" ]; then
    update-alternatives --auto libblas.so-@DEB_HOST_MULTIARCH@
  fi

  if [ "$reallapack" = "/usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so" ]; then
    update-alternatives --auto liblapack.so-@DEB_HOST_MULTIARCH@
  fi


  if [ "amd64" = "@DEB_HOST_ARCH@" ]; then

    realblas64=$(update-alternatives --query libblas64.so-@DEB_HOST_MULTIARCH@ \
               | grep ^Value: | cut -d ' ' -f 2)
    reallapack64=$(update-alternatives --query liblapack64.so-@DEB_HOST_MULTIARCH@ \
                 | grep ^Value: | cut -d ' ' -f 2)

    if [ "$realblas64" = "/usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so" ]; then
      update-alternatives --auto libblas64.so-@DEB_HOST_MULTIARCH@
    fi

    if [ "$reallapack64" = "/usr/lib/@DEB_HOST_MULTIARCH@/libmkl_rt.so" ]; then
      update-alternatives --auto liblapack64.so-@DEB_HOST_MULTIARCH@
    fi

  fi

  # We are sure that MKL will be unselected by putting these alternatives
  # back into auto mode, because this package depends on free alternatives.
fi

#DEBHELPER#

exit 0