0
0

More than 1 year has passed since last update.

Cypy のFFTでOut of memory errorになる件はcacheが原因だった

Posted at

環境

Winpython
WPy64-31040

現象

CupyでFFTを使用すると、del で変数を消してメモリーを確保したはずなのにメモリーエラーが発生する。

原因

chacheが残っているためだった。
https://docs.cupy.dev/en/stable/user_guide/fft.html

解決方法

キャッシュの確認

import cupy as cp

cache = cp.fft.config.get_plan_cache()
cache.show_info()
------------------- cuFFT plan cache (device 0) -------------------
cache enabled? True
current / max size : 1 / 16 (counts)
current / max memsize: 8564793344 / (unlimited) (bytes)
hits / misses: 0 / 1 (counts)

cached plans (most recently used first):
key: ((1023, 1023, 1023), (1023, 1023, 1023), 1, 1, (1023, 1023, 1023), 1, 1, 41, 1, 'C', 2, None), plan type: PlanNd, memory usage: 8564793344

chached plans になにやら残っている

キャッシュの削除

cache.clear()

cache = cp.fft.config.get_plan_cache()
cache.show_info()
------------------- cuFFT plan cache (device 0) -------------------
cache enabled? True
current / max size : 0 / 16 (counts)
current / max memsize: 0 / (unlimited) (bytes)
hits / misses: 0 / 0 (counts)

cached plans (most recently used first):

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