[autoparallel] fix insecure subprocess (#1680)

* [autoparallel] fix insecure subprocess

* [fx] fix insecure subprocess
pull/1681/head^2
Boyuan Yao 2022-10-06 15:07:03 +08:00 committed by GitHub
parent d8420f81a4
commit b1be5b88bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import sys
from typing import List, Tuple
from torch.fx import Node
from colossalai.fx.graph_module import ColoGraphModule
@ -353,10 +354,13 @@ def solver_rotor(gm: ColoGraphModule,
logger.info("dynamic_programs_C_version hasn't been built! Building library...", ranks=[0])
this_dir = os.path.dirname(os.path.abspath(__file__))
result = subprocess.Popen(
f'python {os.path.join(this_dir, "build_c_ext.py")} build_ext --build-lib={this_dir}',
[
f"{sys.executable}", f"{os.path.join(this_dir, 'build_c_ext.py')}", "build_ext",
f"--build-lib={this_dir}"
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
)
if result.wait() == 0:
logger.info("dynamic_programs_C_version has been built!", ranks=[0])
from .dynamic_programs_C_version import persistent_compute_table