0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

QuPathにおけるGPUの利用について

0
Posted at

はじめに

病理画像解析にいまや欠かせなくなったQuPathは、v0.4よりGPUのサポートも組み込むようになりました。GPUが活躍するのは、QuPathの開発チームが発表した、核分節ツールのInstanSegを使うときや、「リンパ球・腫瘍」などの分類モデルをWSIで適用したWSInferを使うときなどでしょうか。GPUを利用すれば待ち時間が少なく、解析結果をすぐ確認できるという点が有利です。QuPathのtutorialページの"GPU support"で詳細に導入方法を記載してくれています。しかし、この通りにしても上手く行かなかったので、ここに記載しておきます。

実行環境

  • OS: Ubuntu 24.04.4 LTS
  • Kernel: 6.17.0-22-generic
  • Python: Python 3.13.5
  • Conda: conda 25.5.1
  • GPU: NVIDIA RTX A4000
  • CUDA: Cuda compilation tools, release 12.0, V12.0.140

手順

ローカルの実行環境ではcudaがv12.0となっていて、deep java library(DJL)との互換表ではQuPathのv0.6以降が使えません。しかし、tutorialでは「conda環境を作れば良い」とあり、これはその通りなのですが、問題はpytorchを丸ごとインストールするようコマンドが記載されていることです("At this point, you really only need to install CUDA and cuDNN – but to make things easier, we’ll install PyTorch entirely...This increases the chances we end up with a working combination")。

しかし、tutorialページに記載のコードを実行しても、pytorchとcudaを一緒にインストールしても、cudaのversionが互換表のversionのもの以下のものがインストールされてしまいました。

conda install pytorch==2.5.1 torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia

これはあくまでpytorch-cudaのversionが12.4であり、cudaのversionは12.4ではないからです。結局、cudaのversionのみが問題なので、以下のようなcuda環境のみを作れば良いことがわかりました。

#cuda12.4を導入する場合
conda create -n cuda124 python=3.11
conda activate cuda124
conda install -c nvidia cuda=12.4

若干DJLの挙動が不安定であり、もしかしたら最初のコマンドで上手く行くのかもしれませんが、詰まった場合に参考になれば幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?