diff options
Diffstat (limited to 'nixpkgs/pkgs/games/katago/default.nix')
-rw-r--r-- | nixpkgs/pkgs/games/katago/default.nix | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/nixpkgs/pkgs/games/katago/default.nix b/nixpkgs/pkgs/games/katago/default.nix index 0a9ebd9e3eb..20ad47d3e0a 100644 --- a/nixpkgs/pkgs/games/katago/default.nix +++ b/nixpkgs/pkgs/games/katago/default.nix @@ -13,52 +13,46 @@ , opencl-headers ? null , ocl-icd ? null , gperftools ? null -, cudaSupport ? false -, useTcmalloc ? true}: +, eigen ? null +, enableAVX2 ? false +, enableBigBoards ? false +, enableCuda ? false +, enableGPU ? true +, enableTcmalloc ? true}: -assert cudaSupport -> ( - libGL_driver != null && +assert !enableGPU -> ( + eigen != null && + !enableCuda); + +assert enableCuda -> ( + libGL_driver != null && cudatoolkit != null && cudnn != null); -assert !cudaSupport -> ( - opencl-headers != null && - ocl-icd != null); +assert !enableCuda -> ( + !enableGPU || ( + opencl-headers != null && + ocl-icd != null)); -assert useTcmalloc -> ( +assert enableTcmalloc -> ( gperftools != null); let - env = if cudaSupport + env = if enableCuda then gcc8Stdenv else stdenv; in env.mkDerivation rec { pname = "katago"; - version = "1.4.2"; + version = "1.6.1"; src = fetchFromGitHub { owner = "lightvector"; repo = "katago"; rev = "v${version}"; - sha256 = "0qdc9hgbzd175b2xkjs62dy6gyybcn9lf1mifiyhjbzjpgv192h4"; + sha256 = "030ff9prnvpadgcb4x4hx6b6ggg10bwqcj8vd8nwrdz9sjq67yf7"; }; - # To workaround CMake 3.17.0's new buggy behavior wrt CUDA Compiler testing - # See the following tracking issues: - # KataGo: - # - Issue #225: https://github.com/lightvector/KataGo/issues/225 - # - PR #227: https://github.com/lightvector/KataGo/pull/227 - # CMake: - # - Issue #20708: https://gitlab.kitware.com/cmake/cmake/-/issues/20708 - patches = [ - (fetchpatch { - name = "227.patch"; - url = "https://patch-diff.githubusercontent.com/raw/lightvector/KataGo/pull/227.patch"; - sha256 = "03f1vmdjhb79mpj95sijcwla8acy32clrjgrn4xqw5h90zdgj511"; - }) - ]; - nativeBuildInputs = [ cmake makeWrapper @@ -67,36 +61,44 @@ in env.mkDerivation rec { buildInputs = [ libzip boost - ] ++ lib.optionals cudaSupport [ + ] ++ lib.optionals (!enableGPU) [ + eigen + ] ++ lib.optionals (enableGPU && enableCuda) [ cudnn libGL_driver - ] ++ lib.optionals (!cudaSupport) [ + ] ++ lib.optionals (enableGPU && !enableCuda) [ opencl-headers ocl-icd - ] ++ lib.optionals useTcmalloc [ + ] ++ lib.optionals enableTcmalloc [ gperftools ]; cmakeFlags = [ "-DNO_GIT_REVISION=ON" - ] ++ lib.optionals cudaSupport [ + ] ++ lib.optionals (!enableGPU) [ + "-DUSE_BACKEND=EIGEN" + ] ++ lib.optionals enableAVX2 [ + "-DUSE_AVX2=ON" + ] ++ lib.optionals (enableGPU && enableCuda) [ "-DUSE_BACKEND=CUDA" - ] ++ lib.optionals (!cudaSupport) [ + ] ++ lib.optionals (enableGPU && !enableCuda) [ "-DUSE_BACKEND=OPENCL" - ] ++ lib.optionals useTcmalloc [ + ] ++ lib.optionals enableTcmalloc [ "-DUSE_TCMALLOC=ON" + ] ++ lib.optionals enableBigBoards [ + "-DUSE_BIGGER_BOARDS_EXPENSIVE=ON" ]; preConfigure = '' cd cpp/ - '' + lib.optionalString cudaSupport '' + '' + lib.optionalString enableCuda '' export CUDA_PATH="${cudatoolkit}" export EXTRA_LDFLAGS="-L/run/opengl-driver/lib" ''; installPhase = '' mkdir -p $out/bin; cp katago $out/bin; - '' + lib.optionalString cudaSupport '' + '' + lib.optionalString enableCuda '' wrapProgram $out/bin/katago \ --prefix LD_LIBRARY_PATH : "/run/opengl-driver/lib" ''; |