From 0af7d33aac3948670296698f479e138df9e585c4 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Thu, 29 Jun 2023 15:47:08 -0700 Subject: [PATCH 01/11] Add in all the files with the folders. WIP still need to clean up each script and add their commands at the top and add in READMEs in some folder locations --- .gitignore | 9 ++- scripts/artifact/README.md | 10 +++ .../{ => artifact}/artifact_docker_copy.py | 0 scripts/{ => artifact}/collect_node_counts.py | 0 scripts/{ => artifact}/plot_memory_model.py | 0 .../{ => artifact}/plot_stream_overhead.py | 0 scripts/{ => artifact}/stream_overhead.sh | 0 scripts/checker_diff.sh | 8 --- scripts/formatting/README.md | 16 +++++ .../datastructure_suitesparse.py | 0 scripts/{ => formatting}/datastructure_tns.py | 0 .../download_unpack_format_suitesparse.sh | 10 +-- .../generate_frostt_formats.sh | 6 +- .../generate_suitesparse_formats.sh | 8 ++- scripts/gen_sam_apps/README.md | 6 ++ .../test_generating_code.py | 0 scripts/generate_extensor_synthetic.py | 0 scripts/generate_synthetics_extensor.sh | 71 ------------------- scripts/get_data/README.md | 11 +++ scripts/{ => get_data}/download_frostt.sh | 4 +- .../{ => get_data}/download_suitesparse.sh | 4 +- scripts/{ => get_data}/generate_synthetics.sh | 0 scripts/{ => get_data}/unpack_suitesparse.sh | 2 + .../{ => get_data}/unpack_suitesparse_all.sh | 2 + scripts/{ => run_cpu}/frostt_runner.sh | 0 scripts/{ => run_cpu}/suitesparse_runner.sh | 0 .../sam_hw_suitesparse_runner.sh | 0 scripts/run_sam_sim/README.md | 14 ++++ scripts/{ => run_sam_sim}/pytest_frostt.sh | 0 .../pytest_frostt_with_benchmarks.sh | 0 .../{ => run_sam_sim}/pytest_suitesparse.sh | 0 .../pytest_suitesparse_with_benchmarks.sh | 0 scripts/{ => run_sam_sim}/run_suitesparse.sh | 5 +- scripts/run_sam_sim/run_suitesparse_final.sh | 14 ++++ .../run_sam_sim/run_suitesparse_generated.sh | 16 +++++ scripts/{ => run_sam_sim}/run_synthetics.sh | 3 + .../{ => run_sam_sim}/sam_frostt_runner.sh | 6 ++ .../sam_suitesparse_runner.sh | 0 .../sam_suitesparse_runner_sddmmonly.sh | 0 .../suitesparse_validator.sh | 0 scripts/{ => stats}/get_tensor_arrlen.py | 1 + scripts/{ => stats}/ss_stats.sh | 0 scripts/{ => stats}/suitesparse_stats.py | 0 scripts/tensor_names/README.md | 19 +++++ scripts/{ => tensor_names}/divvy_runs.py | 0 .../{ => tiling}/advanced_simulator_runner.sh | 4 +- scripts/{ => tiling}/clean_memory_model.sh | 0 scripts/{ => tiling}/ext_runner.sh | 0 .../few_points_memory_model_runner.sh | 0 scripts/{ => tiling}/full_ext_runner.sh | 0 .../{ => tiling}/full_memory_model_runner.sh | 0 .../generate_gold_matmul_tiled.py | 0 .../generate_sparsity_sweep_mem_model.sh | 0 scripts/{ => tiling}/prepare_files.sh | 0 scripts/{ => tiling}/prepare_files_no_gold.sh | 0 .../single_point_memory_model_runner.sh | 0 scripts/{ => tiling}/tile.sh | 0 scripts/{ => tiling}/tile_ext.sh | 0 scripts/util/README.md | 10 +++ scripts/{ => util}/bench_csv_aggregator.py | 0 scripts/{ => util}/converter.py | 0 scripts/{ => util}/util.py | 0 62 files changed, 165 insertions(+), 94 deletions(-) create mode 100644 scripts/artifact/README.md rename scripts/{ => artifact}/artifact_docker_copy.py (100%) rename scripts/{ => artifact}/collect_node_counts.py (100%) rename scripts/{ => artifact}/plot_memory_model.py (100%) rename scripts/{ => artifact}/plot_stream_overhead.py (100%) rename scripts/{ => artifact}/stream_overhead.sh (100%) delete mode 100755 scripts/checker_diff.sh create mode 100644 scripts/formatting/README.md rename scripts/{ => formatting}/datastructure_suitesparse.py (100%) rename scripts/{ => formatting}/datastructure_tns.py (100%) rename scripts/{ => formatting}/download_unpack_format_suitesparse.sh (71%) rename scripts/{ => formatting}/generate_frostt_formats.sh (81%) rename scripts/{ => formatting}/generate_suitesparse_formats.sh (68%) create mode 100644 scripts/gen_sam_apps/README.md rename scripts/{ => gen_sam_apps}/test_generating_code.py (100%) delete mode 100644 scripts/generate_extensor_synthetic.py delete mode 100755 scripts/generate_synthetics_extensor.sh create mode 100644 scripts/get_data/README.md rename scripts/{ => get_data}/download_frostt.sh (95%) rename scripts/{ => get_data}/download_suitesparse.sh (99%) rename scripts/{ => get_data}/generate_synthetics.sh (100%) rename scripts/{ => get_data}/unpack_suitesparse.sh (81%) rename scripts/{ => get_data}/unpack_suitesparse_all.sh (79%) rename scripts/{ => run_cpu}/frostt_runner.sh (100%) rename scripts/{ => run_cpu}/suitesparse_runner.sh (100%) rename scripts/{ => run_onyx}/sam_hw_suitesparse_runner.sh (100%) create mode 100644 scripts/run_sam_sim/README.md rename scripts/{ => run_sam_sim}/pytest_frostt.sh (100%) rename scripts/{ => run_sam_sim}/pytest_frostt_with_benchmarks.sh (100%) rename scripts/{ => run_sam_sim}/pytest_suitesparse.sh (100%) rename scripts/{ => run_sam_sim}/pytest_suitesparse_with_benchmarks.sh (100%) rename scripts/{ => run_sam_sim}/run_suitesparse.sh (87%) create mode 100755 scripts/run_sam_sim/run_suitesparse_final.sh create mode 100755 scripts/run_sam_sim/run_suitesparse_generated.sh rename scripts/{ => run_sam_sim}/run_synthetics.sh (94%) rename scripts/{ => run_sam_sim}/sam_frostt_runner.sh (96%) rename scripts/{ => run_sam_sim}/sam_suitesparse_runner.sh (100%) rename scripts/{ => run_sam_sim}/sam_suitesparse_runner_sddmmonly.sh (100%) rename scripts/{ => run_sam_sim}/suitesparse_validator.sh (100%) rename scripts/{ => stats}/get_tensor_arrlen.py (97%) rename scripts/{ => stats}/ss_stats.sh (100%) rename scripts/{ => stats}/suitesparse_stats.py (100%) create mode 100644 scripts/tensor_names/README.md rename scripts/{ => tensor_names}/divvy_runs.py (100%) rename scripts/{ => tiling}/advanced_simulator_runner.sh (95%) rename scripts/{ => tiling}/clean_memory_model.sh (100%) rename scripts/{ => tiling}/ext_runner.sh (100%) rename scripts/{ => tiling}/few_points_memory_model_runner.sh (100%) rename scripts/{ => tiling}/full_ext_runner.sh (100%) rename scripts/{ => tiling}/full_memory_model_runner.sh (100%) rename scripts/{ => tiling}/generate_gold_matmul_tiled.py (100%) rename scripts/{ => tiling}/generate_sparsity_sweep_mem_model.sh (100%) rename scripts/{ => tiling}/prepare_files.sh (100%) rename scripts/{ => tiling}/prepare_files_no_gold.sh (100%) rename scripts/{ => tiling}/single_point_memory_model_runner.sh (100%) rename scripts/{ => tiling}/tile.sh (100%) rename scripts/{ => tiling}/tile_ext.sh (100%) create mode 100644 scripts/util/README.md rename scripts/{ => util}/bench_csv_aggregator.py (100%) rename scripts/{ => util}/converter.py (100%) rename scripts/{ => util}/util.py (100%) diff --git a/.gitignore b/.gitignore index 82490b68..3c716691 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ __pycache__/ *.swo *.txt *.out +download_suitesparse_partial.sh # Files for MacOS and IDEs .DS_store @@ -38,8 +39,10 @@ compiler/benchmark/ # Generated SAM simulator tests */sim/test/apps/test_*.py +# Generated SAM graphs *.gv +# Downloaded data *.mtx *.tns @@ -52,5 +55,9 @@ tmp_mat*/ # Generated formatted tensor files tensor_*_mode_* -# Tensor files +# Tiling files tiles/ + +# sam package info +sam.egg-info/ + diff --git a/scripts/artifact/README.md b/scripts/artifact/README.md new file mode 100644 index 00000000..58c200c6 --- /dev/null +++ b/scripts/artifact/README.md @@ -0,0 +1,10 @@ +# Artifact Scripts + +The `scripts/artifact/` folder contains scripts used only for artifact evaluation of "The Sparse Abstract Machine" ASPLOS 2023. + +1. `artifact_docker_copy.py` - Python script that copies figures from docker to local machine for viewing. +2. `collect_node_counts.py` - Python script that counts and prints the number of each SAM primitive for Table 1 in "The Sparse Abstract Machine". +3. `plot_memory_model.py` - Python script that plots the memory model graph (Figure +4. `plot_stream_overhead.py` - +5. `stream_overhead.sh` - + diff --git a/scripts/artifact_docker_copy.py b/scripts/artifact/artifact_docker_copy.py similarity index 100% rename from scripts/artifact_docker_copy.py rename to scripts/artifact/artifact_docker_copy.py diff --git a/scripts/collect_node_counts.py b/scripts/artifact/collect_node_counts.py similarity index 100% rename from scripts/collect_node_counts.py rename to scripts/artifact/collect_node_counts.py diff --git a/scripts/plot_memory_model.py b/scripts/artifact/plot_memory_model.py similarity index 100% rename from scripts/plot_memory_model.py rename to scripts/artifact/plot_memory_model.py diff --git a/scripts/plot_stream_overhead.py b/scripts/artifact/plot_stream_overhead.py similarity index 100% rename from scripts/plot_stream_overhead.py rename to scripts/artifact/plot_stream_overhead.py diff --git a/scripts/stream_overhead.sh b/scripts/artifact/stream_overhead.sh similarity index 100% rename from scripts/stream_overhead.sh rename to scripts/artifact/stream_overhead.sh diff --git a/scripts/checker_diff.sh b/scripts/checker_diff.sh deleted file mode 100755 index b84cdeba..00000000 --- a/scripts/checker_diff.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -for numpy in $1/*-numpy.tns; do - taco=${numpy/-numpy/-taco} - if [ ! "$(wc -l < $numpy | xargs)" -eq "$(wc -l < $taco | xargs)" ]; then - echo "Files $numpy and $taco have a differing number of entries." - fi -done diff --git a/scripts/formatting/README.md b/scripts/formatting/README.md new file mode 100644 index 00000000..06d3241b --- /dev/null +++ b/scripts/formatting/README.md @@ -0,0 +1,16 @@ +# Formatting + +The `scripts/formatting/` folder contains scripts used to format the datasets from mtx/tns files to the seg/crd/vals arrays for CSF. The CSF files are expected by both the Onyx AHA flow and the SAM simulator. + +1. `datastructure_suitesparse.py` - Python script used by + `generate_suitesparse_formats.sh` to format from mtx to CSF files. + - +2. `datastructure_tns.py` - Python script used by + `generate_frostt_formats.sh` to format from tns to CSF files. +3. `download_unpack_format_suitesparse.sh` - Script that downloads, unpacks, + and formats a list of suitesparse matrices. To download and unpack it + calls scripts in `scripts/get_data`. +4. `generate_frostt_formats.sh` - Formats all FROSTT datasets. FIXME: This file needs fixing as it uses the old CSF formatting (e.g. `matrix_name/B_seg0`) instead of the new one (e.g. `app/tensor_B_mode_0_seg`) +5. `generate_suitesparse_formats.sh` - Formats all SuiteSparse datasets + +Formatted CSF files should reside in `$SUITESPARSE_FORMATTED_PATH` for SuiteSparse matrices. diff --git a/scripts/datastructure_suitesparse.py b/scripts/formatting/datastructure_suitesparse.py similarity index 100% rename from scripts/datastructure_suitesparse.py rename to scripts/formatting/datastructure_suitesparse.py diff --git a/scripts/datastructure_tns.py b/scripts/formatting/datastructure_tns.py similarity index 100% rename from scripts/datastructure_tns.py rename to scripts/formatting/datastructure_tns.py diff --git a/scripts/download_unpack_format_suitesparse.sh b/scripts/formatting/download_unpack_format_suitesparse.sh similarity index 71% rename from scripts/download_unpack_format_suitesparse.sh rename to scripts/formatting/download_unpack_format_suitesparse.sh index 5250d256..5dc4b09c 100755 --- a/scripts/download_unpack_format_suitesparse.sh +++ b/scripts/formatting/download_unpack_format_suitesparse.sh @@ -1,8 +1,10 @@ #!/bin/bash +# Command: ./scripts/formatting/download_unpack_format_suitesparse.sh + basedir=$(pwd) path=$basedir/jsons -download_script=scripts/download_suitesparse_stream_overhead.sh +download_script=scripts/get_data/download_suitesparse_partial.sh mkdir -p $path @@ -30,7 +32,7 @@ BENCHMARKS=( echo "mkdir -p ${SUITESPARSE_PATH}" >> $download_script echo "pushd ." >> $download_script echo "cd ${SUITESPARSE_PATH}" >> $download_script -grep -F -f $1 scripts/download_suitesparse.sh >> $download_script +grep -F -f $1 scripts/get_data/download_suitesparse.sh >> $download_script echo "popd" >> $download_script # Make it an executable @@ -40,13 +42,13 @@ chmod ugo+x $download_script ./$download_script # Unpack the downloaded suitesparse files since they come in .tar format -./scripts/unpack_suitesparse.sh $(realpath $1) +./scripts/get_data/unpack_suitesparse.sh $(realpath $1) for b in ${!BENCHMARKS[@]}; do bench=${BENCHMARKS[$b]} while read line; do echo "Generating input format files for $line..." sspath=${SUITESPARSE_PATH}/$line - SUITESPARSE_TENSOR_PATH=$sspath python $basedir/scripts/datastructure_suitesparse.py -n $line -hw -b $bench + SUITESPARSE_TENSOR_PATH=$sspath python $basedir/scripts/formatting/datastructure_suitesparse.py -n $line -hw -b $bench done <$(realpath $1) done diff --git a/scripts/generate_frostt_formats.sh b/scripts/formatting/generate_frostt_formats.sh similarity index 81% rename from scripts/generate_frostt_formats.sh rename to scripts/formatting/generate_frostt_formats.sh index 6417bbef..a83e76c7 100755 --- a/scripts/generate_frostt_formats.sh +++ b/scripts/formatting/generate_frostt_formats.sh @@ -2,6 +2,8 @@ #SBATCH -N 1 #SBATCH -t 360 +# Command: ./scripts/formatting/generate_frostt_formats.sh + DATASET_NAMES=( fb1k fb10k @@ -39,8 +41,8 @@ for i in ${!FORMATS[@]}; do name=${DATASET_NAMES[$j]} echo "Generating input format files for $name..." - python $basedir/scripts/datastructure_tns.py -n $name -f $format - python $basedir/scripts/datastructure_tns.py -n $name -f $format --other + python $basedir/scripts/formatting/datastructure_tns.py -n $name -f $format + python $basedir/scripts/formatting/datastructure_tns.py -n $name -f $format --other chmod -R 775 $FROSTT_FORMATTED_PATH done done diff --git a/scripts/generate_suitesparse_formats.sh b/scripts/formatting/generate_suitesparse_formats.sh similarity index 68% rename from scripts/generate_suitesparse_formats.sh rename to scripts/formatting/generate_suitesparse_formats.sh index a12d9eea..8e74b9a1 100755 --- a/scripts/generate_suitesparse_formats.sh +++ b/scripts/formatting/generate_suitesparse_formats.sh @@ -2,6 +2,8 @@ #SBATCH -N 1 #SBATCH -t 360 +# Command: ./scripts/formatting/generate_suitesparse_formats.sh + BENCHMARKS=( matmul_ikj matmul_ijk @@ -20,7 +22,7 @@ OTHERBENCHES='["mat_residual", "mat_mattransmul", "mat_vecmul"]' # THIS FILE MUST BE RUN FROM sam/ location outdir=${SUITESPARSE_FORMATTED_PATH} basedir=$(pwd) -textfile=$basedir/$1 +textfile=$basedir/scripts/tensor_names/$1 mkdir -p $outdir cd $outdir @@ -32,10 +34,10 @@ for b in ${!BENCHMARKS[@]}; do sspath=${SUITESPARSE_PATH}/$name echo "Generating input format files for $name..." - SUITESPARSE_TENSOR_PATH=$sspath python $basedir/scripts/datastructure_suitesparse.py -n $name -hw -b $bench + SUITESPARSE_TENSOR_PATH=$sspath python $basedir/scripts/formatting/datastructure_suitesparse.py -n $name -hw -b $bench if [[ $OTHERBENCHES =~ "$bench" ]]; then echo "Generating format of 'other' tensor" - python $basedir/scripts/datastructure_tns.py -n $line -f ss01 --other -ss -b $bench -hw + python $basedir/scripts/formatting/datastructure_tns.py -n $line -f ss01 --other -ss -b $bench -hw fi done <$textfile diff --git a/scripts/gen_sam_apps/README.md b/scripts/gen_sam_apps/README.md new file mode 100644 index 00000000..f644184d --- /dev/null +++ b/scripts/gen_sam_apps/README.md @@ -0,0 +1,6 @@ +# Generate SAM Simulator Applications + +The `scripts/gen_apps/` folder contains scripts used to generate the pytest applications (in Python) needed to run the SAM simulations + +1. `test_generating_code.py` - Python script that takes in a SAM graph and generates the pytest application in the `sam/sam/sim/test/apps/` directory. + diff --git a/scripts/test_generating_code.py b/scripts/gen_sam_apps/test_generating_code.py similarity index 100% rename from scripts/test_generating_code.py rename to scripts/gen_sam_apps/test_generating_code.py diff --git a/scripts/generate_extensor_synthetic.py b/scripts/generate_extensor_synthetic.py deleted file mode 100644 index e69de29b..00000000 diff --git a/scripts/generate_synthetics_extensor.sh b/scripts/generate_synthetics_extensor.sh deleted file mode 100755 index fd6ed055..00000000 --- a/scripts/generate_synthetics_extensor.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -# Vars -if [ -z "$2" ] -then - export SYNTHETIC_PATH="$(pwd)/synthetic/" -else - export SYNTHETIC_PATH="$2" -fi - -export SRC_PATH="$(pwd)/sam/onyx/synthetic/" - -# Create the main directories -mkdir -p $SYNTHETIC_PATH -pushd $SYNTHETIC_PATH -for vectype in "random" "blocks" "runs" -do - mkdir -p "${SYNTHETIC_PATH}/${vectype}/compressed/" - mkdir -p "${SYNTHETIC_PATH}/${vectype}/uncompressed/" - case $vectype in - random) - python ${SRC_PATH}/generate_random_mats.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/compressed/ --name B --shape 2000 --output_format CSF - python ${SRC_PATH}/generate_random_mats.py --seed 1 --output_dir ${SYNTHETIC_PATH}/${vectype}/compressed/ --name C --shape 2000 --output_format CSF - python ${SRC_PATH}/generate_random_mats.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/uncompressed/ --name B --shape 2000 --output_format UNC - python ${SRC_PATH}/generate_random_mats.py --seed 1 --output_dir ${SYNTHETIC_PATH}/${vectype}/uncompressed/ --name C --shape 2000 --output_format UNC - ;; - blocks) - for bs in 1 2 5 10 20 30 40 50 75 100 200 300 400 - do - nnz=400 - python ${SRC_PATH}/generate_blocks.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/compressed/ --number_nonzeros $nnz --len_blocks $bs --shape 2000 --output_format CSF - python ${SRC_PATH}/generate_blocks.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/uncompressed/ --number_nonzeros $nnz --len_blocks $bs --shape 2000 --output_format UNC - # python ${SRC_PATH}/generate_blocks.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/compressed/ --shape 2000 --output_format CSF - # python ${SRC_PATH}/generate_blocks.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/uncompressed/ --shape 2000 --output_format UNC - done - ;; - runs) - for rl in 1 2 5 10 20 30 40 50 75 100 200 300 400 - do - python ${SRC_PATH}/generate_runs.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/compressed/ --shape 2000 --number_nonzeros 400 --run_length $rl --output_format CSF - python ${SRC_PATH}/generate_runs.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/uncompressed/ --shape 2000 --number_nonzeros 400 --run_length $rl --output_format UNC - # python ${SRC_PATH}/generate_runs.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/compressed/ --output_format CSF --run_lengths 100 200 - # python ${SRC_PATH}/generate_runs.py --seed 0 --output_dir ${SYNTHETIC_PATH}/${vectype}/uncompressed/ --output_format UNC --run_lengths 100 200 - done - ;; - esac -done -popd - -# Now generate the matrices in both DCSR/DCSC formats -pushd $SYNTHETIC_PATH - -mkdir -p "${SYNTHETIC_PATH}/matrix/DCSR" -mkdir -p "${SYNTHETIC_PATH}/matrix/DCSC" -mkdir -p "${SYNTHETIC_PATH}/matrix/DENSE" - -i=250 -j=250 -k=100 - -sparsity="0.95" - -python ${SRC_PATH}/generate_random_mats.py --seed 0 --sparsity $sparsity --output_dir ${SYNTHETIC_PATH}/matrix/DCSR/ --name B --shape $i $k --output_format CSF -python ${SRC_PATH}/generate_random_mats.py --seed 0 --sparsity $sparsity --output_dir ${SYNTHETIC_PATH}/matrix/DCSC/ --name B --shape $i $k --output_format CSF --transpose -python ${SRC_PATH}/generate_random_mats.py --seed 0 --sparsity $sparsity --output_dir ${SYNTHETIC_PATH}/matrix/DENSE/ --name B --shape $i $k --output_format UNC - -python ${SRC_PATH}/generate_random_mats.py --seed 1 --sparsity $sparsity --output_dir ${SYNTHETIC_PATH}/matrix/DCSR/ --name C --shape $k $j --output_format CSF -python ${SRC_PATH}/generate_random_mats.py --seed 1 --sparsity $sparsity --output_dir ${SYNTHETIC_PATH}/matrix/DCSC/ --name C --shape $k $j --output_format CSF --transpose -python ${SRC_PATH}/generate_random_mats.py --seed 1 --sparsity $sparsity --output_dir ${SYNTHETIC_PATH}/matrix/DENSE/ --name C --shape $k $j --output_format UNC - -popd \ No newline at end of file diff --git a/scripts/get_data/README.md b/scripts/get_data/README.md new file mode 100644 index 00000000..116f1ae1 --- /dev/null +++ b/scripts/get_data/README.md @@ -0,0 +1,11 @@ +# Get Data + +The `scripts/get_data` folder contains scripts used to download and unpack +datasets (SuiteSparse matrices and FROSTT tensors) + +1. `download_frostt.sh` - Download and unpack FROSTT tns files into + `$FROSTT_PATH` +2. `download_suitesparse.sh` - Download SuiteSparse mtx files into + `$SUITESPARSE_PATH` +3. `unpack_suitesparse.sh` - Unpack SuiteSparse mtx files in `$SUITESPARSE_PATH` based on a file +4. `unpack_suitesparse_all.sh` - Unpack SuiteSparse mtx files in `$SUITESPARSE_PATH` for all `*.tar.gz` files that exist diff --git a/scripts/download_frostt.sh b/scripts/get_data/download_frostt.sh similarity index 95% rename from scripts/download_frostt.sh rename to scripts/get_data/download_frostt.sh index bcdda91f..0f5e57fb 100755 --- a/scripts/download_frostt.sh +++ b/scripts/get_data/download_frostt.sh @@ -3,6 +3,8 @@ #SBATCH -t 360 #SBATCH -p lanka-v3 +# Command: ./scripts/get_data/download_frostt.sh + set -e TENSOR_NAMES=( @@ -37,7 +39,7 @@ TENSOR_URLS=( "https://s3.us-east-2.amazonaws.com/frostt/frostt_data/vast-2015-mc1/vast-2015-mc1-5d.tns.gz" ) -outdir=/data/scratch/owhsu/datasets/frostt +outdir=$FROSTT_PATH mkdir -p $outdir diff --git a/scripts/download_suitesparse.sh b/scripts/get_data/download_suitesparse.sh similarity index 99% rename from scripts/download_suitesparse.sh rename to scripts/get_data/download_suitesparse.sh index e07b7d0c..5f1d1f6b 100755 --- a/scripts/download_suitesparse.sh +++ b/scripts/get_data/download_suitesparse.sh @@ -2,7 +2,9 @@ #SBATCH -N 1 #SBATCH -t 360 -outdir=/nobackup/owhsu/sparse-datasets/suitesparse +# Command: ./scripts/get_data/download_suitesparse.sh + +outdir=$SUITESPARSE_PATH mkdir -p $outdir cd $outdir diff --git a/scripts/generate_synthetics.sh b/scripts/get_data/generate_synthetics.sh similarity index 100% rename from scripts/generate_synthetics.sh rename to scripts/get_data/generate_synthetics.sh diff --git a/scripts/unpack_suitesparse.sh b/scripts/get_data/unpack_suitesparse.sh similarity index 81% rename from scripts/unpack_suitesparse.sh rename to scripts/get_data/unpack_suitesparse.sh index 1f91628e..1e089784 100755 --- a/scripts/unpack_suitesparse.sh +++ b/scripts/get_data/unpack_suitesparse.sh @@ -2,6 +2,8 @@ #SBATCH -N 1 #SBATCH -t 360 +# Command: ./scripts/get_data/unpack_suitesparse.sh + pushd . cd $SUITESPARSE_PATH diff --git a/scripts/unpack_suitesparse_all.sh b/scripts/get_data/unpack_suitesparse_all.sh similarity index 79% rename from scripts/unpack_suitesparse_all.sh rename to scripts/get_data/unpack_suitesparse_all.sh index 3e5e06f1..64030d31 100644 --- a/scripts/unpack_suitesparse_all.sh +++ b/scripts/get_data/unpack_suitesparse_all.sh @@ -2,6 +2,8 @@ #SBATCH -N 1 #SBATCH -t 360 +# Command: ./scripts/get_data/unpack_suitesparse_all.sh + cd $SUITESPARSE_PATH for f in *.tar.gz; do diff --git a/scripts/frostt_runner.sh b/scripts/run_cpu/frostt_runner.sh similarity index 100% rename from scripts/frostt_runner.sh rename to scripts/run_cpu/frostt_runner.sh diff --git a/scripts/suitesparse_runner.sh b/scripts/run_cpu/suitesparse_runner.sh similarity index 100% rename from scripts/suitesparse_runner.sh rename to scripts/run_cpu/suitesparse_runner.sh diff --git a/scripts/sam_hw_suitesparse_runner.sh b/scripts/run_onyx/sam_hw_suitesparse_runner.sh similarity index 100% rename from scripts/sam_hw_suitesparse_runner.sh rename to scripts/run_onyx/sam_hw_suitesparse_runner.sh diff --git a/scripts/run_sam_sim/README.md b/scripts/run_sam_sim/README.md new file mode 100644 index 00000000..5aaa119c --- /dev/null +++ b/scripts/run_sam_sim/README.md @@ -0,0 +1,14 @@ +# Scripts to Run SAM Simulations + +All scripts should ultimately run pytest to test the SAM +simulator applications + +the `scripts/run_sam_sim/` folder contains scripts that run the sam simulator for the following datasets: +1. SuiteSparse +2. FROSTT +3. Synthetically generated data + +There are three types of scripts: +1. +2. +3. diff --git a/scripts/pytest_frostt.sh b/scripts/run_sam_sim/pytest_frostt.sh similarity index 100% rename from scripts/pytest_frostt.sh rename to scripts/run_sam_sim/pytest_frostt.sh diff --git a/scripts/pytest_frostt_with_benchmarks.sh b/scripts/run_sam_sim/pytest_frostt_with_benchmarks.sh similarity index 100% rename from scripts/pytest_frostt_with_benchmarks.sh rename to scripts/run_sam_sim/pytest_frostt_with_benchmarks.sh diff --git a/scripts/pytest_suitesparse.sh b/scripts/run_sam_sim/pytest_suitesparse.sh similarity index 100% rename from scripts/pytest_suitesparse.sh rename to scripts/run_sam_sim/pytest_suitesparse.sh diff --git a/scripts/pytest_suitesparse_with_benchmarks.sh b/scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh similarity index 100% rename from scripts/pytest_suitesparse_with_benchmarks.sh rename to scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh diff --git a/scripts/run_suitesparse.sh b/scripts/run_sam_sim/run_suitesparse.sh similarity index 87% rename from scripts/run_suitesparse.sh rename to scripts/run_sam_sim/run_suitesparse.sh index 43cc9fb0..cb7918ed 100755 --- a/scripts/run_suitesparse.sh +++ b/scripts/run_sam_sim/run_suitesparse.sh @@ -2,6 +2,9 @@ #SBATCH -N 1 #SBATCH -t 360 +# 1. Formats input files +# 2. Runs suitesparse sam sims in pytest + # THIS FILE MUST BE RUN FROM sam/ location outdir=/nobackup/owhsu/sparse-datasets/suitesparse-formatted basedir=$(pwd) @@ -33,7 +36,7 @@ for i in ${!DATASET_NAMES[@]}; do cd $outdir echo "Generating input format files for $name..." - python $basedir/scripts/datastructure_suitesparse.py -n $name + python $basedir/scripts/formatting/datastructure_suitesparse.py -n $name chgrp -R sparsity $outdir chmod -R 777 $outdir diff --git a/scripts/run_sam_sim/run_suitesparse_final.sh b/scripts/run_sam_sim/run_suitesparse_final.sh new file mode 100755 index 00000000..886e58b5 --- /dev/null +++ b/scripts/run_sam_sim/run_suitesparse_final.sh @@ -0,0 +1,14 @@ +#!/bin/bash +#SBATCH -N 1 +#SBATCH --mem 120000 +#SBATCH -p lanka-v3 +#SBATCH --exclusive + +pushd . +cd sam/sim + +while read line; do + pytest test/final-apps/ --ssname $line --check-gold +done < $1 + +popd diff --git a/scripts/run_sam_sim/run_suitesparse_generated.sh b/scripts/run_sam_sim/run_suitesparse_generated.sh new file mode 100755 index 00000000..4f361850 --- /dev/null +++ b/scripts/run_sam_sim/run_suitesparse_generated.sh @@ -0,0 +1,16 @@ +#!/bin/bash +#SBATCH -N 1 +#SBATCH --mem 120000 +#SBATCH -p lanka-v3 +#SBATCH --exclusive + +pushd . +cd sam/sim + +echo $1 + +while read line; do + pytest test/apps/ --ssname $line --check-gold +done < $1 + +popd diff --git a/scripts/run_synthetics.sh b/scripts/run_sam_sim/run_synthetics.sh similarity index 94% rename from scripts/run_synthetics.sh rename to scripts/run_sam_sim/run_synthetics.sh index 35004921..4b6a1c47 100755 --- a/scripts/run_synthetics.sh +++ b/scripts/run_sam_sim/run_synthetics.sh @@ -2,6 +2,9 @@ #SBATCH -N 1 #SBATCH -t 360 +# Req: Need to run this after synthetic/ is generated +# 1. Runs all of the synthetic tests from the ASPLOS 2023 SAM paper + # Vars if [ -z "$2" ] then diff --git a/scripts/sam_frostt_runner.sh b/scripts/run_sam_sim/sam_frostt_runner.sh similarity index 96% rename from scripts/sam_frostt_runner.sh rename to scripts/run_sam_sim/sam_frostt_runner.sh index 2e48dc40..8df824cd 100644 --- a/scripts/sam_frostt_runner.sh +++ b/scripts/run_sam_sim/sam_frostt_runner.sh @@ -4,6 +4,12 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# Script steps +# 1. Formats data +# 2. Runs SAM sim in Pytest +# 3. Converts data to CSV +# 4. Aggregates CSV + set -u BENCHMARKS=( diff --git a/scripts/sam_suitesparse_runner.sh b/scripts/run_sam_sim/sam_suitesparse_runner.sh similarity index 100% rename from scripts/sam_suitesparse_runner.sh rename to scripts/run_sam_sim/sam_suitesparse_runner.sh diff --git a/scripts/sam_suitesparse_runner_sddmmonly.sh b/scripts/run_sam_sim/sam_suitesparse_runner_sddmmonly.sh similarity index 100% rename from scripts/sam_suitesparse_runner_sddmmonly.sh rename to scripts/run_sam_sim/sam_suitesparse_runner_sddmmonly.sh diff --git a/scripts/suitesparse_validator.sh b/scripts/run_sam_sim/suitesparse_validator.sh similarity index 100% rename from scripts/suitesparse_validator.sh rename to scripts/run_sam_sim/suitesparse_validator.sh diff --git a/scripts/get_tensor_arrlen.py b/scripts/stats/get_tensor_arrlen.py similarity index 97% rename from scripts/get_tensor_arrlen.py rename to scripts/stats/get_tensor_arrlen.py index f914198d..4b5b91fc 100644 --- a/scripts/get_tensor_arrlen.py +++ b/scripts/stats/get_tensor_arrlen.py @@ -2,6 +2,7 @@ import os import csv +# This is using the old CSF file types def write_csv(path, outpath): with open(outpath, 'w+', newline='') as outcsv: diff --git a/scripts/ss_stats.sh b/scripts/stats/ss_stats.sh similarity index 100% rename from scripts/ss_stats.sh rename to scripts/stats/ss_stats.sh diff --git a/scripts/suitesparse_stats.py b/scripts/stats/suitesparse_stats.py similarity index 100% rename from scripts/suitesparse_stats.py rename to scripts/stats/suitesparse_stats.py diff --git a/scripts/tensor_names/README.md b/scripts/tensor_names/README.md new file mode 100644 index 00000000..8cf69143 --- /dev/null +++ b/scripts/tensor_names/README.md @@ -0,0 +1,19 @@ +# Tensor Names + +the `scripts/tensor_names` folder contains text files with lists of SuiteSparse matrix +names that are used for different scenarios + +The scripts in this folder are: +1. `suitesparse.txt` - All (ANY type) suitesparse matrices (alphabetical order) +2. `suitesparse_ci.txt` - All suitesparse matrices that are in the `sam/data/` folder in the SAM repo for CI purposes +3. `suitesparse_real.txt` - All real suitesparse matrices (alphabetical order) +4. `suitesparse_valid.txt` - All REAL and INTEGER suitesparse matrices that fit + in memory on LANKA (MIT) for at least ONE test from the original SAM paper + passed (unordered) +5. `suitesparse_valid_all.txt` - All real and integer suitesparse matrices that + fit in memory on LANKA (MIT) for ALL tests from the original SAM paper + (ordered by dense dimension) +6. `suitesparse_valid_large50.txt` - The largest 50 (by dense dimension) suitesparse matrices that passed ALL tests from the original SAM paper +7. `suitesparse_valid_mid50.txt` - The median 50 (by dense dimension) suitesparse matrices that passed ALL tests from the original SAM paper +8. `suitesparse_valid_small50.txt` - The smallest 50 (by dense dimension) suitesparse matrices that passed ALL tests from the original SAM paper +9. `temp_*.txt` - `suitesparse_valid.txt` split into various files for running tests in parallel diff --git a/scripts/divvy_runs.py b/scripts/tensor_names/divvy_runs.py similarity index 100% rename from scripts/divvy_runs.py rename to scripts/tensor_names/divvy_runs.py diff --git a/scripts/advanced_simulator_runner.sh b/scripts/tiling/advanced_simulator_runner.sh similarity index 95% rename from scripts/advanced_simulator_runner.sh rename to scripts/tiling/advanced_simulator_runner.sh index 397342fc..e7d772a0 100755 --- a/scripts/advanced_simulator_runner.sh +++ b/scripts/tiling/advanced_simulator_runner.sh @@ -117,10 +117,10 @@ for b in ${!BENCHMARKS[@]}; do if [ "$bench" == "matmul_ikj" ]; then echo "Generating input format files for $line..." - SUITESPARSE_TENSOR_PATH=$matrix python $basedir/scripts/datastructure_suitesparse.py -n $line + SUITESPARSE_TENSOR_PATH=$matrix python $basedir/scripts/formatting/datastructure_suitesparse.py -n $line SUITESPARSE_TENSOR_PATH=$matrix $basedir/compiler/taco/build/bin/taco-test sam.pack_other_ss - python $basedir/scripts/datastructure_frostt.py -n $line -f ss01 --other -ss + python $basedir/scripts/formatting/datastructure_frostt.py -n $line -f ss01 --other -ss fi cd $basedir/sam/sim diff --git a/scripts/clean_memory_model.sh b/scripts/tiling/clean_memory_model.sh similarity index 100% rename from scripts/clean_memory_model.sh rename to scripts/tiling/clean_memory_model.sh diff --git a/scripts/ext_runner.sh b/scripts/tiling/ext_runner.sh similarity index 100% rename from scripts/ext_runner.sh rename to scripts/tiling/ext_runner.sh diff --git a/scripts/few_points_memory_model_runner.sh b/scripts/tiling/few_points_memory_model_runner.sh similarity index 100% rename from scripts/few_points_memory_model_runner.sh rename to scripts/tiling/few_points_memory_model_runner.sh diff --git a/scripts/full_ext_runner.sh b/scripts/tiling/full_ext_runner.sh similarity index 100% rename from scripts/full_ext_runner.sh rename to scripts/tiling/full_ext_runner.sh diff --git a/scripts/full_memory_model_runner.sh b/scripts/tiling/full_memory_model_runner.sh similarity index 100% rename from scripts/full_memory_model_runner.sh rename to scripts/tiling/full_memory_model_runner.sh diff --git a/scripts/generate_gold_matmul_tiled.py b/scripts/tiling/generate_gold_matmul_tiled.py similarity index 100% rename from scripts/generate_gold_matmul_tiled.py rename to scripts/tiling/generate_gold_matmul_tiled.py diff --git a/scripts/generate_sparsity_sweep_mem_model.sh b/scripts/tiling/generate_sparsity_sweep_mem_model.sh similarity index 100% rename from scripts/generate_sparsity_sweep_mem_model.sh rename to scripts/tiling/generate_sparsity_sweep_mem_model.sh diff --git a/scripts/prepare_files.sh b/scripts/tiling/prepare_files.sh similarity index 100% rename from scripts/prepare_files.sh rename to scripts/tiling/prepare_files.sh diff --git a/scripts/prepare_files_no_gold.sh b/scripts/tiling/prepare_files_no_gold.sh similarity index 100% rename from scripts/prepare_files_no_gold.sh rename to scripts/tiling/prepare_files_no_gold.sh diff --git a/scripts/single_point_memory_model_runner.sh b/scripts/tiling/single_point_memory_model_runner.sh similarity index 100% rename from scripts/single_point_memory_model_runner.sh rename to scripts/tiling/single_point_memory_model_runner.sh diff --git a/scripts/tile.sh b/scripts/tiling/tile.sh similarity index 100% rename from scripts/tile.sh rename to scripts/tiling/tile.sh diff --git a/scripts/tile_ext.sh b/scripts/tiling/tile_ext.sh similarity index 100% rename from scripts/tile_ext.sh rename to scripts/tiling/tile_ext.sh diff --git a/scripts/util/README.md b/scripts/util/README.md new file mode 100644 index 00000000..cbad7835 --- /dev/null +++ b/scripts/util/README.md @@ -0,0 +1,10 @@ +# Utilities + +The `scripts/util` folder contains util.py (shared utility functions) and +shared utility scripts used to aggregate and format csv data. + +1. `util.py` - +2. `bench_csv_aggregator.py` - Script that aggregates all of the output CSVs. + This is useful since CPU tests are run using googlebench potentially one + tensor at a time (to run tests in parallel), which will produce one CSV per tensor. +3. `converter.py` - Converts JSON to CSV. diff --git a/scripts/bench_csv_aggregator.py b/scripts/util/bench_csv_aggregator.py similarity index 100% rename from scripts/bench_csv_aggregator.py rename to scripts/util/bench_csv_aggregator.py diff --git a/scripts/converter.py b/scripts/util/converter.py similarity index 100% rename from scripts/converter.py rename to scripts/util/converter.py diff --git a/scripts/util.py b/scripts/util/util.py similarity index 100% rename from scripts/util.py rename to scripts/util/util.py From 8fb90661bf398df0af314502400f3b3874df430d Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Thu, 29 Jun 2023 15:54:23 -0700 Subject: [PATCH 02/11] Fix codestyle for script refactor --- scripts/stats/get_tensor_arrlen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/stats/get_tensor_arrlen.py b/scripts/stats/get_tensor_arrlen.py index 4b5b91fc..897738b2 100644 --- a/scripts/stats/get_tensor_arrlen.py +++ b/scripts/stats/get_tensor_arrlen.py @@ -2,8 +2,8 @@ import os import csv -# This is using the old CSF file types +# This is using the old CSF file types def write_csv(path, outpath): with open(outpath, 'w+', newline='') as outcsv: writer = csv.writer(outcsv) From d22c73fa8e7ee8e920b2e74b83d605abc82ffe67 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Thu, 29 Jun 2023 16:06:28 -0700 Subject: [PATCH 03/11] Fix makefile with updated script locations --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0a4882a9..d0e29ccb 100644 --- a/Makefile +++ b/Makefile @@ -57,16 +57,16 @@ guard-%: # ---- Run SAM python simulator stuff ---- csv: - scripts/pytest_suitesparse_with_benchmarks.sh + scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh run-final: submodules - ./scripts/run_suitesparse_final.sh $(realpath ./scripts/tensor_names/$(TENSOR_TXT)) + ./scripts/run_sam_sim/run_suitesparse_final.sh $(realpath ./scripts/tensor_names/$(TENSOR_TXT)) run-gen: submodules - ./scripts/run_suitesparse_generated.sh $(realpath ./scripts/tensor_names/$(TENSOR_TXT)) + ./scripts/run_sam_sim/run_suitesparse_generated.sh $(realpath ./scripts/tensor_names/$(TENSOR_TXT)) tests: sam mkdir -p sam/sim/test/apps - python scripts/test_generating_code.py + python scripts/gen_sam_apps/test_generating_code.py # ---- Build taco and make sam graphs ---- .PHONY: sam @@ -109,10 +109,10 @@ endif # ---- Setup proper environment stuff ---- suitesparse-formats: guard-SUITESPARSE_FORMATTED_PATH guard-SUITESPARSE_PATH rm -rf ${SUITESPARSE_FORMATTED_PATH}/* - set -e && ./scripts/generate_suitesparse_formats.sh + set -e && ./scripts/formatting/generate_suitesparse_formats.sh frostt-formats: taco/build guard-FROSTT_FORMATTED_PATH guard-FROSTT_PATH - ./scripts/generate_frostt_formats.sh + ./scripts/formatting/generate_frostt_formats.sh .PHONY: env env: From 6aa012294234e0853f917df5784c00850cf7cdf1 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Thu, 29 Jun 2023 16:15:25 -0700 Subject: [PATCH 04/11] Add in README for scripts/ dir --- scripts/README.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index b004db54..561b5f0a 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,4 +1,23 @@ +# SAM Scripts + ---------------------------------- -| File Name | Usage | Description | +| Folder Name | Description | ----------------------------------- -| +| `artifact/` | Scripts used solely for The Sparse Abstract Machine ASPLOS 2023 AE | +| `formatting/` | Scripts used to format tensors from .mtx or .tns to other compressed formats | +| `gen_sam_apps/` | Scripts used to generate SAM apps from the compiler | +| `get_data/` | Scripts used to download and unpack datasets | +| `logs/` | Saved log files | +| `run_cpu/` | Scripts used to run the CPU baseline code | +| `run_onyx/` | Scripts used to run Onyx simulations | +| `run_sam_sim/` | Scripts used to run SAM simulations via Pytest | +| `stats/` | Scripts used to compute statistics on data (for DSE/development) | +| `tensor_names` | Scripts and files that have all the dataset tensor names | +| `tiling/` | Scripts used to generate, run, and check tiled simulations | +| `util/` | Utility code used by scripts under the `scripts/` directory | +----------------------------------- + + +Each folder has a README with a description of the corresponding scripts in +that directory. Also For each individual script, see the first line comment for how +to run the command. From 6448e0a4bea120a7de60e5919bea984c699a9e1a Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Fri, 30 Jun 2023 11:19:32 -0700 Subject: [PATCH 05/11] Update READMe for run_cpu directory --- scripts/formatting/README.md | 1 - scripts/run_cpu/README.md | 6 ++++++ scripts/run_cpu/frostt_runner.sh | 2 ++ scripts/run_cpu/suitesparse_runner.sh | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 scripts/run_cpu/README.md diff --git a/scripts/formatting/README.md b/scripts/formatting/README.md index 06d3241b..a78f55dc 100644 --- a/scripts/formatting/README.md +++ b/scripts/formatting/README.md @@ -4,7 +4,6 @@ The `scripts/formatting/` folder contains scripts used to format the datasets fr 1. `datastructure_suitesparse.py` - Python script used by `generate_suitesparse_formats.sh` to format from mtx to CSF files. - - 2. `datastructure_tns.py` - Python script used by `generate_frostt_formats.sh` to format from tns to CSF files. 3. `download_unpack_format_suitesparse.sh` - Script that downloads, unpacks, diff --git a/scripts/run_cpu/README.md b/scripts/run_cpu/README.md new file mode 100644 index 00000000..9cdf8ae5 --- /dev/null +++ b/scripts/run_cpu/README.md @@ -0,0 +1,6 @@ +# CPU Baseline Scripts + +The `scripts/run_cpu/` folder contains scripts used to run the CPU baseline tests. These are needed to compare against SAM and/or HW generated using SAM (e.g. Onyx). + +1. `frostt_runner.sh` - Script that runs the frostt tests in taco on the CPU +2. `suitesparse_runner.sh` - Script that runs the SuiteSparse tests in taco on the CPU diff --git a/scripts/run_cpu/frostt_runner.sh b/scripts/run_cpu/frostt_runner.sh index 9e68b46c..fda1153c 100755 --- a/scripts/run_cpu/frostt_runner.sh +++ b/scripts/run_cpu/frostt_runner.sh @@ -4,6 +4,8 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./frostt_runner.sh <0|1|2> +# where 0 us for local, 1 is for Lanka, and 2 is for Kiwi/Neva DATASET_NAMES=( fb1k diff --git a/scripts/run_cpu/suitesparse_runner.sh b/scripts/run_cpu/suitesparse_runner.sh index 33b95b6b..01b74bbe 100755 --- a/scripts/run_cpu/suitesparse_runner.sh +++ b/scripts/run_cpu/suitesparse_runner.sh @@ -4,6 +4,10 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./suitesparse_runner.sh <0|1|2> +# First argument - Textfile with names of suitesparse tensors to run +# Second argument - Which machine to run on + set -u cwd=$(pwd) From 257a74a9a94bbe736d04913b34e2adc5d25f880c Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Mon, 17 Jul 2023 16:44:38 -0700 Subject: [PATCH 06/11] Finish adding scripts/ hierarchy. Tried to add in all READMEs, comments, and fixed paths to get scripts running. --- .gitignore | 2 +- scripts/README.md | 30 +++-- .../formatting/datastructure_suitesparse.py | 2 +- scripts/formatting/datastructure_tns.py | 2 +- scripts/run_cpu/README.md | 10 +- scripts/run_cpu/frostt_runner.sh | 4 +- scripts/run_cpu/suitesparse_runner.sh | 6 +- scripts/run_onyx/README.md | 6 + scripts/run_onyx/sam_hw_suitesparse_runner.sh | 10 ++ scripts/run_sam_sim/README.md | 30 ++++- scripts/run_sam_sim/pytest_frostt.sh | 94 ++------------- .../pytest_frostt_with_benchmarks.sh | 26 ++-- scripts/run_sam_sim/pytest_suitesparse.sh | 83 ++----------- .../pytest_suitesparse_with_benchmarks.sh | 28 ++--- scripts/run_sam_sim/run_suitesparse.sh | 21 +--- scripts/run_sam_sim/run_suitesparse_final.sh | 2 + scripts/run_sam_sim/run_synthetics.sh | 29 +++-- scripts/run_sam_sim/sam_frostt_runner.sh | 62 ++-------- scripts/run_sam_sim/sam_suitesparse_runner.sh | 50 ++------ .../sam_suitesparse_runner_sddmmonly.sh | 113 ------------------ scripts/run_sam_sim/suitesparse_validator.sh | 14 ++- scripts/stats/README.md | 8 ++ scripts/stats/get_tensor_arrlen.py | 3 +- scripts/stats/ss_stats.sh | 9 -- scripts/stats/suitesparse_stats.py | 2 +- scripts/stats/suitesparse_stats.sh | 9 ++ scripts/tiling/README.md | 33 +++++ scripts/tiling/advanced_simulator_runner.sh | 63 ++-------- scripts/tiling/clean_memory_model.sh | 0 scripts/tiling/ext_runner.sh | 9 +- .../tiling/few_points_memory_model_runner.sh | 11 +- scripts/tiling/full_ext_runner.sh | 5 +- scripts/tiling/full_memory_model_runner.sh | 12 +- scripts/tiling/generate_gold_matmul_tiled.py | 13 +- .../generate_sparsity_sweep_mem_model.sh | 2 + scripts/tiling/prepare_files.sh | 7 +- scripts/tiling/prepare_files_no_gold.sh | 6 +- .../single_point_memory_model_runner.sh | 8 +- scripts/tiling/tile.sh | 4 +- scripts/tiling/tile_ext.sh | 14 ++- scripts/util/README.md | 2 +- scripts/util/__init__.py | 0 42 files changed, 267 insertions(+), 577 deletions(-) create mode 100644 scripts/run_onyx/README.md mode change 100644 => 100755 scripts/run_sam_sim/sam_frostt_runner.sh delete mode 100644 scripts/run_sam_sim/sam_suitesparse_runner_sddmmonly.sh create mode 100644 scripts/stats/README.md delete mode 100755 scripts/stats/ss_stats.sh create mode 100755 scripts/stats/suitesparse_stats.sh create mode 100644 scripts/tiling/README.md mode change 100644 => 100755 scripts/tiling/clean_memory_model.sh create mode 100644 scripts/util/__init__.py diff --git a/.gitignore b/.gitignore index 3c716691..a69400ea 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ build/ logs/ results/ results-cpu/ -suitesparse-bench/ +suitesparse-bench*/ sam-outputs/ compiler/benchmark/ diff --git a/scripts/README.md b/scripts/README.md index 561b5f0a..1207da54 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,21 +1,19 @@ # SAM Scripts ----------------------------------- -| Folder Name | Description | ------------------------------------ -| `artifact/` | Scripts used solely for The Sparse Abstract Machine ASPLOS 2023 AE | -| `formatting/` | Scripts used to format tensors from .mtx or .tns to other compressed formats | -| `gen_sam_apps/` | Scripts used to generate SAM apps from the compiler | -| `get_data/` | Scripts used to download and unpack datasets | -| `logs/` | Saved log files | -| `run_cpu/` | Scripts used to run the CPU baseline code | -| `run_onyx/` | Scripts used to run Onyx simulations | -| `run_sam_sim/` | Scripts used to run SAM simulations via Pytest | -| `stats/` | Scripts used to compute statistics on data (for DSE/development) | -| `tensor_names` | Scripts and files that have all the dataset tensor names | -| `tiling/` | Scripts used to generate, run, and check tiled simulations | -| `util/` | Utility code used by scripts under the `scripts/` directory | ------------------------------------ +| Folder Name | Description | +| ------------ | ----------------------- | +| `artifact/` | Scripts used solely for The Sparse Abstract Machine ASPLOS 2023 AE | +| `formatting/` | Scripts used to format tensors from .mtx or .tns to other compressed formats | +| `gen_sam_apps/` | Scripts used to generate SAM apps from the compiler | +| `get_data/` | Scripts used to download and unpack datasets | +| `logs/` | Saved log files | +| `run_cpu/` | Scripts used to run the CPU baseline code | +| `run_onyx/` | Scripts used to run Onyx simulations | +| `run_sam_sim/` | Scripts used to run SAM simulations via Pytest | +| `stats/` | Scripts used to compute statistics on data (for DSE/development) | +| `tensor_names` | Scripts and files that have all the dataset tensor names | +| `tiling/` | Scripts used to generate, run, and check tiled simulations | +| `util/` | Utility code used by scripts under the `scripts/` directory | Each folder has a README with a description of the corresponding scripts in diff --git a/scripts/formatting/datastructure_suitesparse.py b/scripts/formatting/datastructure_suitesparse.py index cb24ec39..502a8822 100644 --- a/scripts/formatting/datastructure_suitesparse.py +++ b/scripts/formatting/datastructure_suitesparse.py @@ -6,7 +6,7 @@ from pathlib import Path -from util import FormatWriter, SuiteSparseTensor, InputCacheSuiteSparse +from scripts.util.util import FormatWriter, SuiteSparseTensor, InputCacheSuiteSparse from sam.util import SUITESPARSE_FORMATTED_PATH, ScipyTensorShifter all_formats = ["coo", "cooT", "csr", "dcsr", "dcsc", "csc", "dense", "denseT"] diff --git a/scripts/formatting/datastructure_tns.py b/scripts/formatting/datastructure_tns.py index ccf60fae..aede2dbc 100644 --- a/scripts/formatting/datastructure_tns.py +++ b/scripts/formatting/datastructure_tns.py @@ -1,7 +1,7 @@ import argparse import os from pathlib import Path -from util import parse_taco_format +from sam.util import parse_taco_format cwd = os.getcwd() diff --git a/scripts/run_cpu/README.md b/scripts/run_cpu/README.md index 9cdf8ae5..2b05a73e 100644 --- a/scripts/run_cpu/README.md +++ b/scripts/run_cpu/README.md @@ -1,6 +1,10 @@ # CPU Baseline Scripts -The `scripts/run_cpu/` folder contains scripts used to run the CPU baseline tests. These are needed to compare against SAM and/or HW generated using SAM (e.g. Onyx). +The `scripts/run_cpu/` folder contains scripts used to run +the CPU baseline tests. These are needed to compare +against SAM and/or HW generated using SAM (e.g. Onyx). -1. `frostt_runner.sh` - Script that runs the frostt tests in taco on the CPU -2. `suitesparse_runner.sh` - Script that runs the SuiteSparse tests in taco on the CPU +1. `frostt_runner.sh` - Script that runs the frostt tests + in taco on the CPU +2. `suitesparse_runner.sh` - Script that runs the + SuiteSparse tests in taco on the CPU diff --git a/scripts/run_cpu/frostt_runner.sh b/scripts/run_cpu/frostt_runner.sh index fda1153c..e8d6dfac 100755 --- a/scripts/run_cpu/frostt_runner.sh +++ b/scripts/run_cpu/frostt_runner.sh @@ -4,8 +4,8 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive -# ./frostt_runner.sh <0|1|2> -# where 0 us for local, 1 is for Lanka, and 2 is for Kiwi/Neva +# ./frostt_runner.sh +# Arg1 - Which machine is being used (0:local, 1:Lanka, 2:Kiwi/Neva) DATASET_NAMES=( fb1k diff --git a/scripts/run_cpu/suitesparse_runner.sh b/scripts/run_cpu/suitesparse_runner.sh index 01b74bbe..3bcc864f 100755 --- a/scripts/run_cpu/suitesparse_runner.sh +++ b/scripts/run_cpu/suitesparse_runner.sh @@ -4,9 +4,9 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive -# ./suitesparse_runner.sh <0|1|2> -# First argument - Textfile with names of suitesparse tensors to run -# Second argument - Which machine to run on +# ./suitesparse_runner.sh +# Arg1 - Textfile with names of suitesparse tensors to run +# Arg2 - Which machine is being used (0:local, 1:Lanka, 2:Kiwi/Neva) set -u diff --git a/scripts/run_onyx/README.md b/scripts/run_onyx/README.md new file mode 100644 index 00000000..82634ba8 --- /dev/null +++ b/scripts/run_onyx/README.md @@ -0,0 +1,6 @@ +# Onyx Scripts + +The `scripts/run_onyx/` folder contains scripts used to +run Onyx test benches from the [`aha/`](https://github.com/StanfordAHA/aha) flow. + +1. `sam_hw_suitesparse_runner.sh` - Script that runs the SuiteSparse tests in Onyx (from the aha repository). diff --git a/scripts/run_onyx/sam_hw_suitesparse_runner.sh b/scripts/run_onyx/sam_hw_suitesparse_runner.sh index 22a731f8..e9748bf1 100755 --- a/scripts/run_onyx/sam_hw_suitesparse_runner.sh +++ b/scripts/run_onyx/sam_hw_suitesparse_runner.sh @@ -4,6 +4,16 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# This should be run from the sam/ directory + +# ./sam_hw_suitesparse_runner.sh +# Arg1 - File with the SuiteSparse matrices to run +# Arg2 - Which machine is being used (0:local, 1:Lanka, 2:Kiwi/Neva) + +# This script: +# 1. Formats teh matrices +# 2. Then runs build_tb in garnet + set -u BENCHMARKS=( diff --git a/scripts/run_sam_sim/README.md b/scripts/run_sam_sim/README.md index 5aaa119c..2331a759 100644 --- a/scripts/run_sam_sim/README.md +++ b/scripts/run_sam_sim/README.md @@ -8,7 +8,29 @@ the `scripts/run_sam_sim/` folder contains scripts that run the sam simulator fo 2. FROSTT 3. Synthetically generated data -There are three types of scripts: -1. -2. -3. +1. `pytest_frostt.sh` - Script that runs ALL pytest tests beginning with the + name `test_tensor*` under `sam/sim/test/` with the FROSTT tensors. +2. `pytest_frostt_with_benchmarks.sh` - Script that runs only select pytest + benchmarks under `sam/sim/test/` with the FROSTT tensors. +3. `pytest_suitesparse.sh` - Script that runs ALL pytest tests in + `sam/sim/test/final-apps` with gold checking enabled for the SuiteSparse +matrices provided in `tensor_names.txt`. +4. `pytest_suitesparse_with_benchmarks.sh` - Script that runs runs select + SuiteSparse pytest benchmarks under `sam/sim/test/apps/`. This script has gold checking +disabled and aggregates results into a CSVs. +5. `run_suitesparse_final.sh` - Script that runs ALL SuiteSparse final tests in + `sam/sim/test/final-apps/` +6. `run_suitesparse_generated.sh` - Script that runs ALL SuiteSparse generated tests in + `sam/sim/test/apps/` +7. `run_suitesparse.sh` - Script that formats input SuiteSparse matrices and then runs + pytest on all SuiteSparse benchmarks in `sam/sim/test/apps` +8. `run_synthetics.sh` - Script that runs all of the synthetic benchmarks from + the ASPLOS 2023 SAM paper. +9. `sam_frostt_runner.sh` - Script that formats, runs, and generates CSVs for + all frostt benchmarks. +10. `sam_suitesparse_runner.sh` - Script that formats, runs, and generates CSVs + for all SuiteSparse benchmarks in `final-apps`. +11. `sam_suitesparse_runner_sddmmonly.sh` - Script that formats, runs, and + generates CSVs for the `final-apps` SDDMM SuiteSparse benchmark only. +12. `suitesparse_validator.sh` - Script that runs the CPU benchmarks and then + the SAM pytest benchmarks in `apps` on SuiteSparse data. diff --git a/scripts/run_sam_sim/pytest_frostt.sh b/scripts/run_sam_sim/pytest_frostt.sh index 39f4366d..ffc770a1 100755 --- a/scripts/run_sam_sim/pytest_frostt.sh +++ b/scripts/run_sam_sim/pytest_frostt.sh @@ -1,16 +1,13 @@ #!/bin/bash #SBATCH -N 1 #SBATCH -t 360 -outdir=/nobackup/owhsu/sparse-datasets/frostt-formatted -DATASET_NAMES=( - facebook - fb10k - fb1k - nell-1 - nell-2 - taco-tensor -) +# Run from sam/ repo +# ./scripts/run_sam_sim/pytest_frostt.sh + +# Script that runs ALL test_tensor* pytest tests under sam/sim/test + +outdir=/nobackup/owhsu/sparse-datasets/frostt-formatted errors=() RED='\033[0;31m' @@ -22,89 +19,18 @@ export FROSTT_FORMATTED_PATH=$outdir mkdir -p $outdir cd ./sam/sim -for i in ${!DATASET_NAMES[@]}; do - name=${DATASET_NAMES[$i]} +while read line; do + name=$line echo "Testing $name..." -# pytest -k test_mat_mul_ijk_csr_full_i --ssname $name -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk_full") -# fi - -# pytest -k test_mat_identity_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi pytest -k test_tensor --frosttname $name -s -vv #--debug-sim status=$? if [ $status -gt 0 ] then - errors+=("${name} matmul_ijk") + errors+=("${name} test") fi - - -# -# pytest -k test_matmul_ijk_i --ssname $name -s #--debug-sim -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - -# pytest -k test_mat_elemmul_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - - -# pytest -k test_tensor3_elemmul_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - -# pytest -k test_matmul_jik_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - -# pytest -k test_matmul_jki_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - - - - -# pytest -k test_mat_identity_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} mat_identity") -# fi - -# pytest -k test_mat_elemmul_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} mat_identity") -# fi - - - -done +done <$1 echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/run_sam_sim/pytest_frostt_with_benchmarks.sh b/scripts/run_sam_sim/pytest_frostt_with_benchmarks.sh index 0ba9774d..da73cbb8 100755 --- a/scripts/run_sam_sim/pytest_frostt_with_benchmarks.sh +++ b/scripts/run_sam_sim/pytest_frostt_with_benchmarks.sh @@ -2,6 +2,7 @@ #SBATCH -N 1 #SBATCH -t 360 +# ./scripts/run_sam_sim/pytest_frostt_with_benchmarks.sh BENCHMARKS=( tensor3_elemmul @@ -13,15 +14,6 @@ BENCHMARKS=( tensor_mttkrp ) -DATASET_NAMES=( - facebook - fb10k - fb1k - nell-1 - nell-2 - taco-tensor -) - outdir=/nobackup/owhsu/sparse-datasets/frostt-formatted export FROSTT_PATH=/nobackup/owhsu/sparse-datasets/frostt @@ -33,7 +25,7 @@ RED='\033[0;31m' NC='\033[0m' # No Color -cwd=$(pwd) +basedir=$(pwd) resultdir=results @@ -41,27 +33,27 @@ cd ./sam/sim for b in ${!BENCHMARKS[@]}; do bench=${BENCHMARKS[$b]} - path=$cwd/$resultdir/$bench + path=$basedir/$resultdir/$bench - mkdir -p $cwd/$resultdir/$bench + mkdir -p $basedir/$resultdir/$bench echo "Testing $bench..." - for i in ${!DATASET_NAMES[@]}; do - name=${DATASET_NAMES[$i]} + while read line; do + name=$line echo "Testing $name..." pytest test/apps/test_$bench.py --ssname $name -s --benchmark-json=$path/$name.json - python $cwd/scripts/converter.py --json_name $path/$name.json + python $basedir/scripts/util/converter.py --json_name $path/$name.json status=$? if [ $status -gt 0 ] then errors+=("${name}, ${bench}") fi - done + done <$1 - python $cwd/scripts/bench_csv_aggregator.py $path $cwd/suitesparse_$bench.csv + python $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/suitesparse_$bench.csv done diff --git a/scripts/run_sam_sim/pytest_suitesparse.sh b/scripts/run_sam_sim/pytest_suitesparse.sh index e040646c..1e440beb 100755 --- a/scripts/run_sam_sim/pytest_suitesparse.sh +++ b/scripts/run_sam_sim/pytest_suitesparse.sh @@ -1,22 +1,11 @@ #!/bin/bash #SBATCH -N 1 #SBATCH -t 360 -outdir=/nobackup/owhsu/sparse-datasets/suitesparse-formatted -DATASET_NAMES=( -# bcsstm04 - bcsstm02 - bcsstm03 - lpi_bgprtr - cage4 - klein-b1 - GD02_a - GD95_b - Hamrle1 - LF10 - lpi_itest2 - lp_scsd1 -) +# ./scripts/run_sam_sim/pytest_suitesparse.sh + + +outdir=$SUITESPARSE_FORMATTED_PATH errors=() RED='\033[0;31m' @@ -26,8 +15,8 @@ NC='\033[0m' # No Color mkdir -p $outdir cd ./sam/sim -for i in ${!DATASET_NAMES[@]}; do - name=${DATASET_NAMES[$i]} +while read line; do + name=$line echo "Testing $name..." @@ -37,65 +26,7 @@ for i in ${!DATASET_NAMES[@]}; do then errors+=("${name}") fi - - -# -# pytest -k test_matmul_ijk_i --ssname $name -s #--debug-sim -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - -# pytest -k test_mat_elemmul_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - - -# pytest -k test_tensor3_elemmul_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - -# pytest -k test_matmul_jik_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - -# pytest -k test_matmul_jki_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} matmul_ijk") -# fi - - - - -# pytest -k test_mat_identity_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} mat_identity") -# fi - -# pytest -k test_mat_elemmul_i --ssname $name -s -# status=$? -# if [ $status -gt 0 ] -# then -# errors+=("${name} mat_identity") -# fi - - - -done +done < $1 echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh b/scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh index 09cc2b67..e0e38f12 100755 --- a/scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh +++ b/scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh @@ -2,6 +2,8 @@ #SBATCH -N 1 #SBATCH -t 360 +# ./scripts/run_sam_sim/pytest_suitesparse_with_benchmarks.sh + BENCHMARKS=( matmul_kij matmul_kji @@ -22,27 +24,11 @@ BENCHMARKS=( ) -# FIXME: Need to change this to take in an input file as in taco side -DATASET_NAMES=( - bcsstm04 - bcsstm02 - bcsstm03 - lpi_bgprtr - cage4 - klein-b1 - GD02_a - GD95_b - Hamrle1 - LF10 -) - errors=() RED='\033[0;31m' NC='\033[0m' # No Color -export SUITESPARSE_PATH=/nobackup/owhsu/sparse-datasets/suitesparse -export FROSTT_PATH=/nobackup/owhsu/sparse-datasets/frostt-formatted cwd=$(pwd) resultdir=results @@ -56,13 +42,13 @@ for b in ${!BENCHMARKS[@]}; do mkdir -p $cwd/$resultdir/$bench echo "Testing $bench..." - for i in ${!DATASET_NAMES[@]}; do - name=${DATASET_NAMES[$i]} + while read line; do + name=$line echo "Testing $name..." pytest test/apps/test_$bench.py --ssname $name -s --benchmark-json=$path/$name.json - python $cwd/scripts/converter.py --json_name $path/$name.json + python $cwd/scripts/util/converter.py --json_name $path/$name.json status=$? if [ $status -gt 0 ] @@ -71,9 +57,9 @@ for b in ${!BENCHMARKS[@]}; do fi done - python $cwd/scripts/bench_csv_aggregator.py $path $cwd/suitesparse_$bench.csv + python $cwd/scripts/util/bench_csv_aggregator.py $path $cwd/suitesparse_$bench.csv -done +done < $1 echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/run_sam_sim/run_suitesparse.sh b/scripts/run_sam_sim/run_suitesparse.sh index cb7918ed..2b3da4ce 100755 --- a/scripts/run_sam_sim/run_suitesparse.sh +++ b/scripts/run_sam_sim/run_suitesparse.sh @@ -5,23 +5,12 @@ # 1. Formats input files # 2. Runs suitesparse sam sims in pytest +# ./scripts/run_sam_sim/run_suitesparse.sh + # THIS FILE MUST BE RUN FROM sam/ location outdir=/nobackup/owhsu/sparse-datasets/suitesparse-formatted basedir=$(pwd) -DATASET_NAMES=( - bcsstm04 - bcsstm02 - bcsstm03 - lpi_bgprtr - cage4 - klein-b1 - GD02_a - GD95_b - Hamrle1 - LF10 -) - errors=() RED='\033[0;31m' NC='\033[0m' # No Color @@ -31,8 +20,8 @@ export SUITESPARSE_FORMATTED_PATH=$outdir mkdir -p $outdir -for i in ${!DATASET_NAMES[@]}; do - name=${DATASET_NAMES[$i]} +while read line; do + name=$line cd $outdir echo "Generating input format files for $name..." @@ -53,7 +42,7 @@ for i in ${!DATASET_NAMES[@]}; do cd $outdir echo "Removing format files for $name..." rm ./$name*.txt -done +done < $1 echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/run_sam_sim/run_suitesparse_final.sh b/scripts/run_sam_sim/run_suitesparse_final.sh index 886e58b5..d2480f74 100755 --- a/scripts/run_sam_sim/run_suitesparse_final.sh +++ b/scripts/run_sam_sim/run_suitesparse_final.sh @@ -4,6 +4,8 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./scripts/run_sam_sim/run + pushd . cd sam/sim diff --git a/scripts/run_sam_sim/run_synthetics.sh b/scripts/run_sam_sim/run_synthetics.sh index 4b6a1c47..5e5b356a 100755 --- a/scripts/run_sam_sim/run_synthetics.sh +++ b/scripts/run_sam_sim/run_synthetics.sh @@ -2,15 +2,20 @@ #SBATCH -N 1 #SBATCH -t 360 +# ./scripts/run_sam_sim/run_synthetics.sh + # Req: Need to run this after synthetic/ is generated # 1. Runs all of the synthetic tests from the ASPLOS 2023 SAM paper +basedir=$(pwd) +resultdir=results + # Vars -if [ -z "$2" ] +if [ -z "$1" ] then - export SYNTHETIC_PATH="$(pwd)/synthetic/" + export SYNTHETIC_PATH="$basedir/synthetic/" else - export SYNTHETIC_PATH="$2" + export SYNTHETIC_PATH="$1" fi BENCHMARKS=( @@ -22,8 +27,6 @@ BENCHMARKS=( test_vec_elemmul_uncompressed ) -cwd=$(pwd) -resultdir=results for b in ${!BENCHMARKS[@]}; do bench=${BENCHMARKS[$b]} @@ -33,8 +36,8 @@ for b in ${!BENCHMARKS[@]}; do echo "Testing $bench..." pytest sam/sim/test/study-apps/$bench.py --synth --check-gold -k "random-40 or 0.2-blocks or 0.2-runs" --benchmark-json="$path/$bench.json" - python $cwd/scripts/converter.py --json_name $path/$bench.json - python $cwd/scripts/bench_csv_aggregator.py $path $cwd/SYNTH_OUT_ACCEL.csv + python $basedir/scripts/util/converter.py --json_name $path/$bench.json + python $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/SYNTH_OUT_ACCEL.csv done @@ -47,7 +50,7 @@ BENCHMARKS=( test_reorder_matmul_kji ) -cwd=$(pwd) +basedir=$(pwd) resultdir=results_reorder for b in ${!BENCHMARKS[@]}; do @@ -58,8 +61,8 @@ for b in ${!BENCHMARKS[@]}; do echo "Testing $bench..." pytest sam/sim/test/reorder-study/$bench.py --synth --check-gold --benchmark-json="$path/$bench.json" - python $cwd/scripts/converter.py --json_name $path/$bench.json - python $cwd/scripts/bench_csv_aggregator.py $path $cwd/SYNTH_OUT_REORDER.csv + python $basedir/scripts/util/converter.py --json_name $path/$bench.json + python $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/SYNTH_OUT_REORDER.csv done @@ -69,7 +72,7 @@ BENCHMARKS=( test_mat_sddmm_unfused ) -cwd=$(pwd) +basedir=$(pwd) resultdir=results_fusion for b in ${!BENCHMARKS[@]}; do @@ -80,8 +83,8 @@ for b in ${!BENCHMARKS[@]}; do echo "Testing $bench..." pytest sam/sim/test/fusion-study/$bench.py --synth --check-gold --benchmark-json="$path/$bench.json" - python $cwd/scripts/converter.py --json_name $path/$bench.json - python $cwd/scripts/bench_csv_aggregator.py $path $cwd/SYNTH_OUT_FUSION.csv + python $basedir/scripts/util/converter.py --json_name $path/$bench.json + python $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/SYNTH_OUT_FUSION.csv done diff --git a/scripts/run_sam_sim/sam_frostt_runner.sh b/scripts/run_sam_sim/sam_frostt_runner.sh old mode 100644 new mode 100755 index 8df824cd..59a9119f --- a/scripts/run_sam_sim/sam_frostt_runner.sh +++ b/scripts/run_sam_sim/sam_frostt_runner.sh @@ -10,6 +10,8 @@ # 3. Converts data to CSV # 4. Aggregates CSV +# ./scripts/run_sam_sim/sam_frostt_runner.sh + set -u BENCHMARKS=( @@ -20,61 +22,15 @@ BENCHMARKS=( tensor3_mttkrp_FINAL ) -TENSORS=( - fb1k - fb10k - facebook - nell-2 - nell-1 -) - - errors=() RED='\033[0;31m' NC='\033[0m' # No Color -# LANKA -if [ $1 -eq 1 ]; then - export SUITESPARSE_PATH=/data/scratch/changwan/florida_all - export FROSTT_PATH=/data/scratch/owhsu/datasets/frostt - export TACO_TENSOR_PATH=/data/scratch/owhsu/datasets - export SUITESPARSE_FORMATTED_PATH=/data/scratch/owhsu/datasets/suitesparse-formatted - export FROSTT_FORMATTED_TACO_PATH=/data/scratch/owhsu/datasets/frostt-formatted/taco-tensor - export FROSTT_FORMATTED_PATH=/data/scratch/owhsu/datasets/frostt-formatted - - mkdir -p $TACO_TENSOR_PATH - mkdir -p $SUITESPARSE_FORMATTED_PATH - mkdir -p $FROSTT_FORMATTED_TACO_PATH - mkdir -p $FROSTT_FORMATTED_PATH - - lanka=ON - neva=OFF -elif [ $1 -eq 2 ]; then - lanka=OFF - neva=ON -else - lanka=OFF - neva=OFF -fi - format_outdir=${FROSTT_FORMATTED_PATH} basedir=$(pwd) frosttpath=$FROSTT_PATH benchout=frostt-bench/sam -__conda_setup="$('/data/scratch/owhsu/miniconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" ]; then - . "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" - else - export PATH="/data/scratch/owhsu/miniconda/bin:$PATH" - fi -fi -unset __conda_setup -conda activate aha - mkdir -p "$benchout" mkdir -p $format_outdir mkdir -p $TACO_TENSOR_PATH/other-formatted-taco @@ -87,8 +43,8 @@ for b in ${!BENCHMARKS[@]}; do mkdir -p $basedir/$benchout/$bench echo "Testing $bench..." - for t in ${!TENSORS[@]}; do - name=${TENSORS[$t]} + while read line; do + name=$line cd $format_outdir @@ -97,15 +53,15 @@ for b in ${!BENCHMARKS[@]}; do $basedir/compiler/taco/build/bin/taco-test sam.pack_sss012 $basedir/compiler/taco/build/bin/taco-test sam.pack_other_frostt - python $basedir/scripts/datastructure_tns.py -n $name -f sss012 - python $basedir/scripts/datastructure_tns.py -n $name -f sss012 --other + python $basedir/scripts/formatting/datastructure_tns.py -n $name -f sss012 + python $basedir/scripts/formatting/datastructure_tns.py -n $name -f sss012 --other chmod -R 775 $FROSTT_FORMATTED_PATH fi cd $basedir/sam/sim pytest test/final-apps/test_$bench.py --frosttname $name --benchmark-json=$path/$name.json - python $basedir/scripts/converter.py --json_name $path/$name.json + python $basedir/scripts/util/converter.py --json_name $path/$name.json status=$? if [ $status -gt 0 ] @@ -114,9 +70,9 @@ for b in ${!BENCHMARKS[@]}; do fi cd $basedir - done + done <$1 - python $basedir/scripts/bench_csv_aggregator.py $path $basedir/$benchout/frostt_$bench.csv + python $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/$benchout/frostt_$bench.csv echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/run_sam_sim/sam_suitesparse_runner.sh b/scripts/run_sam_sim/sam_suitesparse_runner.sh index 8c806381..5604f524 100755 --- a/scripts/run_sam_sim/sam_suitesparse_runner.sh +++ b/scripts/run_sam_sim/sam_suitesparse_runner.sh @@ -4,6 +4,8 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./scripts/run_sam_sim/sam_suitesparse_runner.sh + set -u BENCHMARKS=( @@ -19,53 +21,17 @@ errors=() RED='\033[0;31m' NC='\033[0m' # No Color -# LANKA -if [ $2 -eq 1 ]; then - export SUITESPARSE_PATH=/data/scratch/changwan/florida_all - export FROSTT_PATH=/data/scratch/owhsu/datasets/frostt - export TACO_TENSOR_PATH=/data/scratch/owhsu/datasets - export SUITESPARSE_FORMATTED_PATH=/data/scratch/owhsu/datasets/suitesparse-formatted - export FROSTT_FORMATTED_TACO_PATH=/data/scratch/owhsu/datasets/frostt-formatted/taco-tensor - export FROSTT_FORMATTED_PATH=/data/scratch/owhsu/datasets/frostt-formatted - - mkdir -p $TACO_TENSOR_PATH - mkdir -p $SUITESPARSE_FORMATTED_PATH - mkdir -p $FROSTT_FORMATTED_TACO_PATH - mkdir -p $FROSTT_FORMATTED_PATH - - lanka=ON - neva=OFF -elif [ $2 -eq 2 ]; then - lanka=OFF - neva=ON -else - lanka=OFF - neva=OFF -fi - format_outdir=${SUITESPARSE_FORMATTED_PATH} basedir=$(pwd) sspath=$SUITESPARSE_PATH benchout=suitesparse-bench/sam -__conda_setup="$('/data/scratch/owhsu/miniconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" ]; then - . "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" - else - export PATH="/data/scratch/owhsu/miniconda/bin:$PATH" - fi -fi -unset __conda_setup -conda activate aha - mkdir -p "$benchout" mkdir -p $format_outdir mkdir -p $TACO_TENSOR_PATH/other-formatted-taco -make -j8 taco/build NEVA=$neva LANKA=$lanka GEN=ON +# make -j8 taco/build NEVA=$neva LANKA=$lanka GEN=ON +make -j8 taco/build GEN=ON for b in ${!BENCHMARKS[@]}; do bench=${BENCHMARKS[$b]} @@ -86,16 +52,16 @@ for b in ${!BENCHMARKS[@]}; do if [ "$bench" == "mat_vecmul_FINAL" ]; then echo "Generating input format files for $line..." - SUITESPARSE_TENSOR_PATH=$matrix python $basedir/scripts/datastructure_suitesparse.py -n $line + SUITESPARSE_TENSOR_PATH=$matrix python $basedir/scripts/formatting/datastructure_suitesparse.py -n $line SUITESPARSE_TENSOR_PATH=$matrix $basedir/compiler/taco/build/bin/taco-test sam.pack_other_ss - python $basedir/scripts/datastructure_tns.py -n $line -f ss01 --other -ss + python $basedir/scripts/formatting/datastructure_tns.py -n $line -f ss01 --other -ss fi cd $basedir/sam/sim pytest test/final-apps/test_$bench.py --ssname $line -s --report-stats --benchmark-json=$path/$line.json - python $basedir/scripts/converter.py --json_name $path/$line.json + python $basedir/scripts/util/converter.py --json_name $path/$line.json status=$? if [ $status -gt 0 ] @@ -106,7 +72,7 @@ for b in ${!BENCHMARKS[@]}; do cd $basedir done <$1 - python $basedir/scripts/bench_csv_aggregator.py $path $basedir/$benchout/suitesparse_$bench.csv + python $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/$benchout/suitesparse_$bench.csv echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/run_sam_sim/sam_suitesparse_runner_sddmmonly.sh b/scripts/run_sam_sim/sam_suitesparse_runner_sddmmonly.sh deleted file mode 100644 index 419e17dd..00000000 --- a/scripts/run_sam_sim/sam_suitesparse_runner_sddmmonly.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -#SBATCH -N 1 -#SBATCH --mem 120000 -#SBATCH -p lanka-v3 -#SBATCH --exclusive - -set -u - -BENCHMARKS=( - mat_sddmm_FINAL -) - -errors=() -RED='\033[0;31m' -NC='\033[0m' # No Color - -# LANKA -if [ $2 -eq 1 ]; then - export SUITESPARSE_PATH=/data/scratch/strange/tamu_sparse_unpacked - export FROSTT_PATH=/data/scratch/owhsu/datasets/frostt - export TACO_TENSOR_PATH=/data/scratch/owhsu/datasets - export SUITESPARSE_FORMATTED_PATH=/data/scratch/owhsu/datasets/suitesparse-formatted - export FROSTT_FORMATTED_TACO_PATH=/data/scratch/owhsu/datasets/frostt-formatted/taco-tensor - export FROSTT_FORMATTED_PATH=/data/scratch/owhsu/datasets/frostt-formatted - - mkdir -p $TACO_TENSOR_PATH - mkdir -p $SUITESPARSE_FORMATTED_PATH - mkdir -p $FROSTT_FORMATTED_TACO_PATH - mkdir -p $FROSTT_FORMATTED_PATH - - lanka=ON - neva=OFF -elif [ $2 -eq 2 ]; then - lanka=OFF - neva=ON -else - lanka=OFF - neva=OFF -fi - -format_outdir=${SUITESPARSE_FORMATTED_PATH} -basedir=$(pwd) -sspath=$SUITESPARSE_PATH -benchout=suitesparse-bench/sam - -__conda_setup="$('/data/scratch/owhsu/miniconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" ]; then - . "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" - else - export PATH="/data/scratch/owhsu/miniconda/bin:$PATH" - fi -fi -unset __conda_setup -conda activate aha - -mkdir -p "$benchout" -mkdir -p $format_outdir -mkdir -p $TACO_TENSOR_PATH/other-formatted-taco - -make -j8 taco/build NEVA=$neva LANKA=$lanka GEN=ON - -for b in ${!BENCHMARKS[@]}; do - bench=${BENCHMARKS[$b]} - path=$basedir/$benchout/$bench - mkdir -p $basedir/$benchout/$bench - echo "Testing $bench..." - - while read line; do -# cd $format_outdir - - if [ $2 -eq 1 ]; then - matrix="$sspath/$line/$line.mtx" - elif [ $2 -eq 2 ]; then - matrix="$sspath/$line.mtx" - else - matrix="$sspath/$line.mtx" - fi - -# if [ "$bench" == "mat_vecmul_FINAL" ]; then -# echo "Generating input format files for $line..." -# SUITESPARSE_TENSOR_PATH=$matrix python $basedir/scripts/datastructure_suitesparse.py -n $line --o -# -# SUITESPARSE_TENSOR_PATH=$matrix $basedir/compiler/taco/build/bin/taco-test sam.pack_other_ss -# python $basedir/scripts/datastructure_tns.py -n $line -f ss01 --other -ss -# fi - - cd $basedir/sam/sim - - pytest test/final-apps/test_$bench.py --ssname $line -s --benchmark-json=$path/$line.json - python $basedir/scripts/converter.py --json_name $path/$line.json - - status=$? - if [ $status -gt 0 ] - then - errors+=("${line}, ${bench}") - fi - - cd $basedir - done <$1 - - python $basedir/scripts/bench_csv_aggregator.py $path $basedir/$benchout/suitesparse_$bench.csv - - echo -e "${RED}Failed tests:" - for i in ${!errors[@]}; do - error=${errors[$i]} - echo -e "${RED}$error," - done - echo -e "${NC}" -done - diff --git a/scripts/run_sam_sim/suitesparse_validator.sh b/scripts/run_sam_sim/suitesparse_validator.sh index 8e554077..961dba79 100755 --- a/scripts/run_sam_sim/suitesparse_validator.sh +++ b/scripts/run_sam_sim/suitesparse_validator.sh @@ -3,6 +3,9 @@ #SBATCH --mem 120000 #SBATCH --exclusive +# ./scripts/run_sam_sim/suitesparse_validator.sh +# where out_path is optional + SAMNAME=( matmul_ikj vecmul_ij @@ -25,8 +28,13 @@ TACONAME=( set -u -sspath=/nobackup/owhsu/sparse-datasets/suitesparse -vout=/nobackup/owhsu/validate +sspath=$SUITESPARSE_PATH +if [ -z "$1" ] +then + vout=$basedir/validate/ +else + vout=$1 +fi mkdir -p "$vout" @@ -34,7 +42,7 @@ while read line; do matrix="$sspath/$line.mtx" # TACO - GEN=ON SUITESPARSE_TENSOR_PATH="$matrix" make -j8 validate-bench BENCHES="bench_suitesparse" VALIDATION_OUTPUT_PATH="$vout" NEVA=ON + GEN=ON SUITESPARSE_TENSOR_PATH="$matrix" make -j8 validate-bench BENCHES="bench_suitesparse" VALIDATION_OUTPUT_PATH="$vout" cd sam/sim # SAM diff --git a/scripts/stats/README.md b/scripts/stats/README.md new file mode 100644 index 00000000..dd1797d3 --- /dev/null +++ b/scripts/stats/README.md @@ -0,0 +1,8 @@ +# Statistics Scripts + +The `scripts/stats/` folder contains scripts used to get general sparse statistics about the datasets. This is useful for the designs + +1. `get_tensor_arrlen.py` - Script that gets the length of the datastructure arrays from the input datasets (to populate CSVs). +2. `suitesparse_stats.sh` - Script that calls `suitesparse_states.py` +3. `suitesparse_stats.py` - File that calcultes certain statistics (e.g size, + len, nnz) of the SuiteSparse data structure arrays (e.g. seg/crd) diff --git a/scripts/stats/get_tensor_arrlen.py b/scripts/stats/get_tensor_arrlen.py index 897738b2..0cc81fb9 100644 --- a/scripts/stats/get_tensor_arrlen.py +++ b/scripts/stats/get_tensor_arrlen.py @@ -1,8 +1,9 @@ +# python scripts/stats/get_tensor_arrlen.py + import argparse import os import csv - # This is using the old CSF file types def write_csv(path, outpath): with open(outpath, 'w+', newline='') as outcsv: diff --git a/scripts/stats/ss_stats.sh b/scripts/stats/ss_stats.sh deleted file mode 100755 index 6b8c3afe..00000000 --- a/scripts/stats/ss_stats.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -#SBATCH -N 1 -#SBATCH --exclusive -/home/owhsu/anaconda3/condabin/conda init bash -/home/owhsu/anaconda3/condabin/conda activate aha - -rm -rf /home/owhsu/aha/scadi_graph/scripts/logs - -python suitesparse_stats.py --overall -nstop 250 diff --git a/scripts/stats/suitesparse_stats.py b/scripts/stats/suitesparse_stats.py index 41947ade..bc4b49a0 100644 --- a/scripts/stats/suitesparse_stats.py +++ b/scripts/stats/suitesparse_stats.py @@ -8,7 +8,7 @@ from pathlib import Path -from util import TensorCollectionSuiteSparse, ScipyTensorShifter, \ +from sam.util import TensorCollectionSuiteSparse, ScipyTensorShifter, \ ScipyMatrixMarketTensorLoader, SuiteSparseTensor, safeCastPydataTensorToInts SS_PATH = os.getenv('SUITESPARSE_PATH') diff --git a/scripts/stats/suitesparse_stats.sh b/scripts/stats/suitesparse_stats.sh new file mode 100755 index 00000000..6b3760a0 --- /dev/null +++ b/scripts/stats/suitesparse_stats.sh @@ -0,0 +1,9 @@ +#!/bin/sh +#SBATCH -N 1 +#SBATCH --exclusive + +basedir=$(cwd) + +rm -rf $basedir/scripts/logs + +python suitesparse_stats.py --overall -nstop 250 diff --git a/scripts/tiling/README.md b/scripts/tiling/README.md new file mode 100644 index 00000000..47be7b1e --- /dev/null +++ b/scripts/tiling/README.md @@ -0,0 +1,33 @@ +# Tiling Scripts + +The `scripts/tiling/` folder contains scripts used to tile datasets and run tiling benchmarks. + +1. `advanced_simulator_runner.sh` - Script that formats, runs, and generates a + CSV for the tiled simulation (aka advanced simulator). +2. `clean_memory_model.sh` - Helper script to remove all generated files from + the tiled SAM flow +3. `ext_runner.sh` - Script that runs the Extensor configuration of for + inner-product matmul, used to recreate a graph in the ASPLOS 2023 SAM paper. +4. `few_points_memory_model_runner.sh` - Script that runs a restricted set of + experiments (8 points) from Figure 15 on pg. 12 of the SAM ASPLOS 2023 paper +(used in the ASPLOS 2023 artifact evaluation). +5. `full_ext_runner.sh` - Script that runs `ext_runner.sh` for all combinations + of NNZ and Dimension points. +6. `full_memory_model_runner.sh` - Script that runs the full set of experiments + to generate Figure 15 on pg. 12 of the SAM ASPLOS 2023 paper (used in the +ASPLOS 2023 artifact evaluation). +7. `generate_gold_matmul_tiled.py` - Script that generates the golden matmul + partial sums for each tile. +8. `generate_sparsity_sweep_mem_model.sh` - Script that generates pre-tiled + synthetic matrices. Used in the ASPLOS 2023 SAM artifact evaluation. +9. `prepare_files_no_gold.sh` - Script that runs `tile_ext.sh` for the extensor + configuration +10. `prepare_files.sh` - Script that runs `tile_ext.sh` and also prepares the + gold files using `generate_gold_matmul_tiled.py +11. `single_point_memory_model_runner.sh` - Script that runs a single point + from Figure 15 on pg. 12 of the SAM ASPLOS 2023 paper (Used in the ASPLOS +2023 artifact evaluation). +12. `tile_ext.sh` - Script that tiles the input matrices from a directory (like + extensor_mtx). +13. `tile.sh` - Script that tiles the input matrices from a tensor name (like + SuiteSparse matrices). diff --git a/scripts/tiling/advanced_simulator_runner.sh b/scripts/tiling/advanced_simulator_runner.sh index e7d772a0..2dd6edeb 100755 --- a/scripts/tiling/advanced_simulator_runner.sh +++ b/scripts/tiling/advanced_simulator_runner.sh @@ -4,10 +4,13 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./scripts/tiling/advanced_simulator_runner.sh +# where machine is either 0(local), 1(Lanka), or 2(Kiwi/Neva/Lagos) + set -u BENCHMARKS=( -## mat_vecmul_FINAL +# mat_vecmul_FINAL # matmul_FINAL # mat_identity # mat_identity_back @@ -17,7 +20,7 @@ BENCHMARKS=( # matmul_ikj_glb_tile2 matmul_ikj_tile_pipeline_final # matmul_ikj_glb_tile_pipeline -# i matmul_ikj_glb_no_pipe +# matmul_ikj_glb_no_pipe # matmul_ikj_input_only # matmul_ikj_tiled_bcsstm02 # matmul_ikj_check @@ -36,64 +39,12 @@ NC='\033[0m' # No Color basedir=$(pwd) -# LANKA -if [ $2 -eq 1 ]; then - export SUITESPARSE_PATH=/data/scratch/changwan/florida_all - export FROSTT_PATH=/data/scratch/owhsu/datasets/frostt - export TACO_TENSOR_PATH=/data/scratch/owhsu/datasets - export SUITESPARSE_FORMATTED_PATH=/data/scratch/owhsu/datasets/suitesparse-formatted - export FROSTT_FORMATTED_TACO_PATH=/data/scratch/owhsu/datasets/frostt-formatted/taco-tensor - export FROSTT_FORMATTED_PATH=/data/scratch/owhsu/datasets/frostt-formatted - export SAM_HOME=$basedir - export TILED_SUITESPARSE_FORMATTED_PATH=${SAM_HOME}/tiles/matmul_ikj/formatted - export TILED_OUTPUT_PATH=${SAM_HOME}/tiles/matmul_ikj/output/ - - mkdir -p $TACO_TENSOR_PATH - mkdir -p $SUITESPARSE_FORMATTED_PATH - mkdir -p $FROSTT_FORMATTED_TACO_PATH - mkdir -p $FROSTT_FORMATTED_PATH - - lanka=ON - neva=OFF -elif [ $2 -eq 2 ]; then - export SUITESPARSE_PATH=/nobackup/owhsu/sparse-datasets/suitesparse/ - export FROSTT_PATH=/nobackup/owhsu/sparse-datasets/frostt/ - export SUITESPARSE_FORMATTED_PATH=/nobackup/owhsu/sparse-datasets/suitesparse-formatted - export FROSTT_FORMATTED_TACO_PATH=/nobackup/owhsu/sparse-datasets/frostt-formatted/taco-tensor - export FROSTT_FORMATTED_PATH=/nobackup/owhsu/sparse-datasets/frostt-formatted - export TACO_TENSOR_PATH=/nobackup/owhsu/sparse-datasets - export SAM_HOME=$basedir - export TILED_SUITESPARSE_FORMATTED_PATH=${SAM_HOME}/tiles/matmul_ikj/formatted - export TILED_OUTPUT_PATH=${SAM_HOME}/tiles/matmul_ikj/output/ - lanka=OFF - neva=ON -else - lanka=OFF - neva=OFF - export SAM_HOME=$basedir - export TILED_SUITESPARSE_FORMATTED_PATH=${SAM_HOME}/tiles/matmul_ikj/formatted - export TILED_OUTPUT_PATH=${SAM_HOME}/tiles/matmul_ikj/output/ -fi - sspath=$SUITESPARSE_PATH benchout=suitesparse-bench_simulator/sam format_outdir=${SUITESPARSE_FORMATTED_PATH} source $basedir/../venv/bin/activate -#__conda_setup="$('/data/scratch/owhsu/miniconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" -#if [ $? -eq 0 ]; then -# eval "$__conda_setup" -#else -# if [ -f "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" ]; then -# . "/data/scratch/owhsu/miniconda/etc/profile.d/conda.sh" -# else -# export PATH="/data/scratch/owhsu/miniconda/bin:$PATH" -# fi -#fi -#unset __conda_setup -#conda activate aha - mkdir -p "$benchout" mkdir -p $format_outdir mkdir -p $TACO_TENSOR_PATH/other-formatted-taco @@ -127,7 +78,7 @@ for b in ${!BENCHMARKS[@]}; do #python -m cProfile -o test/final-apps/test_$bench.py --ssname $line -s --benchmark-json=$path/$line.json pytest test/advanced-simulator/test_$bench.py --ssname $line -s --report-stats --check-gold --skip-empty --nbuffer --yaml_name=$3 --benchmark-json=$path/$line.json # pytest test/advanced-simulator/test_$bench.py --ssname $line -s --report-stats --back --depth=1 --debug-sim --check-gold --benchmark-json=$path/$line.json - # python $basedir/scripts/converter.py --json_name $path/$line.json + # python $basedir/scripts/util/converter.py --json_name $path/$line.json status=$? if [ $status -gt 0 ] @@ -138,7 +89,7 @@ for b in ${!BENCHMARKS[@]}; do cd $basedir done <$1 - python3 $basedir/scripts/bench_csv_aggregator.py $path $basedir/$benchout/suitesparse_$bench.csv + python $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/$benchout/suitesparse_$bench.csv echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/tiling/clean_memory_model.sh b/scripts/tiling/clean_memory_model.sh old mode 100644 new mode 100755 diff --git a/scripts/tiling/ext_runner.sh b/scripts/tiling/ext_runner.sh index 5ff01444..4965ace6 100755 --- a/scripts/tiling/ext_runner.sh +++ b/scripts/tiling/ext_runner.sh @@ -4,10 +4,13 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./scripts/tiling/ext_runner.sh extensor__.mtx + +basedir=$(pwd) rm -rf $basedir/tiles/* -./scripts/tile_ext.sh $1 memory_config_extensor_17M_llb.yaml +./scripts/tiling/tile_ext.sh $1 memory_config_extensor_17M_llb.yaml -python scripts/generate_gold_matmul_tiled.py --yaml_name memory_config_extensor_17M_llb.yaml +python scripts/tiling/generate_gold_matmul_tiled.py --yaml_name memory_config_extensor_17M_llb.yaml -./scripts/advanced_simulator_runner.sh scripts/temp.txt 2 memory_config_extensor_17M_llb.yaml +./scripts/tiling/advanced_simulator_runner.sh scripts/temp.txt 2 memory_config_extensor_17M_llb.yaml diff --git a/scripts/tiling/few_points_memory_model_runner.sh b/scripts/tiling/few_points_memory_model_runner.sh index 79811385..02ba18e3 100755 --- a/scripts/tiling/few_points_memory_model_runner.sh +++ b/scripts/tiling/few_points_memory_model_runner.sh @@ -4,6 +4,9 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./few_points_memory_model_runner.sh +# where gold is 0(no gold check) or 1(with gold check) + SECONDS=0 set -u @@ -49,9 +52,9 @@ for b in ${!BENCHMARKS[@]}; do for nnz in ${!NNZ[@]}; do for dim in ${!DIMENSIONS[@]}; do if [ $2 -eq 0 ]; then - ./scripts/prepare_files_no_gold.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx + ./scripts/tiling/prepare_files_no_gold.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx elif [ $2 -eq 1 ]; then - ./scripts/prepare_files.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx + ./scripts/tiling/prepare_files.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx fi bench=${BENCHMARKS[$b]} path=$basedir/$benchout @@ -65,7 +68,7 @@ for b in ${!BENCHMARKS[@]}; do else pytest test/advanced-simulator/test_$bench.py --ssname $line -s --skip-empty --nbuffer --yaml_name=$1 --nnz-value=${NNZ[$nnz]} --benchmark-json=$path/${line}_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.json fi - python $basedir/scripts/converter.py --json_name $path/${line}_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.json + python $basedir/scripts/util/converter.py --json_name $path/${line}_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.json status=$? if [ $status -gt 0 ] @@ -75,7 +78,7 @@ for b in ${!BENCHMARKS[@]}; do cd $basedir done done - python3 $basedir/scripts/bench_csv_aggregator.py $path $basedir/$benchout/$bench.csv + python3 $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/$benchout/$bench.csv echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/tiling/full_ext_runner.sh b/scripts/tiling/full_ext_runner.sh index aca5dd2e..411b2ecd 100755 --- a/scripts/tiling/full_ext_runner.sh +++ b/scripts/tiling/full_ext_runner.sh @@ -3,7 +3,8 @@ #SBATCH --mem 120000 #SBATCH -p lanka-v3 #SBATCH --exclusive -#SBATCH --mail-user=oliviahsu1107@gmail.com + +# ./scripts/tiling/full_ext_runner.sh NNZ=( 5000 @@ -27,6 +28,6 @@ DIMENSIONS=( for nnz in ${!NNZ[@]}; do for dim in ${!DIMENSIONS[@]}; do filename=${NNZ[$nnz]}_${DIMENSIONS[$dim]} - ./scripts/ext_runner.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx + ./scripts/tiling/ext_runner.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx done done diff --git a/scripts/tiling/full_memory_model_runner.sh b/scripts/tiling/full_memory_model_runner.sh index 447b7bc4..190239df 100755 --- a/scripts/tiling/full_memory_model_runner.sh +++ b/scripts/tiling/full_memory_model_runner.sh @@ -3,6 +3,10 @@ #SBATCH --mem 120000 #SBATCH -p lanka-v3 #SBATCH --exclusive + +# full_memory_model_runner.sh +# where gold is 0 (no gold check) or 1 (with gold check) + SECONDS=0 set -u @@ -49,9 +53,9 @@ for b in ${!BENCHMARKS[@]}; do for nnz in ${!NNZ[@]}; do for dim in ${!DIMENSIONS[@]}; do if [ $2 -eq 1 ]; then - ./scripts/prepare_files.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx + ./scripts/tiling/prepare_files.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx elif [ $2 -eq 0 ]; then - ./scripts/prepare_files_no_gold.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx + ./scripts/tiling/prepare_files_no_gold.sh extensor_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.mtx fi bench=${BENCHMARKS[$b]} path=$basedir/$benchout @@ -65,7 +69,7 @@ for b in ${!BENCHMARKS[@]}; do else pytest test/advanced-simulator/test_$bench.py --ssname $line -s --skip-empty --nbuffer --yaml_name=$1 --nnz-value=${NNZ[$nnz]} --benchmark-json=$path/${line}_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.json fi - python $basedir/scripts/converter.py --json_name $path/${line}_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.json + python $basedir/scripts/util/converter.py --json_name $path/${line}_${NNZ[$nnz]}_${DIMENSIONS[$dim]}.json status=$? if [ $status -gt 0 ] @@ -75,7 +79,7 @@ for b in ${!BENCHMARKS[@]}; do cd $basedir done done - python3 $basedir/scripts/bench_csv_aggregator.py $path $basedir/$benchout/$bench.csv + python3 $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/$benchout/$bench.csv echo -e "${RED}Failed tests:" for i in ${!errors[@]}; do diff --git a/scripts/tiling/generate_gold_matmul_tiled.py b/scripts/tiling/generate_gold_matmul_tiled.py index 64ff4946..55be3674 100644 --- a/scripts/tiling/generate_gold_matmul_tiled.py +++ b/scripts/tiling/generate_gold_matmul_tiled.py @@ -9,18 +9,7 @@ import argparse from pathlib import Path - - -# FIXME: (owhsu) this should be imported from util -def round_sparse(x): - if 0.0 <= x < 1: - return 1 - elif 0.0 > x > -1: - return -1 - elif x >= 0.0: - return math.floor(x + 0.5) - else: - return math.ceil(x - 0.5) +from scripts.util.util import round_sparse def generate_gold_matmul_tiled(tile_crd_b, tile_crd_c, dirname, out_format="ss01"): diff --git a/scripts/tiling/generate_sparsity_sweep_mem_model.sh b/scripts/tiling/generate_sparsity_sweep_mem_model.sh index 4ac85ed3..35bb6d8a 100755 --- a/scripts/tiling/generate_sparsity_sweep_mem_model.sh +++ b/scripts/tiling/generate_sparsity_sweep_mem_model.sh @@ -1,3 +1,5 @@ +# ./scripts/tiling/generate_sparsity_sweep_mem_model.sh + SECONDS=0 mkdir extensor_mtx diff --git a/scripts/tiling/prepare_files.sh b/scripts/tiling/prepare_files.sh index bed6796c..5aece84f 100755 --- a/scripts/tiling/prepare_files.sh +++ b/scripts/tiling/prepare_files.sh @@ -3,12 +3,13 @@ #SBATCH --mem 120000 #SBATCH -p lanka-v3 #SBATCH --exclusive -#SBATCH --mail-user=oliviahsu1107@gmail.com + +# ./scripts/tiling/prepare_files.sh extensor__.mtx basedir=$(pwd) rm -rf $basedir/tiles/* -./scripts/tile_ext.sh $1 memory_config_extensor_17M_llb.yaml +./scripts/tiling/tile_ext.sh $1 memory_config_extensor_17M_llb.yaml -python scripts/generate_gold_matmul_tiled.py --yaml_name memory_config_extensor_17M_llb.yaml +python scripts/tiling/generate_gold_matmul_tiled.py --yaml_name memory_config_extensor_17M_llb.yaml diff --git a/scripts/tiling/prepare_files_no_gold.sh b/scripts/tiling/prepare_files_no_gold.sh index 13e3de8c..719d668c 100755 --- a/scripts/tiling/prepare_files_no_gold.sh +++ b/scripts/tiling/prepare_files_no_gold.sh @@ -3,8 +3,10 @@ #SBATCH --mem 120000 #SBATCH -p lanka-v3 #SBATCH --exclusive -#SBATCH --mail-user=oliviahsu1107@gmail.com +# ./scripts/tiling/prepare_files_no_gold.sh extensor__.mtx + +basedir=$(pwd) rm -rf $basedir/tiles/* -./scripts/tile_ext.sh $1 memory_config_extensor_17M_llb.yaml +$basedir/scripts/tiling/tile_ext.sh $1 memory_config_extensor_17M_llb.yaml diff --git a/scripts/tiling/single_point_memory_model_runner.sh b/scripts/tiling/single_point_memory_model_runner.sh index e666769d..a21b2d30 100755 --- a/scripts/tiling/single_point_memory_model_runner.sh +++ b/scripts/tiling/single_point_memory_model_runner.sh @@ -4,6 +4,8 @@ #SBATCH -p lanka-v3 #SBATCH --exclusive +# ./scripts/tiling/single_point_memory_model_runner.sh extensor__.mtx + benchout=memory_model_out basedir=$(pwd) @@ -31,13 +33,13 @@ mkdir -p $path mkdir -p $basedir/tiles/ rm -rf $basedir/tiles/* -./scripts/prepare_files.sh $fname +./scripts/tiling/prepare_files.sh $fname cd $basedir/sam/sim pytest test/advanced-simulator/test_$bench.py --ssname $line -s --check-gold --skip-empty --nbuffer --yaml_name=$yaml_fname --nnz-value=$nnz --benchmark-json=$path/${line}_${nnz}_${dim}.json -python $basedir/scripts/converter.py --json_name $path/${line}_${nnz}_${dim}.json +python $basedir/scripts/util/converter.py --json_name $path/${line}_${nnz}_${dim}.json -python3 $basedir/scripts/bench_csv_aggregator.py $path $basedir/$benchout/$bench.csv +python3 $basedir/scripts/util/bench_csv_aggregator.py $path $basedir/$benchout/$bench.csv popd diff --git a/scripts/tiling/tile.sh b/scripts/tiling/tile.sh index 8b735289..9f71c94a 100755 --- a/scripts/tiling/tile.sh +++ b/scripts/tiling/tile.sh @@ -1,5 +1,7 @@ #!/bin/bash +# ./scripts/tiling/tile.sh + BENCHMARKS=( matmul_ikj ) @@ -22,7 +24,7 @@ for b in ${!BENCHMARKS[@]}; do python $basedir/sam/sim/src/tiling/tile.py --input_tensor $line --cotile $bench --multilevel --hw_config $basedir/sam/sim/src/tiling/$2 echo "Generating input format files for $line..." - python $basedir/scripts/datastructure_suitesparse.py -n $line -hw -b $bench --input $basedir/tiles/$bench/mtx/ --output_dir_path $basedir/tiles/$bench/formatted --tiles + python $basedir/scripts/formatting/datastructure_suitesparse.py -n $line -hw -b $bench --input $basedir/tiles/$bench/mtx/ --output_dir_path $basedir/tiles/$bench/formatted --tiles done <$1 done diff --git a/scripts/tiling/tile_ext.sh b/scripts/tiling/tile_ext.sh index 2c8a54e3..4548f466 100755 --- a/scripts/tiling/tile_ext.sh +++ b/scripts/tiling/tile_ext.sh @@ -1,17 +1,19 @@ #!/bin/bash +# THIS FILE MUST BE RUN FROM sam/ location +# ./scripts/tiling/tile_ext.sh + BENCHMARKS=( matmul_ikj ) -# THIS FILE MUST BE RUN FROM sam/ location sspath=$SUITESPARSE_PATH basedir=$(pwd) -ext_path=$basedir/extensor_mtx/$1 +tiles_path=$basedir/extensor_mtx/$1 -echo "$ext_path" +echo "$tiles_path" for b in ${!BENCHMARKS[@]}; do bench=${BENCHMARKS[$b]} @@ -22,10 +24,10 @@ for b in ${!BENCHMARKS[@]}; do rm -rf $basedir/tiles/* echo "Tiling mtx file" - python $basedir/sam/sim/src/tiling/tile.py --extensor --input_path $ext_path --cotile $bench --multilevel --hw_config $basedir/sam/sim/src/tiling/$2 + python $basedir/sam/sim/src/tiling/tile.py --extensor --input_path $tiles_path --cotile $bench --multilevel --hw_config $basedir/sam/sim/src/tiling/$2 - echo "Generating input format files for $ext_path..." - python $basedir/scripts/datastructure_suitesparse.py -n temp -hw -b $bench --input $basedir/tiles/$bench/mtx/ --output_dir_path $basedir/tiles/$bench/formatted --tiles + echo "Generating input format files for $tiles_path..." + python $basedir/scripts/formatting/datastructure_suitesparse.py -n temp -hw -b $bench --input $basedir/tiles/$bench/mtx/ --output_dir_path $basedir/tiles/$bench/formatted --tiles done diff --git a/scripts/util/README.md b/scripts/util/README.md index cbad7835..21f3936f 100644 --- a/scripts/util/README.md +++ b/scripts/util/README.md @@ -3,7 +3,7 @@ The `scripts/util` folder contains util.py (shared utility functions) and shared utility scripts used to aggregate and format csv data. -1. `util.py` - +1. `util.py` - List of python util code needed by the Python scripts under `sam/scripts` 2. `bench_csv_aggregator.py` - Script that aggregates all of the output CSVs. This is useful since CPU tests are run using googlebench potentially one tensor at a time (to run tests in parallel), which will produce one CSV per tensor. diff --git a/scripts/util/__init__.py b/scripts/util/__init__.py new file mode 100644 index 00000000..e69de29b From 9dae11474ae564b3a1cbfa23a7b4e8c796b9f5c1 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Mon, 17 Jul 2023 16:49:48 -0700 Subject: [PATCH 07/11] Fix pycodestyle --- scripts/stats/get_tensor_arrlen.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/stats/get_tensor_arrlen.py b/scripts/stats/get_tensor_arrlen.py index 0cc81fb9..0d2df62d 100644 --- a/scripts/stats/get_tensor_arrlen.py +++ b/scripts/stats/get_tensor_arrlen.py @@ -4,6 +4,7 @@ import os import csv + # This is using the old CSF file types def write_csv(path, outpath): with open(outpath, 'w+', newline='') as outcsv: From 1678d58c44c9df15d4bd411c1c39e1a203e5e853 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Wed, 26 Jul 2023 17:58:18 -0700 Subject: [PATCH 08/11] Add in updated gitignore --- .gitignore | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index a69400ea..40366917 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,9 @@ __pycache__/ *.swo *.txt *.out -download_suitesparse_partial.sh + +# Generated Python Package files +*.egg-info/ # Files for MacOS and IDEs .DS_store @@ -27,37 +29,29 @@ cmake-build-*/ *.csv *.json +# Tensor files +*.mtx +*.tns + +# Generated formatted tensor files +tensor_*_mode_* + # Generated folders build/ logs/ results/ results-cpu/ -suitesparse-bench*/ +suitesparse-bench/ sam-outputs/ compiler/benchmark/ -# Generated SAM simulator tests -*/sim/test/apps/test_*.py - -# Generated SAM graphs -*.gv - -# Downloaded data -*.mtx -*.tns - -# Temporary matrices +# Temporary or generated tensor directories tmp_mat*/ - -# Jupyter notebook checkpoints -.ipynb_checkpoints/ - -# Generated formatted tensor files -tensor_*_mode_* - -# Tiling files tiles/ +synthetic/ -# sam package info -sam.egg-info/ +# Generated SAM simulator tests +*/sim/test/apps/test_*.py +# Temporary scripts +download_suitesparse_partial.sh From 588a1c0eb0f86601a6c76856e6c0eb3662073468 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Fri, 4 Aug 2023 10:00:32 -0700 Subject: [PATCH 09/11] Update pydata sparse import --- sam/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sam/util.py b/sam/util.py index 96cc15c5..67d3fcf4 100644 --- a/sam/util.py +++ b/sam/util.py @@ -7,7 +7,7 @@ import shutil import numpy as np import math -import pydata +import sparse from pathlib import Path from dataclasses import dataclass From 6aa9f6fcc1e0b3344d0949e723d76fd528d89c07 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Tue, 8 Aug 2023 14:48:56 -0700 Subject: [PATCH 10/11] Add in pydata/sparse and update gitignore --- .gitignore | 5 +++++ requirements.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 40366917..e3c498b9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,10 @@ __pycache__/ # Temporary output files *.swp *.swo +*.swn *.txt *.out +*.log # Generated Python Package files *.egg-info/ @@ -55,3 +57,6 @@ synthetic/ # Temporary scripts download_suitesparse_partial.sh + +# Network Filesystem +.nfs* diff --git a/requirements.txt b/requirements.txt index 1b7cab3d..8671a953 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,5 +25,6 @@ PyYAML==6.0 requests==2.28.2 scipy==1.10.0 six==1.16.0 +sparse==0.13.0 tomli==2.0.1 tqdm==4.64.1 From 11502cbcd9312247aa38e1ba600265dfb2453ee6 Mon Sep 17 00:00:00 2001 From: Olivia Hsu Date: Tue, 8 Aug 2023 15:07:31 -0700 Subject: [PATCH 11/11] Update util.py to pass codestyle --- sam/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sam/util.py b/sam/util.py index 67d3fcf4..0658de93 100644 --- a/sam/util.py +++ b/sam/util.py @@ -142,7 +142,7 @@ def load(self, path): # PydataSparseTensorLoader loads a sparse tensor from a file into -# a pydata.sparse tensor. +# a sparse tensor. # class PydataSparseTensorLoader: # def __init__(self): # self.loader = TnsFileLoader() @@ -547,7 +547,7 @@ def load(self, tensor, suiteSparse, cast, format_str): # PydataMatrixMarketTensorLoader loads tensors in the matrix market format -# into pydata.sparse matrices. +# into sparse matrices. # class PydataMatrixMarketTensorLoader: # def __init__(self): # pass @@ -601,7 +601,7 @@ def safeCastPydataTensorToInts(tensor): # else: # data[i] = int(tensor.data[i]) data[i] = round_sparse(tensor.data[i]) - return pydata.sparse.COO(tensor.coords, data, tensor.shape) + return sparse.COO(tensor.coords, data, tensor.shape) def parse_taco_format(infilename, outdir, tensorname, format_str):