U
    da                     @   sV   d dl Z d dlZd dlmZmZ e ej dG dd de jZe	dkrRe 
  dS )    N)core	workspacez7THC pool testing is obscure and doesn't work on HIP yetc                   @   s   e Zd Zdd ZdS )TestGPUInitc                 C   sf   t jr
dnd}d|}td|g t tjdg dgddgdtt jd	 | 	t
j d
 d S )NZhipcudaz--caffe2_{}_memory_pool=thcZcaffe2ZConstantFillx   g      ?)shapevalueZdevice_optionr   )r   Zhas_hip_supportformatr   Z
GlobalInitZRunOperatorOnceZCreateOperatorZDeviceOptionZGpuDeviceTypeZassertGreatertorchr   Zmemory_allocated)selfZcuda_or_hipflag r   G/tmp/pip-unpacked-wheel-ua33x9lu/caffe2/python/test/gpu_context_test.pytestTHCAllocator   s    
    
zTestGPUInit.testTHCAllocatorN)__name__
__module____qualname__r   r   r   r   r   r      s   r   __main__)Zunittestr   Zcaffe2.pythonr   r   ZskipIfZhas_cuda_supportZTestCaser   r   mainr   r   r   r   <module>   s   
