summary refs log tree commit diff
path: root/pkgs/development/python-modules/devito/default.nix
blob: be3358cf887bfe2ac922f2dd9a5aad7b8b770273 (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchFromGitHub
, anytree
, nbval
, sympy
, scipy
, cached-property
, psutil
, py-cpuinfo
, cgen
, click
, multidict
, distributed
, pyrevolve
, codepy
, pytestCheckHook
, matplotlib
, pytest-xdist
}:

buildPythonPackage rec {
  pname = "devito";
  version = "unstable-2022-04-22";

  src = fetchFromGitHub {
    owner = "devitocodes";
    repo = "devito";
    rev = "7cb52eded4038c1a0ee92cfd04d3412c48f2fb7c";
    sha256 = "sha256-75hkkufQK9Nv65DBz8cmYTfkxH/UUWDQK/rGUDULvjM=";
  };

  postPatch = ''
    # Removing unecessary dependencies
    sed -e "s/flake8.*//g" \
        -e "s/codecov.*//g" \
        -e "s/pytest.*//g" \
        -e "s/pytest-runner.*//g" \
        -e "s/pytest-cov.*//g" \
        -i requirements.txt

    # Relaxing dependencies requirements
    sed -e "s/>.*//g" \
        -e "s/<.*//g" \
        -i requirements.txt
  '';

  checkInputs = [ pytestCheckHook pytest-xdist matplotlib ];

  # I've had to disable the following tests since they fail while using nix-build, but they do pass
  # outside the build. They mostly related to the usage of MPI in a sandboxed environment.
  disabledTests = [
    "test_assign_parallel"
    "test_gs_parallel"
    "test_if_parallel"
    "test_if_halo_mpi"
    "test_cache_blocking_structure_distributed"
    "test_mpi"
    "test_codegen_quality0"
    "test_new_distributor"
    "test_subdomainset_mpi"
    "test_init_omp_env_w_mpi"
    "test_mpi_nocomms"
  ];

  disabledTestPaths = [
    "tests/test_pickle.py"
    "tests/test_benchmark.py"
    "tests/test_mpi.py"
    "tests/test_autotuner.py"
    "tests/test_data.py"
    "tests/test_dse.py"
    "tests/test_gradient.py"
  ];

  propagatedBuildInputs = [
    anytree
    cached-property
    cgen
    click
    codepy
    distributed
    nbval
    multidict
    psutil
    py-cpuinfo
    pyrevolve
    scipy
    sympy
  ];

  pythonImportsCheck = [ "devito" ];

  meta = with lib; {
    homepage = "https://www.devitoproject.org/";
    description = "Code generation framework for automated finite difference computation";
    license = licenses.mit;
    maintainers = with maintainers; [ atila ];
  };
}