summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/devito/default.nix
blob: 9421cb355a0c47c4d32a503bf74919f93ad7f71f (plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,
  setuptools-scm,

  # dependencies
  anytree,
  cgen,
  cloudpickle,
  codepy,
  llvmPackages,
  multidict,
  numpy,
  packaging,
  psutil,
  py-cpuinfo,
  sympy,

  # tests
  click,
  gcc,
  matplotlib,
  pytest-xdist,
  pytestCheckHook,
  scipy,
}:

buildPythonPackage rec {
  pname = "devito";
  version = "4.8.19";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "devitocodes";
    repo = "devito";
    tag = "v${version}";
    hash = "sha256-kE4u5r2GFe4Y+IdSEnNZEOAO9WoSIM00Ify1eLaflWI=";
  };

  pythonRemoveDeps = [ "pip" ];

  pythonRelaxDeps = true;

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    anytree
    cgen
    cloudpickle
    codepy
    multidict
    numpy
    packaging
    psutil
    py-cpuinfo
    sympy
  ]
  ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];

  nativeCheckInputs = [
    click
    gcc
    matplotlib
    pytest-xdist
    pytestCheckHook
    scipy
  ];

  pytestFlags = [
    "-x"
  ];

  disabledTestMarks = [
    # Tests marked as 'parallel' require mpi and fail in the sandbox:
    # FileNotFoundError: [Errno 2] No such file or directory: 'mpiexec'
    "parallel"
  ];

  disabledTests = [
    # Download dataset from the internet
    "test_gs_2d_float"
    "test_gs_2d_int"
  ]
  ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
    # FAILED tests/test_unexpansion.py::Test2Pass::test_v0 - assert False
    "test_v0"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # FAILED tests/test_caching.py::TestCaching::test_special_symbols - ValueError: not enough values to unpack (expected 3, got 2)
    "test_special_symbols"

    # FAILED tests/test_unexpansion.py::Test2Pass::test_v0 - codepy.CompileError: module compilation failed
    "test_v0"

    # AssertionError: assert(np.allclose(grad_u.data, grad_v.data, rtol=tolerance, atol=tolerance))
    "test_gradient_equivalence"
  ]
  ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
    # Numerical tests
    "test_lm_fb"
    "test_lm_ds"
  ]
  ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
    # Numerical error
    "test_pow_precision"
  ];

  disabledTestPaths =
    lib.optionals
      ((stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isDarwin)
      [
        # Flaky: codepy.CompileError: module compilation failed
        "tests/test_dse.py"
      ]
    ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
      # assert np.all(f.data == check)
      # assert Data(False)
      "tests/test_data.py::TestDataReference::test_w_data"

      # AssertionError: assert 'omp for schedule(dynamic,1)' == 'omp for coll...le(dynamic,1)'
      "tests/test_dle.py::TestNestedParallelism::test_nested_cache_blocking_structure_subdims"

      # codepy.CompileError: module compilation failed
      # FAILED compiler invocation
      "tests/test_dle.py::TestNodeParallelism::test_dynamic_nthreads"

      # AssertionError: assert all(not i.pragmas for i in iters[2:])
      "tests/test_dle.py::TestNodeParallelism::test_incr_perfect_sparse_outer"
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      # IndexError: tuple index out of range
      "tests/test_dle.py::TestNestedParallelism"

      # codepy.CompileError: module compilation failed
      "tests/test_autotuner.py::test_nested_nthreads"

      # assert np.all(np.isclose(f0.data, check0))
      # assert Data(false)
      "tests/test_interpolation.py::TestSubDomainInterpolation::test_inject_subdomain"
    ];

  pythonImportsCheck = [ "devito" ];

  meta = {
    description = "Code generation framework for automated finite difference computation";
    homepage = "https://www.devitoproject.org/";
    changelog = "https://github.com/devitocodes/devito/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ atila ];
  };
}