AUTH's THMMY "Parallel and distributed systems" course assignments.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

42 lignes
1.3 KiB

  1. #! /usr/bin/env bash
  2. # Check if a directory argument is given
  3. if [[ -z "$1" ]]; then
  4. echo "Usage: $0 <directory>"
  5. exit 1
  6. fi
  7. LOG_DIR="$1"
  8. # Extract GPU name and block size (only once)
  9. GPU=$(grep -h "GPU:" "$LOG_DIR"/* | head -n 1 | awk -F": " '{print $3}')
  10. BLOCK_SIZE=$(grep -h "Block size:" "$LOG_DIR"/* | head -n 1 | awk -F": " '{print $3}')
  11. # Print Header
  12. printf "%-4s %s\n" "GPU:" "${GPU:-Unknown}"
  13. printf "%-8s %s\n" "Block size:" "${BLOCK_SIZE:-Unknown}"
  14. printf "%s\n" "--------------------------------------"
  15. # Loop through code versions
  16. for VERSION in V0 V1 V2; do
  17. printf "\n%-15s %s\n" "Code version:" "$VERSION"
  18. printf "%-7s %-18s %-18s %-18s\n" "" "Total" "Mem-xch" "Sorting"
  19. for Q in {20..30}; do
  20. FILE=$(grep -l "\[Log\]: Code version: $VERSION" "$LOG_DIR"/* | xargs grep -l "Q=$Q")
  21. if [[ -n "$FILE" ]]; then
  22. TOTAL=$(grep "\[Timing\] Total" "$FILE" | awk '{print $4, $5}')
  23. MEM_XCH=$(grep "\[Timing\] Mem-xch" "$FILE" | awk '{print $4, $5}')
  24. SORTING=$(grep "\[Timing\] Sorting" "$FILE" | awk '{print $4, $5}')
  25. else
  26. TOTAL="N/A"
  27. MEM_XCH="N/A"
  28. SORTING="N/A"
  29. fi
  30. printf "Q%-2d: %-18s %-18s %-18s\n" "$Q" "$TOTAL" "$MEM_XCH" "$SORTING"
  31. done
  32. done