diff --git a/tools/expand_graph_paths.sh b/tools/expand_graph_paths.sh new file mode 100644 index 0000000000..78f464d055 --- /dev/null +++ b/tools/expand_graph_paths.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +PASSNET_DIR="/path/to/passnet/repo/" + +INPUT_LISTS=( + "${PASSNET_DIR}/sample_lists/hf_typical_samples_v2.txt" + "${PASSNET_DIR}/sample_lists/hf_sole_op_samples_v2.txt" + "${PASSNET_DIR}/sample_lists/hf_fusible_samples_v2.txt" +) + +if [ ! -d "$PASSNET_DIR" ]; then + echo "Error: base directory $PASSNET_DIR not found" + exit 1 +fi + +for INPUT_LIST in "${INPUT_LISTS[@]}"; do + BASENAME=$(basename "$INPUT_LIST" .txt) + OUTPUT_FILE="${BASENAME}_all_expanded.txt" + > "$OUTPUT_FILE" + + echo "Processing $INPUT_LIST ..." + + count=0 + while IFS= read -r rel_path || [ -n "$rel_path" ]; do + clean_rel_path=$(echo "$rel_path" | tr -d '\r' | xargs) + [ -z "$clean_rel_path" ] && continue + + TARGET_FILE="${PASSNET_DIR}/${clean_rel_path}/graph_list.txt" + + if [ -f "$TARGET_FILE" ]; then + cat "$TARGET_FILE" >> "$OUTPUT_FILE" + ((count++)) + else + echo "Skipped: $TARGET_FILE not found" + fi + done < "$INPUT_LIST" + + echo "Done: $count directories processed -> $(pwd)/$OUTPUT_FILE" +done + +echo "All tasks completed."