Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 _cuda, 3 cudaNamePrefix, 4 lib, 5 runCommand, 6}: 7let 8 inherit (builtins) deepSeq toJSON tryEval; 9 inherit (_cuda.bootstrapData) cudaCapabilityToInfo; 10 inherit (_cuda.lib) formatCapabilities; 11 inherit (lib.asserts) assertMsg; 12in 13# When changing names or formats: pause, validate, and update the assert 14assert assertMsg ( 15 cudaCapabilityToInfo ? "7.5" && cudaCapabilityToInfo ? "8.6" 16) "The following test requires both 7.5 and 8.6 be known CUDA capabilities"; 17assert 18 let 19 expected = { 20 cudaCapabilities = [ 21 "7.5" 22 "8.6" 23 ]; 24 cudaForwardCompat = true; 25 26 # Sorted alphabetically 27 archNames = [ 28 "Ampere" 29 "Turing" 30 ]; 31 32 realArches = [ 33 "sm_75" 34 "sm_86" 35 ]; 36 37 virtualArches = [ 38 "compute_75" 39 "compute_86" 40 ]; 41 42 arches = [ 43 "sm_75" 44 "sm_86" 45 "compute_86" 46 ]; 47 48 gencode = [ 49 "-gencode=arch=compute_75,code=sm_75" 50 "-gencode=arch=compute_86,code=sm_86" 51 "-gencode=arch=compute_86,code=compute_86" 52 ]; 53 54 gencodeString = "-gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_86,code=compute_86"; 55 56 cmakeCudaArchitecturesString = "75;86"; 57 }; 58 actual = formatCapabilities { 59 inherit cudaCapabilityToInfo; 60 cudaCapabilities = [ 61 "7.5" 62 "8.6" 63 ]; 64 cudaForwardCompat = true; 65 }; 66 actualWrapped = (tryEval (deepSeq actual actual)).value; 67 in 68 assertMsg (expected == actualWrapped) '' 69 Expected: ${toJSON expected} 70 Actual: ${toJSON actualWrapped} 71 ''; 72runCommand "${cudaNamePrefix}-tests-flags" 73 { 74 __structuredAttrs = true; 75 strictDeps = true; 76 } 77 '' 78 touch "$out" 79 ''