diff --git a/tests/test_cuquantum_cutensor_backend.py b/tests/test_cuquantum_cutensor_backend.py index 79bd36c..6344843 100644 --- a/tests/test_cuquantum_cutensor_backend.py +++ b/tests/test_cuquantum_cutensor_backend.py @@ -57,7 +57,7 @@ def test_eval(nqubits: int, dtype="complex128"): # Test cutensornet backend = construct_backend(backend="qibotn", platform="cutensornet") - # Test 1: no computation settings specified. Use default. + # Test with no settings specified. Default is dense vector calculation without MPI or NCCL. result_tn = backend.execute_circuit(circuit=qibo_circ) print( f"State vector difference: {abs(result_tn.statevector.flatten() - result_sv_cp).max():0.3e}" @@ -66,7 +66,7 @@ def test_eval(nqubits: int, dtype="complex128"): result_sv_cp, result_tn.statevector.flatten() ), "Resulting dense vectors do not match" - # Test 2: Explicit computation settings specified (same as default). + # Test with explicit settings specified. computation_settings = { "MPI_enabled": False, "MPS_enabled": False, @@ -101,7 +101,7 @@ def test_mps(nqubits: int, dtype="complex128"): # Test cutensornet backend = construct_backend(backend="qibotn", platform="cutensornet") - # Test 1: No MPS computation settings specified. Use default. + # Test with simple MPS settings specified using bool. Uses the default MPS parameters. computation_settings_1 = { "MPI_enabled": False, "MPS_enabled": True, @@ -117,7 +117,7 @@ def test_mps(nqubits: int, dtype="complex128"): result_tn.statevector.flatten(), result_sv_cp ), "Resulting dense vectors do not match" - # Test 2: Explicit MPS computation settings specified (same as default). + # Test with explicit MPS computation settings specified using Dict. Users able to specify parameters like qr_method etc. computation_settings_2 = { "MPI_enabled": False, "MPS_enabled": { @@ -156,7 +156,7 @@ def test_expectation(nqubits: int, dtype="complex128"): # Test cutensornet backend = construct_backend(backend="qibotn", platform="cutensornet") - # Test 1: No Hamilitonian computation settings specified. Use default. + # Test with simple settings using bool. Uses default Hamilitonian for expectation calculation. computation_settings_1 = { "MPI_enabled": False, "MPS_enabled": False, @@ -167,7 +167,7 @@ def test_expectation(nqubits: int, dtype="complex128"): result_tn = backend.execute_circuit(circuit=qibo_circ) assert math.isclose(exact_expval.item(), result_tn.real.get().item(), abs_tol=1e-7) - # Test 2: hamiltonians.SymbolicHamiltonian object in computation settings specified. + # Test with user defined hamiltonian using "hamiltonians.SymbolicHamiltonian" object. computation_settings_2 = { "MPI_enabled": False, "MPS_enabled": False, @@ -178,7 +178,7 @@ def test_expectation(nqubits: int, dtype="complex128"): result_tn = backend.execute_circuit(circuit=qibo_circ) assert math.isclose(exact_expval.item(), result_tn.real.get().item(), abs_tol=1e-7) - # Test 3: Dictionary object form of hamiltonian in computation settings specified. + # Test with user defined hamiltonian using Dictionary object form of hamiltonian. ham_dict = build_observable_dict(nqubits) computation_settings_3 = { "MPI_enabled": False, diff --git a/tests/test_cuquantum_cutensor_mpi_backend.py b/tests/test_cuquantum_cutensor_mpi_backend.py index 0fc86e8..14eb494 100644 --- a/tests/test_cuquantum_cutensor_mpi_backend.py +++ b/tests/test_cuquantum_cutensor_mpi_backend.py @@ -62,7 +62,7 @@ def test_eval_mpi(nqubits: int, dtype="complex128"): # Test cutensornet backend = construct_backend(backend="qibotn", platform="cutensornet") - # Test 1: Explicit computation settings specified (same as default). + # Test with explicit settings specified. computation_settings = { "MPI_enabled": True, "MPS_enabled": False, @@ -106,7 +106,7 @@ def test_expectation_mpi(nqubits: int, dtype="complex128"): # Test cutensornet backend = construct_backend(backend="qibotn", platform="cutensornet") - # Test 1: No Hamilitonian computation settings specified. Use default. + # Test with simple settings using bool. Uses default Hamilitonian for expectation calculation. computation_settings_1 = { "MPI_enabled": True, "MPS_enabled": False, @@ -130,7 +130,7 @@ def test_expectation_mpi(nqubits: int, dtype="complex128"): and result_tn.item() == 0 ), f"Rank {backend.rank}: expected int array [0], got {result_tn}" - # Test 2: hamiltonians.SymbolicHamiltonian object in computation settings specified. + # Test with user defined hamiltonian using "hamiltonians.SymbolicHamiltonian" object. computation_settings_2 = { "MPI_enabled": True, "MPS_enabled": False, @@ -154,7 +154,7 @@ def test_expectation_mpi(nqubits: int, dtype="complex128"): and result_tn.item() == 0 ), f"Rank {backend.rank}: expected int array [0], got {result_tn}" - # Test 3: Dictionary object form of hamiltonian in computation settings specified. + # Test with user defined hamiltonian using Dictionary object form of hamiltonian. ham_dict = build_observable_dict(nqubits) computation_settings_3 = { "MPI_enabled": True, @@ -198,7 +198,7 @@ def test_eval_nccl(nqubits: int, dtype="complex128"): # Test cutensornet backend = construct_backend(backend="qibotn", platform="cutensornet") - # Test 1: Explicit computation settings specified (same as default). + # Test with explicit settings specified. computation_settings = { "MPI_enabled": False, "MPS_enabled": False, @@ -239,7 +239,7 @@ def test_expectation_NCCL(nqubits: int, dtype="complex128"): # Test cutensornet backend = construct_backend(backend="qibotn", platform="cutensornet") - # Test 1: No Hamilitonian computation settings specified. Use default. + # Test with simple settings using bool. Uses default Hamilitonian for expectation calculation. computation_settings_1 = { "MPI_enabled": False, "MPS_enabled": False, @@ -263,7 +263,7 @@ def test_expectation_NCCL(nqubits: int, dtype="complex128"): and result_tn.item() == 0 ), f"Rank {backend.rank}: expected int array [0], got {result_tn}" - # Test 2: hamiltonians.SymbolicHamiltonian object in computation settings specified. + # Test with user defined hamiltonian using "hamiltonians.SymbolicHamiltonian" object. computation_settings_2 = { "MPI_enabled": False, "MPS_enabled": False, @@ -287,7 +287,7 @@ def test_expectation_NCCL(nqubits: int, dtype="complex128"): and result_tn.item() == 0 ), f"Rank {backend.rank}: expected int array [0], got {result_tn}" - # Test 3: Dictionary object form of hamiltonian in computation settings specified. + # Test with user defined hamiltonian using Dictionary object form of hamiltonian. ham_dict = build_observable_dict(nqubits) computation_settings_3 = { "MPI_enabled": False,