Skip to content

Commit

Permalink
[docs] [testing] gpu decorators table (huggingface#8422)
Browse files Browse the repository at this point in the history
* gpu decorators table

* whitespace

* Update docs/source/testing.rst

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>

* whitespace

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
  • Loading branch information
stas00 and LysandreJik committed Nov 10, 2020
1 parent 68536fd commit a542034
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/source/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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_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:

.. code-block:: python
Expand Down

0 comments on commit a542034

Please sign in to comment.