PROCESSES.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. PROCESSES
  2. ----------
  3. Set to specify the number of processes spawned by a test, and the resources
  4. that they require. See :ref:`hardware allocation <ctest-hardware-allocation>`
  5. for more information on how this property integrates into the CTest hardware
  6. allocation feature.
  7. The ``PROCESSES`` property is a :ref:`semicolon-separated list <CMake Language
  8. Lists>` of process descriptions. Each process description consists of an
  9. optional number of processes for the description followed by a series of
  10. resource requirements for those processes. These requirements (and the number
  11. of processes) are separated by commas. The resource requirements consist of the
  12. name of a resource type, followed by a colon, followed by an unsigned integer
  13. specifying the number of slots required on one resource of the given type.
  14. Please note that these processes are not spawned by CTest. The ``PROCESSES``
  15. property merely tells CTest what processes the test expects to launch. It is up
  16. to the test itself to do this process spawning, and read the :ref:`environment
  17. variables <ctest-hardware-environment-variables>` to determine which resources
  18. each process has been allocated.
  19. Consider the following example:
  20. .. code-block:: cmake
  21. add_test(NAME MyTest COMMAND MyExe)
  22. set_property(TEST MyTest PROPERTY PROCESSES
  23. "2,gpus:2"
  24. "gpus:4,crypto_chips:2")
  25. In this example, there are two process descriptions (implicitly separated by a
  26. semicolon.) The content of the first description is ``2,gpus:2``. This
  27. description spawns 2 processes, each of which requires 2 slots from a single
  28. GPU. The content of the second description is ``gpus:4,crypto_chips:2``. This
  29. description does not specify a process count, so a default of 1 is assumed.
  30. This single process requires 4 slots from a single GPU and 2 slots from a
  31. single cryptography chip. In total, 3 processes are spawned from this test,
  32. each with their own unique requirements.
  33. When CTest sets the :ref:`environment variables
  34. <ctest-hardware-environment-variables>` for a test, it assigns a process number
  35. based on the process description, starting at 0 on the left and the number of
  36. processes minus 1 on the right. For example, in the example above, the two
  37. processes in the first description would have IDs of 0 and 1, and the single
  38. process in the second description would have an ID of 2.
  39. Both the ``PROCESSES`` and :prop_test:`RESOURCE_LOCK` properties serve similar
  40. purposes, but they are distinct and orthogonal. Resources specified by
  41. ``PROCESSES`` do not affect :prop_test:`RESOURCE_LOCK`, and vice versa. Whereas
  42. :prop_test:`RESOURCE_LOCK` is a simpler property that is used for locking one
  43. global resource, ``PROCESSES`` is a more advanced property that allows multiple
  44. tests to simultaneously use multiple resources of the same type, specifying
  45. their requirements in a fine-grained manner.