attr.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:cupy 作者: cupy 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号