mwbreurdev

turing-unlocked-test

Oct 25th, 2026
18
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.23 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Dynamically target the exact folder where the script is executed
  4. RUN_DIR="$(pwd)"
  5. BASE_DIR="/home/michiel/cuda-samples/cpp/3_CUDA_Features"
  6. COMMON_INC="/home/michiel/cuda-samples/Common"
  7. LOG_FILE="${RUN_DIR}/turing_benchmark_results.log"
  8. ARCH_FLAG="-arch=sm_75"
  9.  
  10. # Clear out any previous log files
  11. echo "==================================================" > "$LOG_FILE"
  12. echo "        TURING ARCHITECTURE BENCHMARK LOG         " >> "$LOG_FILE"
  13. echo "        Generated on: $(date)                     " >> "$LOG_FILE"
  14. echo "        Output location: ${LOG_FILE}              " >> "$LOG_FILE"
  15. echo "==================================================" >> "$LOG_FILE"
  16. echo "" >> "$LOG_FILE"
  17.  
  18. # Helper function to compile and run a test
  19. run_test() {
  20.     local folder_name=$1
  21.     local source_file=$2
  22.     local extra_flags=$3
  23.     local display_name=$4
  24.  
  25.     echo "[*] Starting Benchmark: ${display_name}..."
  26.     echo "--------------------------------------------------" >> "$LOG_FILE"
  27.     echo " TEST: ${display_name}" >> "$LOG_FILE"
  28.     echo "--------------------------------------------------" >> "$LOG_FILE"
  29.  
  30.     # Navigate to target directory inside the samples tree
  31.     if cd "${BASE_DIR}/${folder_name}" 2>/dev/null; then
  32.         # Clean any old binaries to guarantee a fresh build
  33.         rm -f "${folder_name}"
  34.  
  35.         # Compile (Added -diag-suppress 20054 to silence the dynamic shared memory warnings)
  36.         echo "    Compiling ${source_file} with ${ARCH_FLAG}..."
  37.         nvcc "${source_file}" -I"${COMMON_INC}" ${ARCH_FLAG} ${extra_flags} -diag-suppress 20054 -o "${folder_name}"
  38.  
  39.         # Check if compilation succeeded
  40.         if [ -f "${folder_name}" ]; then
  41.             echo "    Running binary..."
  42.             # Execute and pipe output straight to our relative log file
  43.             ./"${folder_name}" >> "$LOG_FILE" 2>&1
  44.             echo "" >> "$LOG_FILE"
  45.             echo "[+] ${display_name} completed successfully."
  46.         else
  47.             echo "[-] Error: Compilation failed for ${display_name}." >> "$LOG_FILE"
  48.             echo "[-] Error: Compilation failed for ${display_name}."
  49.         fi
  50.     else
  51.         echo "[-] Error: Directory ${folder_name} not found." >> "$LOG_FILE"
  52.         echo "[-] Error: Directory ${folder_name} not found."
  53.     fi
  54.     echo ""
  55. }
  56.  
  57. # --- TEST 1: FP16 Tensor Cores ---
  58. run_test "cudaTensorCoreGemm" "cudaTensorCoreGemm.cu" "-lcublas -lcudart" "FP16 Tensor Core GEMM Execution"
  59.  
  60. # --- TEST 2: INT8 Tensor Cores (IMMA) ---
  61. run_test "immaTensorCoreGemm" "immaTensorCoreGemm.cu" "-lcublas -lcudart" "INT8 Integer Tensor Core (IMMA) Execution"
  62.  
  63. # --- TEST 3: Asynchronous Global to Shared Memory Copy ---
  64. run_test "globalToShmemAsyncCopy" "globalToShmemAsyncCopy.cu" "-lcudart" "Asynchronous Memory Pipeline Performance"
  65.  
  66. # --- TEST 4: Hardware Warp Cohesion and Atomics ---
  67. run_test "warpAggregatedAtomicsCG" "warpAggregatedAtomicsCG.cu" "-lcudart" "Cooperative Groups Warp Aggregated Atomics"
  68.  
  69. # Complete
  70. echo "=================================================="
  71. echo "All tests finished!"
  72. echo "Your benchmark summary is waiting here: ${LOG_FILE}"
  73. echo "You can read it using: cat ./turing_benchmark_results.log"
  74. echo "=================================================="
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment