Unverified Commit 29358a51 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #203235 from Madouura/pr/matrices

parents 5da55af0 ad39a564
Loading
Loading
Loading
Loading
+20 −28
Original line number Diff line number Diff line
@@ -11,22 +11,14 @@
, hip
, gfortran
, git
, fetchzip ? null
, gtest ? null
, buildTests ? false
}:

assert buildTests -> fetchzip != null;
assert buildTests -> gtest != null;

# This can also use cuSPARSE as a backend instead of rocSPARSE
let
  matrices = lib.optionalAttrs buildTests import ./deps.nix {
    inherit fetchzip;
    mirror1 = "https://sparse.tamu.edu/MM";
    mirror2 = "https://www.cise.ufl.edu/research/sparse/MM";
  };
in stdenv.mkDerivation (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
  pname = "hipsparse";
  repoVersion = "2.3.1";
  rocmVersion = "5.3.3";
@@ -81,25 +73,25 @@ in stdenv.mkDerivation (finalAttrs: {
  '' + lib.optionalString buildTests ''
    mkdir -p matrices

    ln -s ${matrices.matrix-01}/*.mtx matrices
    ln -s ${matrices.matrix-02}/*.mtx matrices
    ln -s ${matrices.matrix-03}/*.mtx matrices
    ln -s ${matrices.matrix-04}/*.mtx matrices
    ln -s ${matrices.matrix-05}/*.mtx matrices
    ln -s ${matrices.matrix-06}/*.mtx matrices
    ln -s ${matrices.matrix-07}/*.mtx matrices
    ln -s ${matrices.matrix-08}/*.mtx matrices
    ln -s ${matrices.matrix-09}/*.mtx matrices
    ln -s ${matrices.matrix-10}/*.mtx matrices
    ln -s ${matrices.matrix-11}/*.mtx matrices
    ln -s ${matrices.matrix-12}/*.mtx matrices
    ln -s ${matrices.matrix-13}/*.mtx matrices
    ln -s ${matrices.matrix-14}/*.mtx matrices
    ln -s ${matrices.matrix-15}/*.mtx matrices
    ln -s ${matrices.matrix-16}/*.mtx matrices
    ln -s ${matrices.matrix-17}/*.mtx matrices
    ln -s ${matrices.matrix-18}/*.mtx matrices
    ln -s ${matrices.matrix-19}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-01}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-02}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-03}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-04}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-05}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-06}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-07}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-08}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-09}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-10}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-11}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-12}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-13}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-14}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-15}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-16}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-17}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-18}/*.mtx matrices
    ln -s ${rocsparse.passthru.matrices.matrix-19}/*.mtx matrices

    # Not used by the original cmake, causes an error
    rm matrices/*_b.mtx
+0 −177
Original line number Diff line number Diff line
{ fetchzip
, mirror1
, mirror2
}:

{
  matrix-01 = fetchzip {
    sha256 = "sha256-AHur5ZIDZTFRrO2GV0ieXrffq4KUiGWiZ59pv0fUtEQ=";

    urls = [
      "${mirror1}/SNAP/amazon0312.tar.gz"
      "${mirror2}/SNAP/amazon0312.tar.gz"
    ];
  };

  matrix-02 = fetchzip {
    sha256 = "sha256-0rSxaN4lQcdaCLsvlgicG70FXUxXeERPiEmQ4MzbRdE=";

    urls = [
      "${mirror1}/Muite/Chebyshev4.tar.gz"
      "${mirror2}/Muite/Chebyshev4.tar.gz"
    ];
  };

  matrix-03 = fetchzip {
    sha256 = "sha256-hDzDWDUnHEyFedX/tMNq83ZH8uWyM4xtZYUUAD3rizo=";

    urls = [
      "${mirror1}/FEMLAB/sme3Dc.tar.gz"
      "${mirror2}/FEMLAB/sme3Dc.tar.gz"
    ];
  };

  matrix-04 = fetchzip {
    sha256 = "sha256-GmN2yOt/MoX01rKe05aTyB3ypUP4YbQGOITZ0BqPmC0=";

    urls = [
      "${mirror1}/Williams/webbase-1M.tar.gz"
      "${mirror2}/Williams/webbase-1M.tar.gz"
    ];
  };

  matrix-05 = fetchzip {
    sha256 = "sha256-gQNjfVyWzNM9RwImJGhkhahRmZz74LzDs1oijL7mI7k=";

    urls = [
      "${mirror1}/Williams/mac_econ_fwd500.tar.gz"
      "${mirror2}/Williams/mac_econ_fwd500.tar.gz"
    ];
  };

  matrix-06 = fetchzip {
    sha256 = "sha256-87cdZjntNcTuz5BtO59irhcuRbPllWSbhCEX3Td02qc=";

    urls = [
      "${mirror1}/Williams/mc2depi.tar.gz"
      "${mirror2}/Williams/mc2depi.tar.gz"
    ];
  };

  matrix-07 = fetchzip {
    sha256 = "sha256-WRamuJX3D8Tm+k0q67RjUDG3DeNAxhKiaPkk5afY5eU=";

    urls = [
      "${mirror1}/Bova/rma10.tar.gz"
      "${mirror2}/Bova/rma10.tar.gz"
    ];
  };

  matrix-08 = fetchzip {
    sha256 = "sha256-5dhkm293Mc3lzakKxHy5W5XIn4Rw+gihVh7gyrjEHXo=";

    urls = [
      "${mirror1}/JGD_BIBD/bibd_22_8.tar.gz"
      "${mirror2}/JGD_BIBD/bibd_22_8.tar.gz"
    ];
  };

  matrix-09 = fetchzip {
    sha256 = "sha256-czjLWCjXAjZCk5TGYHaEkwSAzQu3TQ3QyB6eNKR4G88=";

    urls = [
      "${mirror1}/Hamm/scircuit.tar.gz"
      "${mirror2}/Hamm/scircuit.tar.gz"
    ];
  };

  matrix-10 = fetchzip {
    sha256 = "sha256-bYuLnJViAIcIejAkh69/bsNAVIDU4wfTLtD+nmHd6FM=";

    urls = [
      "${mirror1}/Sandia/ASIC_320k.tar.gz"
      "${mirror2}/Sandia/ASIC_320k.tar.gz"
    ];
  };

  matrix-11 = fetchzip {
    sha256 = "sha256-aDwn8P1khYjo2Agbq5m9ZBInJUxf/knJNvyptt0fak0=";

    urls = [
      "${mirror1}/GHS_psdef/bmwcra_1.tar.gz"
      "${mirror2}/GHS_psdef/bmwcra_1.tar.gz"
    ];
  };

  matrix-12 = fetchzip {
    sha256 = "sha256-8OJqA/byhlAZd869TPUzZFdsOiwOoRGfKyhM+RMjXoY=";

    urls = [
      "${mirror1}/HB/nos1.tar.gz"
      "${mirror2}/HB/nos1.tar.gz"
    ];
  };

  matrix-13 = fetchzip {
    sha256 = "sha256-FS0rKqmg+uHwsM/yGfQLBdd7LH/rUrdutkNGBD/Mh1I=";

    urls = [
      "${mirror1}/HB/nos2.tar.gz"
      "${mirror2}/HB/nos2.tar.gz"
    ];
  };

  matrix-14 = fetchzip {
    sha256 = "sha256-DANnlrNJikrI7Pst9vRedtbuxepyHmCIu2yhltc4Qcs=";

    urls = [
      "${mirror1}/HB/nos3.tar.gz"
      "${mirror2}/HB/nos3.tar.gz"
    ];
  };

  matrix-15 = fetchzip {
    sha256 = "sha256-21mUgqjWGUfYgiWwSrKh9vH8Vdt3xzcefmqYNYRpxiY=";

    urls = [
      "${mirror1}/HB/nos4.tar.gz"
      "${mirror2}/HB/nos4.tar.gz"
    ];
  };

  matrix-16 = fetchzip {
    sha256 = "sha256-FOuXvGqBBFNkVS6cexmkluret54hCfCOdK+DOZllE4c=";

    urls = [
      "${mirror1}/HB/nos5.tar.gz"
      "${mirror2}/HB/nos5.tar.gz"
    ];
  };

  matrix-17 = fetchzip {
    sha256 = "sha256-+7NI1rA/qQxYPpjXKHvAaCZ+LSaAJ4xuJvMRMBEUYxg=";

    urls = [
      "${mirror1}/HB/nos6.tar.gz"
      "${mirror2}/HB/nos6.tar.gz"
    ];
  };

  matrix-18 = fetchzip {
    sha256 = "sha256-q3NxJjbwGGcFiQ9nhWfUKgZmdVwCfPmgQoqy0AqOsNc=";

    urls = [
      "${mirror1}/HB/nos7.tar.gz"
      "${mirror2}/HB/nos7.tar.gz"
    ];
  };

  matrix-19 = fetchzip {
    sha256 = "sha256-0GAN6qmVfD+tprIigzuUUUwm5KVhkN9X65wMEvFltDY=";

    urls = [
      "${mirror1}/DNVS/shipsec1.tar.gz"
      "${mirror2}/DNVS/shipsec1.tar.gz"
    ];
  };
}
+43 −42
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, fetchzip
, writeScript
, cmake
, rocm-cmake
@@ -11,7 +12,6 @@
, hip
, gfortran
, git
, fetchzip ? null
, gtest ? null
, boost ? null
, python3Packages ? null
@@ -19,18 +19,11 @@
, buildBenchmarks ? false # Seems to depend on tests
}:

assert (buildTests || buildBenchmarks) -> fetchzip != null;
assert (buildTests || buildBenchmarks) -> gtest != null;
assert (buildTests || buildBenchmarks) -> boost != null;
assert (buildTests || buildBenchmarks) -> python3Packages != null;

let
  matrices = lib.optionalAttrs (buildTests || buildBenchmarks) import ./deps.nix {
    inherit fetchzip;
    mirror1 = "https://sparse.tamu.edu/MM";
    mirror2 = "https://www.cise.ufl.edu/research/sparse/MM";
  };
in stdenv.mkDerivation (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
  pname = "rocsparse";
  repoVersion = "2.3.2";
  rocmVersion = "5.3.3";
@@ -90,30 +83,30 @@ in stdenv.mkDerivation (finalAttrs: {
  postPatch = lib.optionalString (buildTests || buildBenchmarks) ''
    mkdir -p matrices

    ln -s ${matrices.matrix-01}/*.mtx matrices
    ln -s ${matrices.matrix-02}/*.mtx matrices
    ln -s ${matrices.matrix-03}/*.mtx matrices
    ln -s ${matrices.matrix-04}/*.mtx matrices
    ln -s ${matrices.matrix-05}/*.mtx matrices
    ln -s ${matrices.matrix-06}/*.mtx matrices
    ln -s ${matrices.matrix-07}/*.mtx matrices
    ln -s ${matrices.matrix-08}/*.mtx matrices
    ln -s ${matrices.matrix-09}/*.mtx matrices
    ln -s ${matrices.matrix-10}/*.mtx matrices
    ln -s ${matrices.matrix-11}/*.mtx matrices
    ln -s ${matrices.matrix-12}/*.mtx matrices
    ln -s ${matrices.matrix-13}/*.mtx matrices
    ln -s ${matrices.matrix-14}/*.mtx matrices
    ln -s ${matrices.matrix-15}/*.mtx matrices
    ln -s ${matrices.matrix-16}/*.mtx matrices
    ln -s ${matrices.matrix-17}/*.mtx matrices
    ln -s ${matrices.matrix-18}/*.mtx matrices
    ln -s ${matrices.matrix-19}/*.mtx matrices
    ln -s ${matrices.matrix-20}/*.mtx matrices
    ln -s ${matrices.matrix-21}/*.mtx matrices
    ln -s ${matrices.matrix-22}/*.mtx matrices
    ln -s ${matrices.matrix-23}/*.mtx matrices
    ln -s ${matrices.matrix-24}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-01}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-02}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-03}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-04}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-05}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-06}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-07}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-08}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-09}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-10}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-11}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-12}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-13}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-14}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-15}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-16}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-17}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-18}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-19}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-20}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-21}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-22}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-23}/*.mtx matrices
    ln -s ${finalAttrs.passthru.matrices.matrix-24}/*.mtx matrices

    # Not used by the original cmake, causes an error
    rm matrices/*_b.mtx
@@ -140,7 +133,14 @@ in stdenv.mkDerivation (finalAttrs: {
    rmdir $out/bin
  '';

  passthru.updateScript = writeScript "update.sh" ''
  passthru = {
    matrices = import ./deps.nix {
      inherit fetchzip;
      mirror1 = "https://sparse.tamu.edu/MM";
      mirror2 = "https://www.cise.ufl.edu/research/sparse/MM";
    };

    updateScript = writeScript "update.sh" ''
      #!/usr/bin/env nix-shell
      #!nix-shell -i bash -p curl jq common-updater-scripts
      json="$(curl -sL "https://api.github.com/repos/ROCmSoftwarePlatform/rocSPARSE/releases?per_page=1")"
@@ -149,6 +149,7 @@ in stdenv.mkDerivation (finalAttrs: {
      update-source-version rocsparse "$repoVersion" --ignore-same-hash --version-key=repoVersion
      update-source-version rocsparse "$rocmVersion" --ignore-same-hash --version-key=rocmVersion
    '';
  };

  meta = with lib; {
    description = "ROCm SPARSE implementation";