Body: <p>I am working on a project to import a number of games as a PGN (game = chess.pgn.read_game(pgn)) and then iterate over each game and each move to evaluation the position with stockfish.  Using my computer CPU, it takes about 45 seconds to analyze each game.  I don't know much about running python on GPU but quick google search showed @jit before the evaluation function.  However, when trying to run, I get an error message saying @jit doesn't know the class chess.  Does anyone have any suggestions so I can try to run it on my GPU and speed up the process?  I can provide a .py script showing the exact code if necessary.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-22T11:42:40.873Z
Comments.Text: Stockfish cannot use GPU, see https://github.com/official-stockfish/Stockfish/wiki/Stockfish-FAQ#can-stockfish-use-my-gpu
Comments.UserDisplayName: Matija Sirk
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-25T23:13:02.467Z
Comments.Text: Python JIT compilation won't affect stockfish's perfromance since it's running highly optimized C++ code. Also most chess engines are CPU bound, except for maybe Leela.
Comments.UserDisplayName: qwr
Tags: <analysis>
Title: How to use the GPU with python-chess and chess-engine
ThreadText: # How to use the GPU with python-chess and chess-engine
  
  (Asked by: username_0 on 2024-03-20)
  
  I am working on a project to import a number of games as a PGN (game = chess.pgn.read\_game(pgn)) and then iterate over each game and each move to evaluation the position with stockfish. Using my computer CPU, it takes about 45 seconds to analyze each game. I don't know much about running python on GPU but quick google search showed @jit before the evaluation function. However, when trying to run, I get an error message saying @jit doesn't know the class chess. Does anyone have any suggestions so I can try to run it on my GPU and speed up the process? I can provide a .py script showing the exact code if necessary.
  
  **Tags:** analysis
  
  > **Comments:**
  > **username_1**: Stockfish cannot use GPU, see https://github.com/official-stockfish/Stockfish/wiki/Stockfish-FAQ#can-stockfish-use-my-gpu  
  > **username_2**: Python JIT compilation won't affect stockfish's perfromance since it's running highly optimized C++ code. Also most chess engines are CPU bound, except for maybe Leela.  
  
  ---
  
  ## 0 answers
  
  