Unverified Commit ef032ddd authored by Stas Bekman's avatar Stas Bekman Committed by GitHub
Browse files

[docs] [testing] gpu decorators table (#8422)



* gpu decorators table

* whitespace

* Update docs/source/testing.rst
Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>

* whitespace
Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
parent a8339b9e
...@@ -409,6 +409,22 @@ decorators are used to set the requirements of tests CPU/GPU/TPU-wise: ...@@ -409,6 +409,22 @@ decorators are used to set the requirements of tests CPU/GPU/TPU-wise:
* ``require_torch_non_multigpu`` - as ``require_torch`` plus requires 0 or 1 GPUs * ``require_torch_non_multigpu`` - as ``require_torch`` plus requires 0 or 1 GPUs
* ``require_torch_tpu`` - as ``require_torch`` plus requires at least 1 TPU * ``require_torch_tpu`` - as ``require_torch`` plus requires at least 1 TPU
Let's depict the GPU requirements in the following table:
+----------+---------------------------------+
| n gpus | decorator |
+==========+=================================+
| ``>= 0`` | ``@require_torch`` |
+----------+---------------------------------+
| ``>= 1`` | ``@require_torch_gpu`` |
+----------+---------------------------------+
| ``>= 2`` | ``@require_torch_multigpu`` |
+----------+---------------------------------+
| ``< 2`` | ``@require_torch_non_multigpu`` |
+----------+---------------------------------+
For example, here is a test that must be run only when there are 2 or more GPUs available and pytorch is installed: For example, here is a test that must be run only when there are 2 or more GPUs available and pytorch is installed:
.. code-block:: python .. code-block:: python
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment