2017-12-14 12 views
0

PyCuda 코드를 수행하고 있는데 그래픽 카드의 속성 (워프 크기, 블록 당 최대 스레드 수 등)을 얻고 싶습니다. PyCuda의 장치 속성 (워프 크기 등) 얻기가 작동하지 않습니다.

그래서 나는이 페이지에 갔다 : 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 ed는 워프 크기를 나타내는 정수가 아닌 "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 
을 당신이 뭔가를 원하는