GIGI_4_merge.sh 1.08 KB
Newer Older
1 2 3 4 5
#!/bin/bash


#GIGIMerge <directory> <partition count>

6 7 8 9 10 11 12
if [ ${verbose} ]
then
  echo "GIGI Merge Location: " "${gigi_merge}"
  echo "Directory: " "${output_folder}/${run_name}/gigi_output"
  echo "Num Chunks: " "${num_chunks}"
  echo "Long is: " "${long}"
fi
13

14
$timecmd -o "${output_folder}/${run_name}/STATS/time_merge.log" -f'memory in kilobytes %M real %e user %U sys %S command %C' "${gigi_merge}" "${output_folder}/${run_name}/gigi_output" "${num_chunks}" "${long}" > "${output_folder}/${run_name}/LOGS/merge.log"
15 16 17 18 19 20 21
merge_status="$?"
echo "Merge exit status: " "$merge_status"

if [ "$merge_status" -eq 0 ]
then
  echo "COMPLETED SUCCESSFULLY!"
  echo "Merged files are located at: " "${output_folder}/${run_name}/gigi_output"
22 23
  rm -R "${output_folder}"/"${run_name}"/gigi_output/*/
  rm -R "${output_folder}"/"${run_name}"/split_output/
24 25 26 27 28 29
  cat "${output_folder}"/"${run_name}"/STATS/time* > "${output_folder}"/"${run_name}"/STATS/stats
  rm "${output_folder}"/"${run_name}"/STATS/time*
else
  echo "Merge failed, aborting, temporary files will be left so that they need not all be rerun"
  exit 1
fi