Skip to content

Commit

Permalink
Merge pull request #313306 from doronbehar/pkg/xsimd
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar authored May 22, 2024
2 parents 6838cab + 2f8ae86 commit 9d056f9
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 210 deletions.
35 changes: 13 additions & 22 deletions pkgs/development/libraries/xsimd/default.nix
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, doctest
}:

stdenv.mkDerivation (finalAttrs: {
pname = "xsimd";
version = "12.1.1";
version = "13.0.0";
src = fetchFromGitHub {
owner = "xtensor-stack";
repo = "xsimd";
rev = finalAttrs.version;
hash = "sha256-ofUFieeRtpnzNv3Ad5oYwKWb2XcqQHoj601TIhydJyI=";
hash = "sha256-qElJYW5QDj3s59L3NgZj5zkhnUMzIP2mBa1sPks3/CE=";
};
patches = [
# Ideally, Accelerate/Accelerate.h should be used for this implementation,
# but it doesn't work... Needs a Darwin user to debug this. We apply this
# patch unconditionally, because the #if macros make sure it doesn't
# interfer with the Linux implementations.
./fix-darwin-exp10-implementation.patch
] ++ lib.optionals stdenv.isDarwin [
# https://github.com/xtensor-stack/xsimd/issues/807
./disable-test_error_gamma-test.patch
] ++ lib.optionals (stdenv.isDarwin || stdenv.hostPlatform.isMusl) [
# - Darwin report: https://github.com/xtensor-stack/xsimd/issues/917
# - Musl report: https://github.com/xtensor-stack/xsimd/issues/798
./disable-exp10-test.patch
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
# https://github.com/xtensor-stack/xsimd/issues/798
./disable-polar-test.patch
] ++ lib.optionals stdenv.hostPlatform.isMusl [
# Fix suggested here: https://github.com/xtensor-stack/xsimd/issues/798#issuecomment-1356884601
# Upstream didn't merge that from some reason.
./fix-atan-test.patch
# Fix of https://github.com/xtensor-stack/xsimd/pull/1024 for
# https://github.com/xtensor-stack/xsimd/issues/456 and
# https://github.com/xtensor-stack/xsimd/issues/807,
(fetchpatch {
url = "https://github.com/xtensor-stack/xsimd/commit/c8a87ed6e04b6782f48f94713adfb0cad6c11ddf.patch";
hash = "sha256-2/FvBGdqTPcayD7rdHPSzL+F8IYKAfMW0WBJ0cW9EZ0=";
})
];

nativeBuildInputs = [
cmake
];

cmakeFlags = [
"-DBUILD_TESTS=${if (finalAttrs.finalPackage.doCheck && stdenv.hostPlatform == stdenv.buildPlatform) then "ON" else "OFF"}"
# Always build the tests, even if not running them, because testing whether
# they can be built is a test in itself.
"-DBUILD_TESTS=ON"
];

doCheck = true;
Expand Down
36 changes: 0 additions & 36 deletions pkgs/development/libraries/xsimd/disable-exp10-test.patch

This file was deleted.

38 changes: 0 additions & 38 deletions pkgs/development/libraries/xsimd/disable-polar-test.patch

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions pkgs/development/libraries/xsimd/fix-atan-test.patch

This file was deleted.

This file was deleted.

31 changes: 9 additions & 22 deletions pkgs/development/libraries/xtensor/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,30 @@

stdenv.mkDerivation (finalAttrs: {
pname = "xtensor";
version = "0.24.7";
version = "0.25.0";

src = fetchFromGitHub {
owner = "xtensor-stack";
repo = "xtensor";
rev = finalAttrs.version;
hash = "sha256-dVbpcBW+jK9nIl5efk5LdKdBm8CkaJWEZ0ZY7ZuApwk=";
hash = "sha256-hVfdtYcJ6mzqj0AUu6QF9aVKQGYKd45RngY6UN3yOH4=";
};
patches = [
# Support for xsimd 11
(fetchpatch {
url = "https://github.com/xtensor-stack/xtensor/commit/77a650a8018e0be6fcc76bf66685ff352ae23ef1.patch";
hash = "sha256-vOdUzzsSK+lYcA7fZXWOTVV202GZC0DhkMMjzggnmWE=";
})
# A single test fails on Darwin, see:
# https://github.com/xtensor-stack/xtensor/issues/2718
./remove-failing-test_xinfo.patch
];

nativeBuildInputs = [
cmake
];
propagatedBuildInputs = [
nlohmann_json
xtl
] ++ lib.optionals (!(stdenv.isAarch64 && stdenv.isLinux)) [
# xsimd support is broken on aarch64-linux, see:
# https://github.com/xtensor-stack/xsimd/issues/945
xsimd
];

cmakeFlags = let
cmakeBool = x: if x then "ON" else "OFF";
in [
"-DBUILD_TESTS=${cmakeBool finalAttrs.finalPackage.doCheck}"
"-DXTENSOR_ENABLE_ASSERT=${cmakeBool enableAssertions}"
"-DXTENSOR_CHECK_DIMENSION=${cmakeBool enableBoundChecks}"
cmakeFlags = [
# Always build the tests, even if not running them, because testing whether
# they can be built is a test in itself.
(lib.cmakeBool "BUILD_TESTS" true)
(lib.cmakeBool "XTENSOR_ENABLE_ASSERT" enableAssertions)
(lib.cmakeBool "XTENSOR_CHECK_DIMENSION" enableBoundChecks)
];

doCheck = true;
Expand All @@ -59,7 +46,7 @@ stdenv.mkDerivation (finalAttrs: {
checkTarget = "xtest";

meta = with lib; {
description = "Multi-dimensional arrays with broadcasting and lazy computing.";
description = "Multi-dimensional arrays with broadcasting and lazy computing";
homepage = "https://github.com/xtensor-stack/xtensor";
license = licenses.bsd3;
maintainers = with maintainers; [ cpcloud ];
Expand Down
12 changes: 0 additions & 12 deletions pkgs/development/libraries/xtensor/remove-failing-test_xinfo.patch

This file was deleted.

8 changes: 5 additions & 3 deletions pkgs/development/python-modules/xtensor-python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

toPythonModule (stdenv.mkDerivation(finalAttrs: {
pname = "xtensor-python";
version = "0.26.1";
version = "0.27.0";

src = fetchFromGitHub {
owner = "xtensor-stack";
repo = "xtensor-python";
rev = finalAttrs.version;
sha256 = "sha256-kLFt5Ah5/ZO6wfTZQviVXeIAVok+/F/XCwpgPSagOMo=";
sha256 = "sha256-Cy/aXuiriE/qxSd4Apipzak30DjgE7jX8ai1ThJ/VnE=";
};

nativeBuildInputs = [
Expand All @@ -31,7 +31,9 @@ toPythonModule (stdenv.mkDerivation(finalAttrs: {
];
doCheck = true;
cmakeFlags = [
"-DBUILD_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
# Always build the tests, even if not running them, because testing whether
# they can be built is a test in itself.
"-DBUILD_TESTS=ON"
];

propagatedBuildInputs = [
Expand Down

0 comments on commit 9d056f9

Please sign in to comment.