Gentoo Archives: gentoo-science

From: "Honza Macháček" <Hloupy.Honza@×××××××.cz>
To: gentoo-science@l.g.o
Subject: Re: [gentoo-science] Usage of blas and lapack with 64 bit integers
Date: Fri, 23 Oct 2020 12:14:40
Message-Id: 30a3e1a7-ca5f-ad4e-aace-982a7e4bbf22@centrum.cz
In Reply to: Re: [gentoo-science] Usage of blas and lapack with 64 bit integers by Aisha Tammy
1 On 10/22/20 1:06 PM, Aisha Tammy wrote:
2 > > ...Currently I use in my work mainly sci-chemistry/nwchem, now at the > 7.0.0 version. It uses blas and lapack, and prefers compilation with > 64
3 > bit integers (ILP64) data model, although an utility to convert it > for LP64
4 > model with 32 bit integers is provided. I'm attaching my > ebuild that I've
5 > finally used to install and start using the new > NWChem version. I'm also
6 > adding all the patches the ebuild references > in case you wanted to test the
7 > ebuild. I'm affraid the way I made it > use the ILP64 version of
8 > sci-libs/openblas-0.3.10 is rather ugly, and > some more elegant, more
9 > general, more systematic way should be > available...
10 >
11 > Yes, you can try to install the OpenBLAS package from ::gentoo with
12 > the 'index-64bit' use flag enabled, which will install a libopenblas64.so
13 > which should have what you want.
14 >
15 > I am working on cleanin up these packages, but this should work for your
16 > particular problem.
17
18   I'm sorry I wrote too much of mostly irrelevant talking, and failed to
19 describe my problem properly.
20
21   Yes, I've found out that to get sci-libs/openblas compiled in the ILP64 model
22 I have to set the “index-64bit” USE flag instead of the former “int64”. I don't
23 understand why the flag was renamed, and I don't like it (I'll write more on the
24 topic further below), but I can live with it as long as I know what I have to
25 set to get what I need.
26
27   The worst problem I see in the effect of the flag: sci-libs/openblas-0.3.10
28 compiles in the LP64 (32 bit integer) model, and installs the library with all
29 the bells and whistles. In addition, if the “index-64bit” is set, the ILP64 (64
30 bit integer) model version is compiled, and the resulting library file installed
31 — completely bare, with no pkg-config file, no eselect configuration. As a
32 result eselect knows nothing of the ILP64 version being installed, and packages
33 that want to use it cannot get the necessary configuration information from
34 pkg-config, at least not directly; you can see in my sci-chemistry/nwchem ebuild
35 that I let it query pkg-config for the library directories of the LP64 openblas
36 version, and add the name of the ILP64 library, manually hardcoding in the
37 ebuild the knowledge got from reading the sci-libs/openblas ebuild of the name
38 used for the ILP64 library and of the fact it is installed into the same
39 directory as the LP64 version. This is non-elegant and error-prone in case
40 changes are made to the sci-libs/openblas ebuild in future version changing the
41 name used for the ILP64 library or the directory it's installed into.
42
43   Maybe I should ask questions and protest the current state of afaires in the
44 Gentoo bugzilla when the sci-libs/openblas ebuild resides in the main tree but I
45 think I've seen phasing out the eselect alternatives concept and moving the
46 ebuild to the main repository mentioned a few times in this list, so I think
47 people responsible for the changes, and knowing their rationale are somewhere
48 around.
49
50   The problem with eselect may span more packages, at least sci-libs/mkl, the
51 only linear algebra library besides sci-libs/openblas that supports the ILP64
52 model, as far as I know. In the past, in the eselect alternatives ecosystem,
53 ILP64 model libraries were installed as a separate category of linear algebra
54 libraries. Now sci-libs/openblas with the “index-64bit” flag set installs both
55 LP64 and ILP64 libraries, only does not inform pkg-config nor eselect of the
56 ILP64 version existence. On the other hand sci-libs/mkl isntalls, as far as I
57 understand its ebuild, always only one version, and the “int64” flag selects
58 whether it should use the LP64 }32 bit integer) or ILP64 (64 bit integer) model.
59 I don't use sci-libs/mkl and I have not tested its behaviour but I suspect that
60 after installing it with “int64”, selecting it with eselect will break all the
61 programs using linear algebra libraries and expecting 32 bit integers.
62
63   By the way, there are newer versions of sci-libs/mkl in the science overlay
64 than in the main tree but they still depend on the old removed eselect
65 alternatives ecosystem. That may add to the relevance of my questions and
66 comments on mostly main tree packages to the science overlay project, as it
67 suggests that phasing out the old eselect alternatives ecosystem, partial to the
68 science overlay, is still a work in progress, and while it includes moving
69 packages from the overlay to the main tree, recreating the functionality based
70 in the past on that ecosystem is a job of the overlay developers.
71
72   I have not experimented with setting the default integer size to 64 bits for
73 my whole system, so I don't know if such an approach is viable. I believe that
74 having LP64 and ILP64 mode packages coexisting side by side is desirable, and
75 that eselect should recognize LP64 and ILP64 libraries as separate categories,
76 and offer switching among different available implementations inside these
77 categories separately, just like it used to do in the eselect alternatives
78 times, never replace an LP64 model library with an ILP64 model one or vice
79 versa. Having all the ebuilds of the libraries that support installation in both
80 model install them both side by side when ILP64 model is selected would likely
81 be ideal, whenever possible.
82
83   Besides I think that the flag selecting the ILP64 model should retain its old
84 name “int64”. It's shorter than “index-64bit”, and at the same time more
85 descriptive, less confusing. Moreover it has a tradition. While in the science
86 overlay it's currently used only by my old sci-chemistry/nwchem and by
87 virtual/scalapack, where it selects as the scalapack implementation
88 sci-libs/mkl[int64], in the main tree it's used by:
89
90 sci-libs/hypre
91
92 sci-libs/mkl
93
94 sci-libs/parmetis
95
96 sci-libs/pastix
97
98 sci-libs/scotch
99
100 sci-libs/superlu_mt
101
102   In all those packages the “int64” flag makes the ebuild set the integer size
103 to 64 bits, only in the sci-libs/scotch-6.0.4-r2 it sets only some array indices
104 to 64 bits (-DIDXSIZE64), leaving all the other integers at the system default
105 size — and it may be wrong, and the setting for all integers to be 64 bits wide
106 (-DINTSIZE64) should likely be added, as sci-libs/pastix[int64] depends on
107 sci-libs/scotch[int64], and sets the size of all integers to 64 bits, so
108 sci-libs/scotch[int64] installed by the current ebuild may break it.
109
110   The “index-64bit” flag is unique to the sci-libs/openblas ebuild. There is
111 another solitaire flag “64bit-index” unique to the sci-libs/blis ebuild — and
112 its effect is to set the integer size to 64 bits.
113
114   I don't know where the “index” part came from but it's definitely messy.
115
116   That's, I'm afraid, more than enough commenting and criticising from me. I'm
117 getting back to my usual hibernation. After some time, rather long then short, I
118 may wake up again, and file some bugs on the Gentoo bugzilla, publish my
119 personal overlay, quit using Gentoo, or whatever.
120
121   All the best for now.
122
123         Honza Macháček

Replies

Subject Author
Re: [gentoo-science] Usage of blas and lapack with 64 bit integers Aisha Tammy <gentoo.science@×××××.cc>