def multi_gpu(gpu_num):
"""Decorator to indicate number of GPUs required to run the test.
Tests can be annotated with this decorator (e.g., ``@multi_gpu(2)``) to
declare number of GPUs required to run. When running tests, if
``CUPY_TEST_GPU_LIMIT`` environment variable is set to value greater
than or equals to 0, test cases that require GPUs more than the limit will
be skipped.
"""
check_available()
return unittest.skipIf(
0 <= _gpu_limit and _gpu_limit < gpu_num,
reason='{} GPUs required'.format(gpu_num))
评论列表
文章目录