2017-12-14 13 views
0

PyCudaコードを実行しています。グラフィックカードのプロパティ(ワープのサイズ、ブロックあたりの最大スレッド数など)を取得したいと思います。PyCudaでデバイスのプロパティ(warp_sizeなど)を取得できません。

だから私は、このページに行ってきました:https://documen.tician.de/pycuda/driver.html

をそして、私はこの見た:その後、私は自分のコードに次のように書いた

enter image description here

を:

import time 
import numpy as np 
from pycuda import driver, compiler, gpuarray, tools 
import math 

# -- initialize the device 
import pycuda.autoinit 

print(pycuda.driver.device_attribute.WARP_SIZE) 

しかし、プリント戻り:WARP_SIZE

Inde彼はワープサイズを表す整数ではなく "WARP_SIZE"を含むstrを返します。

私は間違っていますか?

答えて

1

印刷するものは、その属性を取得するためにデバイスインターフェイスに渡す必要がある列挙です。

import time 
import numpy as np 
from pycuda import driver, compiler, gpuarray, tools 
import math 


# -- initialize the device 
import pycuda.autoinit 

dev = pycuda.autoinit.device 
print(dev.get_attribute(pycuda.driver.device_attribute.WARP_SIZE)) 
print(dev.get_attribute(pycuda.driver.device_attribute.MAX_BLOCK_DIM_X)) 

この処理を行います:あなたはこのような何かしたい

$ python device_attr.py 
32 
1024 
関連する問題