1{
2 lib,
3 stdenv,
4 anytree,
5 buildPythonPackage,
6 setuptools,
7 cached-property,
8 cgen,
9 click,
10 codepy,
11 distributed,
12 fetchFromGitHub,
13 gcc,
14 llvmPackages,
15 matplotlib,
16 multidict,
17 nbval,
18 psutil,
19 py-cpuinfo,
20 pytest-xdist,
21 pytestCheckHook,
22 pythonOlder,
23 scipy,
24 sympy,
25}:
26
27buildPythonPackage rec {
28 pname = "devito";
29 version = "4.8.11";
30 pyproject = true;
31
32 disabled = pythonOlder "3.8";
33
34 src = fetchFromGitHub {
35 owner = "devitocodes";
36 repo = "devito";
37 rev = "refs/tags/v${version}";
38 hash = "sha256-c8/b2dRwfH4naSVRaRon6/mBDva7RSDmi/TJUJp26g0=";
39 };
40
41 # packaging.metadata.InvalidMetadata: 'python_version_3.8_' is invalid for 'provides-extra'
42 postPatch = ''
43 substituteInPlace requirements-testing.txt \
44 --replace-fail 'pooch; python_version >= "3.8"' "pooch"
45 '';
46
47 pythonRemoveDeps = [ "pip" ];
48
49 pythonRelaxDeps = true;
50
51 build-system = [ setuptools ];
52
53 dependencies = [
54 anytree
55 cached-property
56 cgen
57 click
58 codepy
59 distributed
60 nbval
61 multidict
62 psutil
63 py-cpuinfo
64 scipy
65 sympy
66 ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
67
68 nativeCheckInputs = [
69 gcc
70 matplotlib
71 pytest-xdist
72 pytestCheckHook
73 ];
74
75 pytestFlagsArray = [ "-x" ];
76
77 # I've had to disable the following tests since they fail while using nix-build, but they do pass
78 # outside the build. They mostly related to the usage of MPI in a sandboxed environment.
79 disabledTests =
80 [
81 "test_assign_parallel"
82 "test_cache_blocking_structure_distributed"
83 "test_codegen_quality0"
84 "test_coefficients_w_xreplace"
85 "test_docstrings"
86 "test_docstrings[finite_differences.coefficients]"
87 "test_gs_parallel"
88 "test_if_halo_mpi"
89 "test_if_parallel"
90 "test_index_derivative"
91 "test_init_omp_env_w_mpi"
92 "test_loop_bounds_forward"
93 "test_min_max_mpi"
94 "test_mpi"
95 "test_mpi_nocomms"
96 "test_new_distributor"
97 "test_setupWOverQ"
98 "test_shortcuts"
99 "test_stability_mpi"
100 "test_subdomainset_mpi"
101 "test_subdomains_mpi"
102 ]
103 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
104 # FAILED tests/test_unexpansion.py::Test2Pass::test_v0 - assert False
105 "test_v0"
106 ]
107 ++ lib.optionals stdenv.hostPlatform.isDarwin [
108 # FAILED tests/test_caching.py::TestCaching::test_special_symbols - ValueError: not enough values to unpack (expected 3, got 2)
109 "test_special_symbols"
110
111 # FAILED tests/test_unexpansion.py::Test2Pass::test_v0 - codepy.CompileError: module compilation failed
112 "test_v0"
113 ]
114 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
115 # Numerical tests
116 "test_lm_fb"
117 "test_lm_ds"
118 ];
119
120 disabledTestPaths =
121 [
122 "tests/test_pickle.py"
123 "tests/test_benchmark.py"
124 "tests/test_mpi.py"
125 "tests/test_autotuner.py"
126 "tests/test_data.py"
127 "tests/test_dse.py"
128 "tests/test_gradient.py"
129 ]
130 ++ lib.optionals (
131 (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isDarwin
132 ) [ "tests/test_dle.py" ];
133
134 pythonImportsCheck = [ "devito" ];
135
136 meta = {
137 description = "Code generation framework for automated finite difference computation";
138 homepage = "https://www.devitoproject.org/";
139 changelog = "https://github.com/devitocodes/devito/releases/tag/v${version}";
140 license = lib.licenses.mit;
141 maintainers = with lib.maintainers; [ atila ];
142 };
143}