Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 97 lines 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildPythonPackage, 6 7 # build-system 8 cmake, 9 nanobind, 10 ninja, 11 numpy, 12 scikit-build-core, 13 14 # buildInputs 15 opencl-headers, 16 pybind11, 17 darwin, 18 ocl-icd, 19 20 # dependencies 21 platformdirs, 22 pytools, 23 24 # tests 25 pytestCheckHook, 26}: 27 28let 29 os-specific-buildInputs = 30 if stdenv.hostPlatform.isDarwin then [ darwin.apple_sdk.frameworks.OpenCL ] else [ ocl-icd ]; 31in 32buildPythonPackage rec { 33 pname = "pyopencl"; 34 version = "2024.3"; 35 pyproject = true; 36 37 src = fetchFromGitHub { 38 owner = "inducer"; 39 repo = "pyopencl"; 40 rev = "refs/tags/v${version}"; 41 fetchSubmodules = true; 42 hash = "sha256-HE7dARgKnZxqjAXX4iI1ml0N2BalyTo+ZAzjC2ThEN8="; 43 }; 44 45 build-system = [ 46 cmake 47 nanobind 48 ninja 49 numpy 50 scikit-build-core 51 ]; 52 53 dontUseCmakeConfigure = true; 54 55 buildInputs = [ 56 opencl-headers 57 pybind11 58 ] ++ os-specific-buildInputs; 59 60 dependencies = [ 61 numpy 62 platformdirs 63 pytools 64 ]; 65 66 nativeCheckInputs = [ pytestCheckHook ]; 67 68 preCheck = '' 69 export HOME=$(mktemp -d) 70 71 # https://github.com/NixOS/nixpkgs/issues/255262 72 cd $out 73 ''; 74 75 # https://github.com/inducer/pyopencl/issues/784 Note that these failing 76 # tests are all the tests that are available. 77 doCheck = false; 78 79 pythonImportsCheck = [ 80 "pyopencl" 81 "pyopencl.array" 82 "pyopencl.cltypes" 83 "pyopencl.compyte" 84 "pyopencl.elementwise" 85 "pyopencl.tools" 86 ]; 87 88 meta = { 89 description = "Python wrapper for OpenCL"; 90 homepage = "https://github.com/pyopencl/pyopencl"; 91 changelog = "https://github.com/inducer/pyopencl/releases/tag/v${version}"; 92 license = lib.licenses.mit; 93 maintainers = with lib.maintainers; [ GaetanLepage ]; 94 # ld: symbol(s) not found for architecture arm64 95 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; 96 }; 97}