Skip to content

Commit 31757ba

Browse files
report function in distributedcontrctor
1 parent a18d467 commit 31757ba

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

README_cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<p align="center"> <a href="README.md">English</a> | 简体中文 </p>
2323

24-
TensorCircuit-NG 是下一代量子软件框架,完美支持自动微分、即时编译、硬件加速、向量并行化和分布式训练。
24+
TensorCircuit-NG 是下一代量子软件框架,完美支持自动微分、即时编译、硬件加速、向量并行化和分布式训练,是量超智融合的首选平台
2525

2626
TensorCircuit-NG 建立在现代机器学习框架 Jax, TensorFlow, PyTorch 之上,支持机器学习后端无关的统一界面。 其特别适用于理想情况、含噪声情况、稳定子情况、可控近似情况、连续动力学情况及费米子情况下,大规模量子经典混合范式和变分量子算法的高效模拟。其可以高效地编织和模拟量子线路、张量网络和神经网络组成的混合计算图。
2727

@@ -33,7 +33,7 @@ TensorCircuit-NG 是目前积极维护的唯一官方版本,是 TensorCircuit
3333

3434
请从 [完整文档](https://tensorcircuit-ng.readthedocs.io/) 中的 [快速上手](/docs/source/quickstart.rst) 开始。
3535

36-
有关软件用法,算法实现和工程范式演示的更多信息和介绍,请参阅 90+ [示例脚本](/examples) 和 40+ [案例教程](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials)[测试](/tests) 用例和 API docstring 也提供了丰富的使用信息。
36+
有关软件用法,算法实现和工程范式演示的更多信息和介绍,请参阅 100+ [示例脚本](/examples) 和 40+ [案例教程](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials)[测试](/tests) 用例和 API docstring 也提供了丰富的使用信息。
3737

3838
TensorCircuit-NG 也支持 AI 原生编程资源:[Devin Deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng)[Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
3939

tensorcircuit/experimental.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -833,16 +833,7 @@ def __init__(
833833
)
834834
actual_num_slices = self.tree.nslices
835835

836-
print("\n--- Contraction Path Info ---")
837-
stats = self.tree.contract_stats()
838-
print(f"Path found with {actual_num_slices} slices.")
839-
print(
840-
f"Arithmetic Intensity (higher is better): {self.tree.arithmetic_intensity():.2f}"
841-
)
842-
print("flops (TFlops):", stats["flops"] / 2**40 / self.num_devices)
843-
print("write (GB):", stats["write"] / 2**27 / actual_num_slices)
844-
print("size (GB):", stats["size"] / 2**27)
845-
print("-----------------------------\n")
836+
self._report_tree_info()
846837

847838
slices_per_device = int(np.ceil(actual_num_slices / self.num_devices))
848839
padded_size = slices_per_device * self.num_devices
@@ -872,6 +863,19 @@ def __init__(
872863

873864
logger.info("Initialization complete.")
874865

866+
def _report_tree_info(self) -> None:
867+
print("\n--- Contraction Path Info ---")
868+
actual_num_slices = self.tree.nslices
869+
stats = self.tree.contract_stats()
870+
print(f"Path found with {actual_num_slices} slices.")
871+
print(
872+
f"Arithmetic Intensity (higher is better): {self.tree.arithmetic_intensity():.2f}"
873+
)
874+
print("flops (TFlops):", stats["flops"] / 2**40 / self.num_devices)
875+
print("write (GB):", stats["write"] / 2**27 / actual_num_slices)
876+
print("size (GB):", stats["size"] / 2**27)
877+
print("-----------------------------\n")
878+
875879
@staticmethod
876880
def _get_tree_data(
877881
nodes_fn: Callable[[Tensor], List[Gate]],

0 commit comments

Comments
 (0)