From 20656bba5c520a5c4881efc02a4ec71802b8e5e1 Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Thu, 25 Apr 2019 14:41:08 +0100 Subject: [PATCH] shell scripts for getting and preparing matrices --- test/fileread/matrices/create_input_file.sh | 26 ++++++++++ test/fileread/matrices/dl_matrix.sh | 53 +++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100755 test/fileread/matrices/create_input_file.sh create mode 100755 test/fileread/matrices/dl_matrix.sh diff --git a/test/fileread/matrices/create_input_file.sh b/test/fileread/matrices/create_input_file.sh new file mode 100755 index 00000000..53f14dd5 --- /dev/null +++ b/test/fileread/matrices/create_input_file.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# https://sparse.tamu.edu/RB/CPM/cz148.tar.gz +# input is filename.rb + +rb=$1 +dir=${rb%.rb} +inp=${dir}.inp +mkdir ${dir} +mv ${rb} ${dir} +cd ${dir} + +# --- write out input file --- +echo "11 Number of inputs" > ${inp} +echo "${rb}" >> ${inp} +echo "NONE" >> ${inp} +echo "HB HB: Harwell-Boeing" >> ${inp} +echo "BiCGSTAB Iterative method" >> ${inp} +echo "BJAC Preconditioner " >> ${inp} +echo "CSR Storage format " >> ${inp} +echo "BLOCK Partition method" >> ${inp} +echo "2 ISTOPC" >> ${inp} +echo "00500 ITMAX" >> ${inp} +echo "-1 ITRACE" >> ${inp} +echo "002 IRST " >> ${inp} +echo "1.d-7 EPS" >> ${inp} diff --git a/test/fileread/matrices/dl_matrix.sh b/test/fileread/matrices/dl_matrix.sh new file mode 100755 index 00000000..175b77bd --- /dev/null +++ b/test/fileread/matrices/dl_matrix.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# https://sparse.tamu.edu/RB/CPM/cz148.tar.gz + +if [ `expr match "$1" "https://sparse.tamu.edu/"` == 24 ]; then + f=$(basename $1) + dir=${f%.tar.gz} + rb=${dir}.rb + inp=${dir}.inp + wget $1 + tar zxf ${f} + rm ${f} + cd ${dir}/ + # --- write out input file --- + echo "11 Number of inputs" > ${inp} + echo "${rb}" >> ${inp} + echo "NONE" >> ${inp} + echo "HB HB: Harwell-Boeing" >> ${inp} + echo "BiCGSTAB Iterative method" >> ${inp} + echo "BJAC Preconditioner " >> ${inp} + echo "CSR Storage format " >> ${inp} + echo "BLOCK Partition method" >> ${inp} + echo "2 ISTOPC" >> ${inp} + echo "00500 ITMAX" >> ${inp} + echo "-1 ITRACE" >> ${inp} + echo "002 IRST " >> ${inp} + echo "1.d-7 EPS" >> ${inp} +else + echo "Please submit a .tar.gz file from SuiteSparse Matrix Collection" +fi +# 123456789012345678901234 + + +# declare -a matrix_size=( "148" "308" "628" "1268" "2548" "5108" "10228" "20468" "40948" ) + +# --- dl matrices --- +# for i in "${matrix_size[@]}" +# do +# n=$i +# wget "https://sparse.tamu.edu/RB/CPM/cz${n}.tar.gz" +# done + + +# --- untar and mv and rm --- +# for n in "${matrix_size[@]}" +# do +# tar zxf cz${n}.tar.gz +# mv cz${n}/cz${n}.rb ./ +# rm -r cz${n} +# done +# rm *.tar.gz + +# --- create input files ---