diff --git a/katrain/KataGo/analysis_config.cfg b/katrain/KataGo/analysis_config.cfg index 16bb3ee..47c7320 100644 --- a/katrain/KataGo/analysis_config.cfg +++ b/katrain/KataGo/analysis_config.cfg @@ -80,15 +80,23 @@ maxVisits = 500 # But there's no substitute for experimenting and seeing what's best for your hardware and your usage case. # Keep in mind that the number of threads you want doesn't necessarily have much to do with how many cores you # have on your system, and could easily exceed the number of cores. GPU batching is (usually) the dominant consideration. +numAnalysisThreads = 8 +numSearchThreadsPerAnalysisThread = 8 numSearchThreads = 8 - # nnMaxBatchSize is the max number of positions to send to a single GPU at once. Generally, it should be the case that: # (number of GPUs you will use * nnMaxBatchSize) >= (numSearchThreads * num-analysis-threads) # That way, when each threads tries to request a GPU eval, your batch size summed across GPUs is large enough to handle them # all at once. However, it can be sensible to set this a little smaller if you are limited on GPU memory, # too large a number may fail if the GPU doesn't have enough memory. -nnMaxBatchSize = 96 +nnMaxBatchSize = 64 + +# Eigen-specific settings-------------------------------------- +# These only apply when using the Eigen (pure CPU) version of KataGo. + +# This is the number of CPU threads for evaluating the neural net on the Eigen backend. +# It defaults to min(numAnalysisThreads * numSearchThreadsPerAnalysisThread, numCPUCores). +# numEigenThreadsPerModel = X # Uncomment and set these smaller if you ONLY are going to use the analysis engine for smaller boards (or plan to # run multiple instances, with some instances only handling smaller boards). It should improve performance. @@ -104,7 +112,7 @@ nnMaxBatchSize = 96 # Other General GPU Settings------------------------------------------------------------------------------- # Cache up to 2 ** this many neural net evaluations in case of transpositions in the tree. -nnCacheSizePowerOfTwo = 19 +nnCacheSizePowerOfTwo = 20 # Size of mutex pool for nnCache is 2 ** this nnMutexPoolSizePowerOfTwo = 16 # Randomize board orientation when running neural net evals? diff --git a/katrain/KataGo/katago b/katrain/KataGo/katago index d582034..99298c0 100755 Binary files a/katrain/KataGo/katago and b/katrain/KataGo/katago differ diff --git a/katrain/gui/badukpan.py b/katrain/gui/badukpan.py index ce6b424..5f9214e 100644 --- a/katrain/gui/badukpan.py +++ b/katrain/gui/badukpan.py @@ -10,7 +10,7 @@ from kivy.core.window import Window from kivy.graphics.context_instructions import Color from kivy.graphics.vertex_instructions import Ellipse, Line, Rectangle from kivy.metrics import dp -from kivy.properties import BooleanProperty, ListProperty, ObjectProperty, NumericProperty +from kivy.properties import BooleanProperty, ListProperty, NumericProperty, ObjectProperty from kivy.uix.dropdown import DropDown from kivy.uix.widget import Widget from kivymd.app import MDApp @@ -308,26 +308,36 @@ class BadukPanWidget(Widget): # ownership - allow one move out of date for smooth animation ownership = current_node.ownership or (current_node.parent and current_node.parent.ownership) if katrain.analysis_controls.ownership.active and ownership: - ownership_grid = var_to_grid(ownership, (board_size_x, board_size_y)) + rsz = self.grid_size * 0.2 if ( current_node.children and katrain.controls.status_state[1] == STATUS_TEACHING - and self.animating_pv and current_node.children[-1].auto_undo and current_node.children[-1].ownership - ): - ownership_grid = var_to_grid( + ): # loss + loss_grid = var_to_grid( [a - b for a, b in zip(current_node.children[-1].ownership, ownership)], (board_size_x, board_size_y), ) - rsz = self.grid_size * 0.2 - for y in range(board_size_y - 1, -1, -1): - for x in range(board_size_x): - ix_owner = "B" if ownership_grid[y][x] > 0 else "W" - if ix_owner != (has_stone.get((x, y), -1)): - Color(*STONE_COLORS[ix_owner][:3], abs(ownership_grid[y][x])) - Rectangle(pos=(self.gridpos_x[x] - rsz / 2, self.gridpos_y[y] - rsz / 2), size=(rsz, rsz)) + for y in range(board_size_y - 1, -1, -1): + for x in range(board_size_x): + loss = max(0, (-1 if current_node.children[-1].move.player == "B" else 1) * loss_grid[y][x]) + if loss > 0: + Color(*EVAL_COLORS[self.trainer_config["theme"]][1][:3], loss) + Rectangle( + pos=(self.gridpos_x[x] - rsz / 2, self.gridpos_y[y] - rsz / 2), size=(rsz, rsz) + ) + else: + ownership_grid = var_to_grid(ownership, (board_size_x, board_size_y)) + for y in range(board_size_y - 1, -1, -1): + for x in range(board_size_x): + ix_owner = "B" if ownership_grid[y][x] > 0 else "W" + if ix_owner != (has_stone.get((x, y), -1)): + Color(*STONE_COLORS[ix_owner][:3], abs(ownership_grid[y][x])) + Rectangle( + pos=(self.gridpos_x[x] - rsz / 2, self.gridpos_y[y] - rsz / 2), size=(rsz, rsz) + ) policy = current_node.policy if ( @@ -531,8 +541,8 @@ class BadukPanWidget(Widget): ): self.animating_pv = (pv, node, time.time(), self.last_mouse_pos) - if self.katrain.controls.status_state[1] == STATUS_TEACHING: - self.draw_board_contents() + if self.katrain.controls.status_state[1] == STATUS_TEACHING and self.katrain.analysis_controls.ownership.active: + self.draw_board_contents() # loss visualization else: self.draw_hover_contents() diff --git a/katrain/gui/popups.py b/katrain/gui/popups.py index 4b14aad..767963a 100644 --- a/katrain/gui/popups.py +++ b/katrain/gui/popups.py @@ -445,17 +445,19 @@ class ConfigPopup(QuickConfigGui): KATAGOS = { "win": { - "Official OpenCL v1.6.0": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-gpu-opencl-windows-x64.zip", - "Official OpenCL v1.6.0 (32 bit)": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-gpu-opencl-windows-x32-dont-use-unless-actually-32bit-windows.zip", - "Official CUDA v1.6.0 (New NVIDIA cards)": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-gpu-cuda10.2-windows-x64.zip", - "Eigen AVX2 (Modern CPUs) v1.6.0": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-cpu-eigen-avx2-windows-x64.zip", - "Eigen (CPU, Non-optimized) v1.6.0": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-cpu-eigen-windows-x64.zip", + "OpenCL v1.6.1": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-gpu-opencl-windows-x64.zip", + "OpenCL v1.6.1 (32 bit)": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-gpu-opencl-windows-x32-dont-use-unless-actually-32bit-windows.zip", + "CUDA v1.6.1 (New NVIDIA cards)": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-gpu-cuda10.2-windows-x64.zip", + "Eigen AVX2 (Modern CPUs) v1.6.1": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-cpu-eigen-avx2-windows-x64.zip", + "Eigen (CPU, Non-optimized) v1.6.1": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-cpu-eigen-windows-x64.zip", + "OpenCL v1.6.1 (bigger boards)": "https://github.com/lightvector/KataGo/releases/download/v1.6.1%2Bbs29/katago-v1.6.1+bs29-gpu-opencl-windows-x64.zip", }, "linux": { - "Official OpenCL v1.6.0": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-gpu-opencl-linux-x64.zip", - "Official CUDA v1.6.0 (New NVIDIA cards)": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-gpu-cuda10.2-linux-x64.zip", - "Eigen AVX2 (Modern CPUs) v1.6.0": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-cpu-eigen-avx2-linux-x64.zip", - "Eigen (CPU, Non-optimized) v1.6.0": "https://github.com/lightvector/KataGo/releases/download/v1.6.0/katago-v1.6.0-cpu-eigen-linux-x64.zip", + "OpenCL v1.6.1": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-gpu-opencl-linux-x64.zip", + "CUDA v1.6.1 (New NVIDIA cards)": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-gpu-cuda10.2-linux-x64.zip", + "Eigen AVX2 (Modern CPUs) v1.6.1": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-cpu-eigen-avx2-linux-x64.zip", + "Eigen (CPU, Non-optimized) v1.6.1": "https://github.com/lightvector/KataGo/releases/download/v1.6.1/katago-v1.6.1-cpu-eigen-linux-x64.zip", + "OpenCL v1.6.1 (bigger boards)": "https://github.com/lightvector/KataGo/releases/download/v1.6.1%2Bbs29/katago-v1.6.1+bs29-gpu-opencl-linux-x64.zip", }, } @@ -525,6 +527,7 @@ class ConfigPopup(QuickConfigGui): if f.lower().endswith("dll"): with open(os.path.join(os.path.split(path)[0], f), "wb") as fout: fout.write(zipObj.read(f)) + os.remove(tmp_path) else: os.rename(tmp_path, path) self.katrain.log(f"Download of katago binary {binary} model complete -> {path}", OUTPUT_INFO)