From c818ac7a6e3e7d7984ef34c2afb9183fb86fa292 Mon Sep 17 00:00:00 2001 From: jaunatisblue Date: Thu, 7 May 2026 23:37:15 +0800 Subject: [PATCH] =?UTF-8?q?mpi=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- benchmark_contract_sliced.py | 9 ++++++--- hostfile | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 hostfile diff --git a/benchmark_contract_sliced.py b/benchmark_contract_sliced.py index 0f56cd1..5c3298f 100644 --- a/benchmark_contract_sliced.py +++ b/benchmark_contract_sliced.py @@ -24,9 +24,12 @@ backend.configure_tn_simulation(ansatz="tn") qc = backend._qibo_circuit_to_quimb(circuit, backend.circuit_ansatz) tn = qc.local_expectation(qu.pauli('x') & qu.pauli('z'), (0, 1), rehearse='tn') -with open(f"data/tree_q{NQUBITS}_l{NLAYERS}_sliced.pkl", 'rb') as f: -#with open(f"data/tree_q{NQUBITS}_l{NLAYERS}.pkl", 'rb') as f: - tree = pickle.load(f) +if rank == 0: + with open(f"data/tree_q{NQUBITS}_l{NLAYERS}_sliced.pkl", 'rb') as f: + tree = pickle.load(f) +else: + tree = None +tree = comm.bcast(tree, root=0) arrays = [torch.from_numpy(np.ascontiguousarray(t._data, dtype=np.complex128)) for t in tn.tensors] n_slices = tree.multiplicity diff --git a/hostfile b/hostfile new file mode 100644 index 0000000..3692319 --- /dev/null +++ b/hostfile @@ -0,0 +1,2 @@ +10.20.6.74:1 +10.20.6.102:1 \ No newline at end of file