1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, anytree
6, nbval
7, sympy
8, scipy
9, cached-property
10, psutil
11, py-cpuinfo
12, cgen
13, click
14, multidict
15, distributed
16, pyrevolve
17, codepy
18, pytestCheckHook
19, matplotlib
20, pytest-xdist
21, gcc
22, llvmPackages
23}:
24
25buildPythonPackage rec {
26 pname = "devito";
27 version = "4.7.1";
28
29 src = fetchFromGitHub {
30 owner = "devitocodes";
31 repo = "devito";
32 rev = "v${version}";
33 sha256 = "sha256-crKTxlueE8NGjAqu625iFvp35UK2U7+9kl8rpbzf0gs=";
34 };
35
36 postPatch = ''
37 # Removing unecessary dependencies
38 sed -e "s/flake8.*//g" \
39 -e "s/codecov.*//g" \
40 -e "s/pytest.*//g" \
41 -e "s/pytest-runner.*//g" \
42 -e "s/pytest-cov.*//g" \
43 -i requirements.txt
44
45 # Relaxing dependencies requirements
46 sed -e "s/>.*//g" \
47 -e "s/<.*//g" \
48 -i requirements.txt
49 '';
50
51 checkInputs = [ pytestCheckHook pytest-xdist matplotlib gcc ];
52
53 # I've had to disable the following tests since they fail while using nix-build, but they do pass
54 # outside the build. They mostly related to the usage of MPI in a sandboxed environment.
55 disabledTests = [
56 "test_assign_parallel"
57 "test_gs_parallel"
58 "test_if_parallel"
59 "test_if_halo_mpi"
60 "test_cache_blocking_structure_distributed"
61 "test_mpi"
62 "test_codegen_quality0"
63 "test_new_distributor"
64 "test_subdomainset_mpi"
65 "test_init_omp_env_w_mpi"
66 "test_mpi_nocomms"
67 ];
68
69 disabledTestPaths = [
70 "tests/test_pickle.py"
71 "tests/test_benchmark.py"
72 "tests/test_mpi.py"
73 "tests/test_autotuner.py"
74 "tests/test_data.py"
75 "tests/test_dse.py"
76 "tests/test_gradient.py"
77 ];
78
79 propagatedBuildInputs = [
80 anytree
81 cached-property
82 cgen
83 click
84 codepy
85 distributed
86 nbval
87 multidict
88 psutil
89 py-cpuinfo
90 pyrevolve
91 scipy
92 sympy
93 ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
94
95 pythonImportsCheck = [ "devito" ];
96
97 meta = with lib; {
98 homepage = "https://www.devitoproject.org/";
99 description = "Code generation framework for automated finite difference computation";
100 license = licenses.mit;
101 maintainers = with maintainers; [ atila ];
102 };
103}