deepfold.testing package

Submodules

deepfold.testing.common module

class deepfold.testing.common.MultiProcessTestCase(meethod_name: str = 'runTest')

Bases: TestCase

class Event(value)

Bases: Enum

An enumeration.

GET_TRACEBACK = 1
MAIN_PROCESS_RANK: int = -1
TEST_ERROR_EXIT_CODE: int = 10
property is_master: bool
join_or_run(fn)
run_test(test_name: str, parent_pipe) None
setUp() None

Hook method for setting up the test fixture before exercising it.

tearDown() None

Hook method for deconstructing the test fixture after testing it.

property world_size: int
deepfold.testing.common.skip_if_lt_x_gpu(n: int)
deepfold.testing.common.skip_if_no_gpu(func)

Skips if the world size exceeds the number of GPUs.

deepfold.testing.common.with_nccl_blocking_wait(func)

Convenience decorator to set/unset TORCH_NCCL_BLOCKING_WAIT flag. Note that use of this decorator will override the setting of TORCH_NCCL_ASYNC_ERROR_HANDLING for the particular test. After the test, both TORCH_NCCL_BLOCKING_WAIT and TORCH_NCCL_ASYNC_ERROR_HANDLING will be restored to their original values.

deepfold.testing.utils module

deepfold.testing.utils.find_free_port()

Finds an available port and returns that port number.

NOTE: If this function is being used to allocate a port to Store (or indirectly via init_process_group or init_rpc), it should be used in conjuction with the retry_on_connect_failures decorator as there is a potential race condition where the allocated port may become unavailable before it can be used

Module contents