Skip to content

lapack: enable tests & remove python dependency - #113021

Merged
ajs124 merged 1 commit into
NixOS:stagingfrom
helsinki-systems:fix/lapack_tests
Feb 21, 2021
Merged

ajs124 merged 1 commit into
NixOS:stagingfrom
helsinki-systems:fix/lapack_tests

Conversation

@ajs124

@ajs124 ajs124 commented Feb 13, 2021 •

Copy link
Copy Markdown
Member
Motivation for this change

90326ba mentions enabling them and did set doCheck = true, but that doesn't actually work, because the cmake generated Makefiles do not have the right targets it was missing the flag to enable them.

As the python dependency is only needed for tests (edit: in the Makefiles, but not in cmake), but they do not work,
we can just remove it.

~~It would obviously be better to enable them instead, but ~~ lapack seems to
have 3 semi-incompatible build systems, and the tests seem to only work
with the Makefiles, which we do not and probably also do not want to
use.

See Reference-LAPACK/lapack#488 as for why we wouldn't want to use the Makefiles.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ajs124
ajs124 requested a review from matthewbauer February 13, 2021 17:51
@ofborg ofborg Bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. labels Feb 13, 2021
@christoph-conrads

Copy link
Copy Markdown

As the python dependency is only needed for tests, but they do not work,
we can just remove it.

It would obviously be better to enable them instead, but lapack seems to
have 3 semi-incompatible build systems, and the tests seem to only work
with the Makefiles, which we do not and probably also do not want to
use.

The tests work with both the pure Makefile build and the CMake-based build but

  • the pure Makefile approach builds the code with the gfortran parameter -frecursive causing large stack allocations (on some systems the stack limit must be increased with ulimit -s 65536),
  • the CMake build just works but may crash when certain functions are called concurrently.

The Python dependency is superfluous though. It just pretty prints the result and only when the pure Makefile build is executed.

@martin-frbg

Copy link
Copy Markdown

You need to specify -DBUILD_TESTING=ON for cmake to build the testsuite. (And similarly, have -frecursive/-Mrecursive or whatever your compiler uses to request re-entrant code support in your FFLAGS or CMAKE_Fortran_FLAGS to avoid the potential problems in multithreaded contexts. For gmake, this is predefined in the various sample make.inc files provided in INSTALL). The increased stacksize is only required for some DOUBLE COMPLEX parts of the testsuite (which will segfault otherwise)

@ajs124 ajs124 changed the title lapack: remove python dependency lapack: enable tests & remove python dependency Feb 13, 2021
@ajs124

ajs124 commented Feb 13, 2021

Copy link
Copy Markdown
Member Author

The tests only segfault for me if I add -DCMAKE_Fortran_FLAGS=-frecursive, so I omitted it here.

@SuperSandro2000

Copy link
Copy Markdown
Member

This might be a candidate for staging.

@martin-frbg

Copy link
Copy Markdown

The tests only segfault for me if I add -DCMAKE_Fortran_FLAGS=-frecursive, so I omitted it here.

Yes - the frecursive (which is necessary for the library to work correctly in multithreaded contexts - has the side effect of moving a big array of test input in one of the lapack-test executables onto the stack. Currently discussing in Reference-LAPACK if/how to remove that option when building the testsuite. Recommendation for now is to build with -frecursive if you expect users to link to the library from multithreaded code, and either live with the test segfaults or lift the OS default stacksize iimitation with ulimit -s unlimited before running the testsuite.

90326ba mentions enabling them and did
set doCheck = true, but that doesn't actually work
@ajs124
ajs124 changed the base branch from master to staging February 16, 2021 01:46
@ajs124

ajs124 commented Feb 19, 2021

Copy link
Copy Markdown
Member Author

If nobody has any objections and since this does not have any maintainer (and before anyone asks, no I won't add myself, I just want fewer things to depend on python2), I'll merge this in a few days.

As for -frecursive: we didn't set the flag so far and @matthewbauer intended to enable the tests, so let's just keep that as is, actually enable the tests and hope for the best.

@ajs124
ajs124 merged commit 164c9ee into NixOS:staging Feb 21, 2021
@ajs124
ajs124 deleted the fix/lapack_tests branch February 21, 2021 18:17
@bobrik

bobrik commented Mar 7, 2021 •

Copy link
Copy Markdown
Contributor

Some CBLAS tests are broken on Darwin. I asked about it upstream thinking it's aarch64-darwin specific:

But it turns out that tests also fail on x86_64-darwin. When this PR reaches master, it will break lapack and everything that depends on it (a ton of things do through numpy). It would be good to address this issue.

As a stopgap solution, the following skips failing tests:

  ctestArgs = lib.optionalString stdenv.isDarwin "-E '^(CBLAS-(x[sdcz]cblat[23]))$'";

  checkPhase = ''
    runHook preCheck
    ctest ${ctestArgs}
    runHook postCheck
  '';

@martin-frbg

Copy link
Copy Markdown

would be great if you updated the lapack issue with that info as well.. this test failure is not reproducible for me on Linux, might be useful to know what cmake options (if any) you used, and which compiler on x86_64

@bobrik bobrik mentioned this pull request Mar 17, 2021
6 of 10 tasks
github-actions Bot pushed a commit to bobrik/nixpkgs that referenced this pull request Mar 18, 2021
Tests were enabled in NixOS#113021 and staging is broken since then.
FRidh pushed a commit that referenced this pull request Mar 18, 2021
Tests were enabled in #113021 and staging is broken since then.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants