From b1be5b88bdd37cd4c2338f0faf423abbbff36e57 Mon Sep 17 00:00:00 2001 From: Boyuan Yao <70263930+Cypher30@users.noreply.github.com> Date: Thu, 6 Oct 2022 15:07:03 +0800 Subject: [PATCH] [autoparallel] fix insecure subprocess (#1680) * [autoparallel] fix insecure subprocess * [fx] fix insecure subprocess --- colossalai/fx/passes/algorithms/ckpt_solver_rotor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/colossalai/fx/passes/algorithms/ckpt_solver_rotor.py b/colossalai/fx/passes/algorithms/ckpt_solver_rotor.py index 6c6d9dd10..08789804e 100644 --- a/colossalai/fx/passes/algorithms/ckpt_solver_rotor.py +++ b/colossalai/fx/passes/algorithms/ckpt_solver_rotor.py @@ -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