11#! /bin/bash
2+ set -x
23
34GRAPH_NET_ROOT=$( python3 -c " import graph_net; import os; print(os.path.dirname(os.path.dirname(graph_net.__file__)))" )
45DECOMPOSE_PATH=/tmp/decompose_workspace
@@ -9,7 +10,9 @@ mkdir -p "$DECOMPOSE_PATH"
910# model_list="$GRAPH_NET_ROOT/graph_net/config/small100_torch_samples_list.txt"
1011model_list=" $GRAPH_NET_ROOT /graph_net/test/dev_model_list/validation_error_model_list.txt"
1112
12- op_names_extractor_config_json_str=$( cat << EOF
13+ python3 -m graph_net.model_path_handler \
14+ --model-path-list $model_list \
15+ --handler-config=$( base64 -w 0 << EOF
1316{
1417 "handler_path": "$GRAPH_NET_ROOT /graph_net/torch/typical_sequence_split_points.py",
1518 "handler_class_name": "OpNamesExtractor",
@@ -21,11 +24,6 @@ op_names_extractor_config_json_str=$(cat <<EOF
2124}
2225EOF
2326)
24- OP_NAMES_EXTRACTOR_CONFIG=$( echo $op_names_extractor_config_json_str | base64 -w 0)
25-
26- python3 -m graph_net.model_path_handler \
27- --model-path-list $model_list \
28- --handler-config=$OP_NAMES_EXTRACTOR_CONFIG \
2927
3028python3 -m graph_net.torch.typical_sequence_split_points \
3129 --enable-resume \
@@ -37,7 +35,9 @@ python3 -m graph_net.torch.typical_sequence_split_points \
3735 --fold-times 10 \
3836 --output-json " $DECOMPOSE_PATH /split_results.json"
3937
40- decompose_config_json_str=$( cat << EOF
38+ python3 -m graph_net.model_path_handler \
39+ --model-path-list $model_list \
40+ --handler-config=$( base64 -w 0 << EOF
4141{
4242 "handler_path": "$GRAPH_NET_ROOT /graph_net/torch/graph_decomposer.py",
4343 "handler_class_name": "RangeDecomposerExtractor",
@@ -52,27 +52,46 @@ decompose_config_json_str=$(cat <<EOF
5252}
5353EOF
5454)
55- DECOMPOSE_CONFIG=$( echo $decompose_config_json_str | base64 -w 0)
5655
57- python3 -m graph_net.model_path_handler \
58- --model-path-list $model_list \
59- --handler-config=$DECOMPOSE_CONFIG \
56+ device_rewrite_sample_list=$DECOMPOSE_PATH /device_rewrite_sample_list.txt
57+ cat $model_list \
58+ | grep -v ' # ' \
59+ | xargs -I {} find $DECOMPOSE_PATH /{} -name " model.py" \
60+ | xargs dirname \
61+ | xargs realpath --relative-to=$DECOMPOSE_PATH \
62+ | tee $device_rewrite_sample_list
6063
61- test_compiler_config_json_str=$( cat << EOF
64+ DEVICE_REWRITE_WORKSPACE=$DECOMPOSE_PATH /device_rewrite
65+
66+ python3 -m graph_net.model_path_handler \
67+ --model-path-list $device_rewrite_sample_list \
68+ --handler-config $( base64 -w 0 << EOF
6269{
63- "model_path_prefix": "$GRAPH_NET_ROOT ",
64- "decomposed_root": "$DECOMPOSE_PATH "
70+ "handler_path": "$GRAPH_NET_ROOT /graph_net/torch/sample_passes/device_rewrite_sample_pass.py",
71+ "handler_class_name": "DeviceRewriteSamplePass",
72+ "handler_config": {
73+ "device": "cuda",
74+ "resume": false,
75+ "model_path_prefix": "$DECOMPOSE_PATH ",
76+ "output_dir": "$DEVICE_REWRITE_WORKSPACE "
77+ }
6578}
6679EOF
6780)
68- TEST_COMPILER_CONFIG= $( echo $test_compiler_config_json_str | base64 -w 0 )
81+
6982
7083python3 -m graph_net.torch.test_compiler \
84+ --model-path-prefix $GRAPH_NET_ROOT \
7185 --allow-list $model_list \
7286 --compiler range_decomposer_validator \
7387 --device cuda \
74- --config $TEST_COMPILER_CONFIG \
75- --model-path-prefix $GRAPH_NET_ROOT \
88+ --config $( base64 -w 0 << EOF
89+ {
90+ "model_path_prefix": "$GRAPH_NET_ROOT ",
91+ "decomposed_root": "$DEVICE_REWRITE_WORKSPACE "
92+ }
93+ EOF
94+ ) \
7695 2>&1 | tee " $DECOMPOSE_PATH /validation.log"
7796
7897python3 -m graph_net.plot_ESt \
0 commit comments