The tensor parallel module tests (test_tp.py) verify the tensor parallel computing functionality, including process group initialization and parallel group management.
deftest_tensor_parallel_functions_exist(self):"""Test that tensor parallel functions exist."""# Check that key functions are availableasserthasattr(tp,"initialize_tensor_parallel")asserthasattr(tp,"tensor_parallel_is_initialized")asserthasattr(tp,"get_tensor_parallel_group")asserthasattr(tp,"get_data_parallel_group")asserthasattr(tp,"get_pipeline_parallel_group")asserthasattr(tp,"destroy_tensor_parallel")
deftest_utility_functions(self):"""Test utility functions."""# Check that utility functions are availableasserthasattr(tp,"ensure_divisibility")asserthasattr(tp,"divide_and_check_no_remainder")asserthasattr(tp,"split_tensor_along_last_dim")
deftest_ensure_divisibility(self):"""Test ensure_divisibility function."""# This should not raise an exceptiontp.ensure_divisibility(10,2)# This should raise an exceptionwithpytest.raises(AssertionError):tp.ensure_divisibility(10,3)