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