From 578eb82010510075e1d35e666224836bf0e5fbd9 Mon Sep 17 00:00:00 2001 From: Hashara Date: Wed, 2 Jul 2025 11:51:56 +1000 Subject: [PATCH 01/16] add memory extract to the linux and mac --- .github/workflows/ci.yaml | 36 +++++++++++++ test_scripts/test_iqtree.ps1 | 82 +++++++++++++++++++----------- test_scripts/test_iqtree.sh | 98 +++++++++++++++++++++++------------- 3 files changed, 151 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9095dd1f..4bf935f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,6 +70,14 @@ jobs: run: | chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh + + - name: Upload timing log + if: always() # ensures it uploads even if previous steps fail + uses: actions/upload-artifact@v4 + with: + name: time-log-linux-${{ matrix.gcc-version }} + path: time_log.tsv + - name: Run verify_results.sh run: | @@ -117,6 +125,13 @@ jobs: chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh + - name: Upload timing log + if: always() # ensures it uploads even if previous steps fail + uses: actions/upload-artifact@v4 + with: + name: time-log-Linux-AArch64 + path: time_log.tsv + - name: Run verify_results.sh run: | chmod +x test_scripts/verify_results.sh @@ -202,6 +217,13 @@ jobs: chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh + - name: Upload timing log + if: always() # ensures it uploads even if previous steps fail + uses: actions/upload-artifact@v4 + with: + name: time-log-Mac-x86-64 + path: time_log.tsv + - name: Run verify_results.sh run: | chmod +x test_scripts/verify_results.sh @@ -250,6 +272,13 @@ jobs: chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh + - name: Upload timing log + if: always() # ensures it uploads even if previous steps fail + uses: actions/upload-artifact@v4 + with: + name: time-log-Mac-Arm + path: time_log.tsv + - name: Run verify_results.sh run: | chmod +x test_scripts/verify_results.sh @@ -362,6 +391,13 @@ jobs: run: | ./test_scripts/test_iqtree.ps1 + - name: Upload timing log + if: always() # ensures it uploads even if previous steps fail + uses: actions/upload-artifact@v4 + with: + name: time-log-Windows-x86-64 + path: time_log.tsv + - name: Run verify_results.ps1 shell: pwsh run: | diff --git a/test_scripts/test_iqtree.ps1 b/test_scripts/test_iqtree.ps1 index 593c484f..cbd8e42f 100755 --- a/test_scripts/test_iqtree.ps1 +++ b/test_scripts/test_iqtree.ps1 @@ -1,71 +1,93 @@ $SEED=73073 +$LOGFILE = "time_log.tsv" +"Command`tRealTime(s)`tPeakMemory(MB)" | Out-File -FilePath $LOGFILE -Encoding utf8 + +function Measure-IQTree { + param ( + [string]$CommandLine + ) + + Write-Host "`n===== RUNNING: $CommandLine =====" + + $startTime = Get-Date + + # Start the process + $process = Start-Process powershell -ArgumentList "-Command $CommandLine" -PassThru -Wait + + $endTime = Get-Date + $elapsed = ($endTime - $startTime).TotalSeconds + + # Get peak memory (approx, in MB) + $memMB = [math]::Round($process.PeakWorkingSet64 / 1MB, 2) + + # Append to log + "$CommandLine`t$elapsed`t$memMB" | Out-File -FilePath $LOGFILE -Append -Encoding utf8 +} + + # ./build/iqtree3 -s test_scripts/test_data/small.fa -p test_scripts/test_data/small.nex -m "MFP+MERGE" -T 1 -seed $SEED -./build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle.merge -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle.merge -seed $SEED" Get-Content test_scripts/test_data/turtle.fa.treefile, test_scripts/test_data/turtle.nex.treefile | Set-Content test_scripts/test_data/turtle.trees -./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.merge.best_scheme.nex -z test_scripts/test_data/turtle.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle.test -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.merge.best_scheme.nex -z test_scripts/test_data/turtle.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle.test -seed $SEED -T 1" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -m GTR+F+I+R3+T -te test_scripts/test_data/turtle.trees -T 1 --prefix test_scripts/test_data/turtle.mix -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -m GTR+F+I+R3+T -te test_scripts/test_data/turtle.trees -T 1 --prefix test_scripts/test_data/turtle.mix -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex.best_scheme.nex -z test_scripts/test_data/turtle.trees -n 0 -wpl --prefix test_scripts/test_data/turtle.wpl -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex.best_scheme.nex -z test_scripts/test_data/turtle.trees -n 0 -wpl --prefix test_scripts/test_data/turtle.wpl -seed $SEED -T 1" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -S test_scripts/test_data/turtle.nex --prefix test_scripts/test_data/turtle.loci -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -S test_scripts/test_data/turtle.nex --prefix test_scripts/test_data/turtle.loci -T 1 -seed $SEED" -./build/iqtree3 -t test_scripts/test_data/turtle.nex.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -t test_scripts/test_data/turtle.nex.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed $SEED -T 1" -./build/iqtree3 -t test_scripts/test_data/turtle.fa.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -t test_scripts/test_data/turtle.fa.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed $SEED -T 1" # link-exchange-rates model -./build/iqtree3 -s test_scripts/test_data/turtle.fa -m "MIX{GTR+FO,GTR+FO}" --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.link -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -m `"MIX{GTR+FO,GTR+FO}`" --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.link -seed $SEED -T 1" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -m "MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO}" --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.jc.link -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -m `"MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO}`" --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.jc.link -seed $SEED -T 1" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle.fa -m "MIX+MF" --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -m "MIX+MF" --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed $SEED" ## amino acid test cases # the data set is a subset of the turtle data set echo "Running amino acid test cases..." -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed $SEED" Get-Content test_scripts/test_data/turtle_aa.fasta.treefile, test_scripts/test_data/turtle_aa.nex.treefile | Set-Content test_scripts/test_data/turtle_aa.trees -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed $SEED -T 1" -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m GTR+F+I+R3+T -te test_scripts/test_data/turtle_aa.trees -T 1 --prefix test_scripts/test_data/turtle_aa.mix -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m GTR+F+I+R3+T -te test_scripts/test_data/turtle_aa.trees -T 1 --prefix test_scripts/test_data/turtle_aa.mix -seed $SEED" -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed $SEED -T 1" -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed $SEED" -./build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed $SEED -T 1" -./build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed $SEED -T 1 +Measure-IQTree "./build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed $SEED -T 1" # link-exchange-rates model -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m "MIX{LG+F,WAG+F}" --prefix test_scripts/test_data/turtle_aa.mix -seed $SEED -T 1 - -#./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m "MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO}" --link-exchange-rates --prefix test_scripts/test_data/turtle_aa.mix.jc.link -seed $SEED -T 1 - -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m `"MIX{LG+F,WAG+F}`" --prefix test_scripts/test_data/turtle_aa.mix -seed $SEED -T 1" -./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed $SEED +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed $SEED" -#./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m "MIX+MF" --prefix test_scripts/test_data/turtle_aa.mixfinder -T 1 -seed $SEED # mixture finder is not supported for amino acid data +Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed $SEED" diff --git a/test_scripts/test_iqtree.sh b/test_scripts/test_iqtree.sh index 61cc7a8a..8a5d2ddf 100755 --- a/test_scripts/test_iqtree.sh +++ b/test_scripts/test_iqtree.sh @@ -2,76 +2,104 @@ SEED=73073 -#build/iqtree3 -s test_scripts/test_data/small.fa -p test_scripts/test_data/small.nex -m "MFP+MERGE" -T 1 -seed $SEED +LOGFILE="time_log.tsv" +WD=test_scripts/test_data +BUILD_DIR="build" + +# Initialize TSV file with header +echo -e "Command\tRealTime(s)\tPeakMemory(MB)" > "$LOGFILE" + +run_timed() { + local CMD="$*" + echo -e "\n================ RUNNING =================" + echo "$CMD" + echo "==========================================" + + local OS=$(uname) + local REAL USER SYS PEAK_MEM MEM_MB + + if [[ "$OS" == "Darwin" ]]; then + # macOS + /usr/bin/time -l "$@" 2> tmp_time.txt + REAL=$(grep "real" tmp_time.txt | awk '{print $1}') + USER=$(grep "user" tmp_time.txt | awk '{print $1}') + SYS=$(grep "sys" tmp_time.txt | awk '{print $1}') + PEAK_MEM=$(grep "peak memory footprint" tmp_time.txt | awk '{print $1}') + MEM_MB=$(awk "BEGIN {printf \"%.2f\", $PEAK_MEM / (1024 * 1024)}") + else + # Linux + /usr/bin/time -f "%e %U %S %M" "$@" 2> tmp_time.txt + read REAL USER SYS MEM_KB < tmp_time.txt + MEM_MB=$(awk "BEGIN {printf \"%.2f\", $MEM_KB / 1024}") + fi + + # Append to log + echo -e "$CMD\t$REAL\t$MEM_MB" >> "$LOGFILE" -build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed $SEED + rm -f tmp_time.txt +} -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -B 1000 -T 1 -seed $SEED -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle.merge -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -p ${WD}/turtle.nex -B 1000 -T 1 -seed $SEED -cat test_scripts/test_data/turtle.fa.treefile test_scripts/test_data/turtle.nex.treefile > test_scripts/test_data/turtle.trees -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.merge.best_scheme.nex -z test_scripts/test_data/turtle.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle.test -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -p ${WD}/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix ${WD}/turtle.merge -seed $SEED -build/iqtree3 -s test_scripts/test_data/turtle.fa -m GTR+F+I+R3+T -te test_scripts/test_data/turtle.trees -T 1 --prefix test_scripts/test_data/turtle.mix -seed $SEED +cat ${WD}/turtle.fa.treefile ${WD}/turtle.nex.treefile > ${WD}/turtle.trees +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -p ${WD}/turtle.merge.best_scheme.nex -z ${WD}/turtle.trees -zb 10000 -au -n 0 --prefix ${WD}/turtle.test -seed $SEED -T 1 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex.best_scheme.nex -z test_scripts/test_data/turtle.trees -n 0 -wpl --prefix test_scripts/test_data/turtle.wpl -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -m GTR+F+I+R3+T -te ${WD}/turtle.trees -T 1 --prefix ${WD}/turtle.mix -seed $SEED -build/iqtree3 -s test_scripts/test_data/turtle.fa -S test_scripts/test_data/turtle.nex --prefix test_scripts/test_data/turtle.loci -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -p ${WD}/turtle.nex.best_scheme.nex -z ${WD}/turtle.trees -n 0 -wpl --prefix ${WD}/turtle.wpl -seed $SEED -T 1 -build/iqtree3 -t test_scripts/test_data/turtle.nex.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -S ${WD}/turtle.nex --prefix ${WD}/turtle.loci -T 1 -seed $SEED -build/iqtree3 -t test_scripts/test_data/turtle.fa.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -t ${WD}/turtle.nex.treefile --gcf ${WD}/turtle.loci.treefile -s ${WD}/turtle.fa --scf 100 -seed $SEED -T 1 + +run_timed ${BUILD_DIR}/iqtree3 -t ${WD}/turtle.fa.treefile --gcf ${WD}/turtle.loci.treefile -s ${WD}/turtle.fa --scf 100 -seed $SEED -T 1 # link-exchange-rates model -build/iqtree3 -s test_scripts/test_data/turtle.fa -m "MIX{GTR+FO,GTR+FO}" --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.link -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -m "MIX{GTR+FO,GTR+FO}" --link-exchange-rates --prefix ${WD}/turtle.mix.link -seed $SEED -T 1 -build/iqtree3 -s test_scripts/test_data/turtle.fa -m "MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO}" --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.jc.link -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -m "MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO}" --link-exchange-rates --prefix ${WD}/turtle.mix.jc.link -seed $SEED -T 1 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -p ${WD}/turtle.nex -g ${WD}/turtle.constr.tree --prefix ${WD}/turtle.nex.constr -T 1 -seed $SEED -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -p ${WD}/turtle.nex -g ${WD}/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix ${WD}/turtle.nex.constr2 -T 1 -seed $SEED -build/iqtree3 -s test_scripts/test_data/turtle.fa -m "MIX+MF" --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s ${WD}/turtle.fa -m "MIX+MF" --prefix ${WD}/turtle.mixfinder -T 1 -seed $SEED ## amino acid test cases # the data set is a subset of the turtle data set echo "Running amino acid test cases..." -WD=test_scripts/test_data -BUILD_DIR="build" AA_FASTA=${WD}/turtle_aa.fasta AA_NEX=${WD}/turtle_aa.nex AA_prefix=${WD}/turtle_aa -${BUILD_DIR}/iqtree3 -s $AA_FASTA -B 1000 -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -B 1000 -T 1 -seed $SEED -${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -B 1000 -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -B 1000 -T 1 -seed $SEED -${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix ${WD}/turtle_aa.merge -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix ${WD}/turtle_aa.merge -seed $SEED cat $AA_FASTA.treefile $AA_NEX.treefile > ${WD}/turtle_aa.trees -${BUILD_DIR}/iqtree3 -s $AA_FASTA -p ${WD}/turtle_aa.merge.best_scheme.nex -z ${WD}/turtle_aa.trees -zb 10000 -au -n 0 --prefix ${WD}/turtle_aa.test -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p ${WD}/turtle_aa.merge.best_scheme.nex -z ${WD}/turtle_aa.trees -zb 10000 -au -n 0 --prefix ${WD}/turtle_aa.test -seed $SEED -T 1 -${BUILD_DIR}/iqtree3 -s $AA_FASTA -m GTR+F+I+R3+T -te ${WD}/turtle_aa.trees -T 1 --prefix ${WD}/turtle_aa.mix -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -m GTR+F+I+R3+T -te ${WD}/turtle_aa.trees -T 1 --prefix ${WD}/turtle_aa.mix -seed $SEED -${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX.best_scheme.nex -z ${WD}/turtle_aa.trees -n 0 -wpl --prefix ${WD}/turtle_aa.wpl -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX.best_scheme.nex -z ${WD}/turtle_aa.trees -n 0 -wpl --prefix ${WD}/turtle_aa.wpl -seed $SEED -T 1 -${BUILD_DIR}/iqtree3 -s $AA_FASTA -S $AA_NEX --prefix ${WD}/turtle_aa.loci -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -S $AA_NEX --prefix ${WD}/turtle_aa.loci -T 1 -seed $SEED -${BUILD_DIR}/iqtree3 -t $AA_NEX.treefile --gcf ${WD}/turtle_aa.loci.treefile -s $AA_FASTA --scf 100 -seed $SEED -T 1 - -${BUILD_DIR}/iqtree3 -t $AA_FASTA.treefile --gcf ${WD}/turtle_aa.loci.treefile -s $AA_FASTA --scf 100 -seed $SEED -T 1 - -# link-exchange-rates model +run_timed ${BUILD_DIR}/iqtree3 -t $AA_NEX.treefile --gcf ${WD}/turtle_aa.loci.treefile -s $AA_FASTA --scf 100 -seed $SEED -T 1 -${BUILD_DIR}/iqtree3 -s $AA_FASTA -m "MIX{LG+F,WAG+F}" --prefix ${WD}/turtle_aa.mix -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -t $AA_FASTA.treefile --gcf ${WD}/turtle_aa.loci.treefile -s $AA_FASTA --scf 100 -seed $SEED -T 1 -#${BUILD_DIR}/iqtree3 -s $AA_FASTA -m "MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO}" --link-exchange-rates --prefix ${WD}/turtle_aa.mix.jc.link -seed $SEED -T 1 +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -m "MIX{LG+F,WAG+F}" --prefix ${WD}/turtle_aa.mix -seed $SEED -T 1 -${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -g ${WD}/turtle.constr.tree --prefix $AA_NEX.constr -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -g ${WD}/turtle.constr.tree --prefix $AA_NEX.constr -T 1 -seed $SEED -${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -g ${WD}/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix $AA_NEX.constr2 -T 1 -seed $SEED +run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -g ${WD}/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix $AA_NEX.constr2 -T 1 -seed $SEED -#${BUILD_DIR}/iqtree3 -s $AA_FASTA -m "MIX+MF" --prefix ${WD}/turtle_aa.mixfinder -T 1 -seed $SEED # mixture finder is not supported for amino acid data From 53473be8693491685baeeeb3a89034d6c7163192 Mon Sep 17 00:00:00 2001 From: Hashara Date: Wed, 2 Jul 2025 12:51:50 +1000 Subject: [PATCH 02/16] bug fix; modify ps1 for measure memory --- test_scripts/test_iqtree.ps1 | 31 +++++++++++++++++++++---------- test_scripts/test_iqtree.sh | 2 -- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/test_scripts/test_iqtree.ps1 b/test_scripts/test_iqtree.ps1 index cbd8e42f..22ed581a 100755 --- a/test_scripts/test_iqtree.ps1 +++ b/test_scripts/test_iqtree.ps1 @@ -12,20 +12,33 @@ function Measure-IQTree { $startTime = Get-Date - # Start the process - $process = Start-Process powershell -ArgumentList "-Command $CommandLine" -PassThru -Wait + # Start the command in a child PowerShell process + $proc = Start-Process -FilePath "powershell" -ArgumentList "-NoProfile", "-Command", $CommandLine -PassThru + $procId = $proc.Id + $peakMemory = 0 + + # Monitor the child process's memory usage + while (-not $proc.HasExited) { + Start-Sleep -Milliseconds 200 + try { + $currentMem = (Get-Process -Id $procId -ErrorAction Stop).WorkingSet64 / 1MB + if ($currentMem -gt $peakMemory) { + $peakMemory = $currentMem + } + } catch { + break + } + } $endTime = Get-Date - $elapsed = ($endTime - $startTime).TotalSeconds + $elapsed = [math]::Round(($endTime - $startTime).TotalSeconds, 2) - # Get peak memory (approx, in MB) - $memMB = [math]::Round($process.PeakWorkingSet64 / 1MB, 2) - - # Append to log - "$CommandLine`t$elapsed`t$memMB" | Out-File -FilePath $LOGFILE -Append -Encoding utf8 + # Write timing and memory data to log + "$CommandLine`t$elapsed`t$([math]::Round($peakMemory, 2))" | Out-File -FilePath $LOGFILE -Append -Encoding utf8 } + # ./build/iqtree3 -s test_scripts/test_data/small.fa -p test_scripts/test_data/small.nex -m "MFP+MERGE" -T 1 -seed $SEED Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed $SEED" @@ -74,8 +87,6 @@ Get-Content test_scripts/test_data/turtle_aa.fasta.treefile, test_scripts/test_d Set-Content test_scripts/test_data/turtle_aa.trees Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed $SEED -T 1" -Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m GTR+F+I+R3+T -te test_scripts/test_data/turtle_aa.trees -T 1 --prefix test_scripts/test_data/turtle_aa.mix -seed $SEED" - Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed $SEED -T 1" Measure-IQTree "./build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed $SEED" diff --git a/test_scripts/test_iqtree.sh b/test_scripts/test_iqtree.sh index 8a5d2ddf..157f4197 100755 --- a/test_scripts/test_iqtree.sh +++ b/test_scripts/test_iqtree.sh @@ -87,8 +87,6 @@ run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX -B 1000 -T 1 -m MFP+MERGE cat $AA_FASTA.treefile $AA_NEX.treefile > ${WD}/turtle_aa.trees run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p ${WD}/turtle_aa.merge.best_scheme.nex -z ${WD}/turtle_aa.trees -zb 10000 -au -n 0 --prefix ${WD}/turtle_aa.test -seed $SEED -T 1 -run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -m GTR+F+I+R3+T -te ${WD}/turtle_aa.trees -T 1 --prefix ${WD}/turtle_aa.mix -seed $SEED - run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -p $AA_NEX.best_scheme.nex -z ${WD}/turtle_aa.trees -n 0 -wpl --prefix ${WD}/turtle_aa.wpl -seed $SEED -T 1 run_timed ${BUILD_DIR}/iqtree3 -s $AA_FASTA -S $AA_NEX --prefix ${WD}/turtle_aa.loci -T 1 -seed $SEED From 7b5dc3002b5d9bfa0447ce585169196633f03e45 Mon Sep 17 00:00:00 2001 From: Hashara Date: Wed, 2 Jul 2025 15:46:10 +1000 Subject: [PATCH 03/16] add memory checking for linux --- .github/workflows/ci.yaml | 41 +++------------------- test_scripts/test_data/expected_memory.tsv | 26 ++++++++++++++ test_scripts/verify_memory.sh | 39 ++++++++++++++++++++ 3 files changed, 70 insertions(+), 36 deletions(-) create mode 100644 test_scripts/test_data/expected_memory.tsv create mode 100644 test_scripts/verify_memory.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4bf935f1..742a4263 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,14 +70,6 @@ jobs: run: | chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh - - - name: Upload timing log - if: always() # ensures it uploads even if previous steps fail - uses: actions/upload-artifact@v4 - with: - name: time-log-linux-${{ matrix.gcc-version }} - path: time_log.tsv - - name: Run verify_results.sh run: | @@ -125,13 +117,6 @@ jobs: chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh - - name: Upload timing log - if: always() # ensures it uploads even if previous steps fail - uses: actions/upload-artifact@v4 - with: - name: time-log-Linux-AArch64 - path: time_log.tsv - - name: Run verify_results.sh run: | chmod +x test_scripts/verify_results.sh @@ -142,6 +127,11 @@ jobs: chmod +x test_scripts/verify_runtime.sh ./test_scripts/verify_runtime.sh 6 + - name: Run verify_memory.sh + run: | + chmod +x test_scripts/verify_memory.sh + ./test_scripts/verify_memory.sh 6 + compile-linux-universal: name: Linux Universal runs-on: ubuntu-latest @@ -217,13 +207,6 @@ jobs: chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh - - name: Upload timing log - if: always() # ensures it uploads even if previous steps fail - uses: actions/upload-artifact@v4 - with: - name: time-log-Mac-x86-64 - path: time_log.tsv - - name: Run verify_results.sh run: | chmod +x test_scripts/verify_results.sh @@ -272,13 +255,6 @@ jobs: chmod +x test_scripts/test_iqtree.sh ./test_scripts/test_iqtree.sh - - name: Upload timing log - if: always() # ensures it uploads even if previous steps fail - uses: actions/upload-artifact@v4 - with: - name: time-log-Mac-Arm - path: time_log.tsv - - name: Run verify_results.sh run: | chmod +x test_scripts/verify_results.sh @@ -391,13 +367,6 @@ jobs: run: | ./test_scripts/test_iqtree.ps1 - - name: Upload timing log - if: always() # ensures it uploads even if previous steps fail - uses: actions/upload-artifact@v4 - with: - name: time-log-Windows-x86-64 - path: time_log.tsv - - name: Run verify_results.ps1 shell: pwsh run: | diff --git a/test_scripts/test_data/expected_memory.tsv b/test_scripts/test_data/expected_memory.tsv new file mode 100644 index 00000000..a85c9851 --- /dev/null +++ b/test_scripts/test_data/expected_memory.tsv @@ -0,0 +1,26 @@ +Command diff-threshold Linux-gcc-9 Linux-gcc-12 Linux-aarch64 mac-os-x86-64 mac-os-arm64 windows-x86 +build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed 73073 3 18.98 18.89 17.73 13.53 15.53 57.84 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -seed 73073 3 19.04 19.05 17.79 13.18 13.97 58.07 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle.merge -seed 73073 3 19.15 19.08 17.99 13.54 15.52 58.04 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.merge.best_scheme.nex -z test_scripts/test_data/turtle.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle.test -seed 73073 -T 1 3 27.80 27.77 26.76 22.50 23.45 58 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m GTR+F+I+R3+T -te test_scripts/test_data/turtle.trees -T 1 --prefix test_scripts/test_data/turtle.mix -seed 73073 3 9.79 10.05 8.92 4.39 5.44 58.15 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex.best_scheme.nex -z test_scripts/test_data/turtle.trees -n 0 -wpl --prefix test_scripts/test_data/turtle.wpl -seed 73073 -T 1 3 9.27 9.30 8.18 3.61 4.75 58.3 +build/iqtree3 -s test_scripts/test_data/turtle.fa -S test_scripts/test_data/turtle.nex --prefix test_scripts/test_data/turtle.loci -T 1 -seed 73073 3 10.43 10.55 8.79 5.66 6.59 58.02 +build/iqtree3 -t test_scripts/test_data/turtle.nex.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.29 2.75 55.18 +build/iqtree3 -t test_scripts/test_data/turtle.fa.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.27 3.00 38.01 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR+FO,GTR+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.link -seed 73073 -T 1 3 9.17 9.05 7.92 3.47 4.80 55.19 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.jc.link -seed 73073 -T 1 3 9.17 8.84 7.92 3.74 4.49 54.57 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed 73073 3 10.57 10.45 8.80 5.86 6.78 58.03 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed 73073 3 18.82 18.70 17.55 13.29 14.00 58.3 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX+MF --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed 73073 3 14.55 15.50 11.68 9.21 9.28 57.19 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 12.72 58 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 3 76.22 67.05 26.73 23.80 16.39 58.03 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 27.49 27.51 26.11 22.30 16.56 58.13 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed 73073 -T 1 3 33.53 33.46 32.43 31.32 30.30 57.96 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed 73073 -T 1 3 18.26 18.32 16.95 14.17 12.81 58.07 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed 73073 3 16.49 16.11 13.53 11.07 9.69 57.98 +build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.38 3.06 54.57 +build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.29 6.55 5.93 2.29 3.09 55.05 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 11.79 11.80 10.67 6.39 6.78 55.1 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 43.78 22.79 18.28 18.67 10.61 58.11 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 50.73 51.92 26.53 23.55 16.72 57.86 diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh new file mode 100644 index 00000000..eaa1d6ab --- /dev/null +++ b/test_scripts/verify_memory.sh @@ -0,0 +1,39 @@ +#!/bin/bash +expected_column="$1" + +WD="test_scripts/test_data" +input_file="${WD}/expected_memory.tsv" +reported_file="${WD}/time_log.tsv" +selected_columns_file="${WD}/selected_columns.tsv" +cut -f1,2,3,"$expected_column" "$input_file" > "${selected_columns_file}" +final_file="${WD}/combined_with_reported.tsv" + +# assuming the reported file and expected file have the same order of commands +cut -f"$expected_column" "$reported_file" > /tmp/reported_column.tsv +paste "$selected_columns_file" /tmp/reported_column.txt > "$final_file" + + +fail_count=0 + +echo -e "Command\tExpected\tThreshold\tActual\tExceededBy" + +# Skip header +tail -n +2 "$input_file" | while IFS=$'\t' read -r command threshold expected reported; do + # Compute allowed = expected + threshold + allowed=$(echo "$expected + $threshold" | bc -l) + # Check if reported > allowed + is_exceed=$(echo "$reported > $allowed" | bc -l) + if [ "$is_exceed" -eq 1 ]; then + diff=$(echo "$reported - $expected" | bc -l) + echo -e "$command\t$expected\t$threshold\t$reported\t$diff" + ((fail_count++)) + fi +done + +echo +if [ "$fail_count" -eq 0 ]; then + echo "✅ All runtime checks passed." +else + echo "❌ $fail_count checks failed." + exit 1 +fi From ced25348ba5aa12f771bf245eba30dc766f0fd3a Mon Sep 17 00:00:00 2001 From: Hashara Date: Wed, 2 Jul 2025 16:07:25 +1000 Subject: [PATCH 04/16] bug fix: memory checking for linux --- test_scripts/verify_memory.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh index eaa1d6ab..1bb95e79 100644 --- a/test_scripts/verify_memory.sh +++ b/test_scripts/verify_memory.sh @@ -3,14 +3,14 @@ expected_column="$1" WD="test_scripts/test_data" input_file="${WD}/expected_memory.tsv" -reported_file="${WD}/time_log.tsv" +reported_file="time_log.tsv" selected_columns_file="${WD}/selected_columns.tsv" -cut -f1,2,3,"$expected_column" "$input_file" > "${selected_columns_file}" +cut -f1,2,"$expected_column" "$input_file" > "${selected_columns_file}" final_file="${WD}/combined_with_reported.tsv" # assuming the reported file and expected file have the same order of commands -cut -f"$expected_column" "$reported_file" > /tmp/reported_column.tsv -paste "$selected_columns_file" /tmp/reported_column.txt > "$final_file" +cut -f3 "$reported_file" > /tmp/reported_column.tsv +paste "$selected_columns_file" /tmp/reported_column.tsv > "$final_file" fail_count=0 @@ -18,19 +18,22 @@ fail_count=0 echo -e "Command\tExpected\tThreshold\tActual\tExceededBy" # Skip header -tail -n +2 "$input_file" | while IFS=$'\t' read -r command threshold expected reported; do - # Compute allowed = expected + threshold +while IFS=$'\t' read -r command threshold expected reported; do allowed=$(echo "$expected + $threshold" | bc -l) - # Check if reported > allowed is_exceed=$(echo "$reported > $allowed" | bc -l) - if [ "$is_exceed" -eq 1 ]; then + + if [ "$is_exceed" = "1" ]; then diff=$(echo "$reported - $expected" | bc -l) - echo -e "$command\t$expected\t$threshold\t$reported\t$diff" + echo "❌ $command exceeded the allowed memory usage." + echo "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB" ((fail_count++)) + else + echo "✅ $command passed the memory check." + diff=$(echo "$reported - $expected" | bc -l) + echo -e "$command\t$expected\t$threshold\t$reported\t$diff" fi -done +done < <(tail -n +2 "$final_file") -echo if [ "$fail_count" -eq 0 ]; then echo "✅ All runtime checks passed." else From 8a2ac58dda48b19f9a52e1f5e41757a715db8c22 Mon Sep 17 00:00:00 2001 From: Hashara Date: Thu, 3 Jul 2025 11:20:55 +1000 Subject: [PATCH 05/16] memory checking for linux and mac --- .github/workflows/ci.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 742a4263..152a70f7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -81,6 +81,11 @@ jobs: chmod +x test_scripts/verify_runtime.sh ./test_scripts/verify_runtime.sh "${{ matrix.runtime-arg }}" + - name: Run verify_memory.sh + run: | + chmod +x test_scripts/verify_memory.sh + ./test_scripts/verify_memory.sh "${{ matrix.runtime-arg }}" + build-linux-aarch64: name: Linux aarch64 runs-on: ubuntu-22.04-arm @@ -217,6 +222,11 @@ jobs: chmod +x test_scripts/verify_runtime.sh ./test_scripts/verify_runtime.sh 7 + - name: Run verify_memory.sh + run: | + chmod +x test_scripts/verify_memory.sh + ./test_scripts/verify_memory.sh 7 + build-macos-arm: name: Mac OS ARM64 runs-on: macos-14 @@ -265,6 +275,11 @@ jobs: chmod +x test_scripts/verify_runtime.sh ./test_scripts/verify_runtime.sh 8 + - name: Run verify_memory.sh + run: | + chmod +x test_scripts/verify_memory.sh + ./test_scripts/verify_memory.sh 8 + compile-mac-universal: name: Mac OS Universal runs-on: macos-14 From c1c7f002b6d96c4a639af1ab166a6f8253b8f628 Mon Sep 17 00:00:00 2001 From: Hashara Date: Thu, 3 Jul 2025 13:15:42 +1000 Subject: [PATCH 06/16] memory checking for windows --- .github/workflows/ci.yaml | 4 ++ test_scripts/verify_memory.ps1 | 68 ++++++++++++++++++++++++++++++++++ test_scripts/verify_memory.sh | 2 +- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 test_scripts/verify_memory.ps1 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 152a70f7..ffe32155 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -391,3 +391,7 @@ jobs: shell: pwsh run: | ./test_scripts/verify_runtime.ps1 + + - name: Run verify_memory.sh + run: | + ./test_scripts/verify_memory.ps1 \ No newline at end of file diff --git a/test_scripts/verify_memory.ps1 b/test_scripts/verify_memory.ps1 new file mode 100644 index 00000000..c962394c --- /dev/null +++ b/test_scripts/verify_memory.ps1 @@ -0,0 +1,68 @@ +param ( + [int]$ExpectedColumn # 3 = ExpectedMemory or Runtime +) + +$WD = "test_scripts/test_data" +$expectedFile = Join-Path $WD "expected_memory.tsv" +$reportedFile = "time_log.tsv" +$selectedColumnsFile = Join-Path $WD "selected_columns.tsv" +$reportedColumnFile = "$env:TEMP\reported_column.tsv" +$finalFile = Join-Path $WD "combined_with_reported.tsv" + +# Read expected: Command, Threshold, ExpectedColumn +$expectedLines = Get-Content $expectedFile | Select-Object -Skip 1 +$selectedColumns = foreach ($line in $expectedLines) { + $parts = $line -split "`t" + "$($parts[0])`t$($parts[1])`t$($parts[$ExpectedColumn - 1])" +} +$selectedColumns | Set-Content $selectedColumnsFile + +# Read reported column from time_log.tsv (column 3 = RealTime, 4 = Memory) +$reportedLines = Get-Content $reportedFile | Select-Object -Skip 1 +$reportedColumn = foreach ($line in $reportedLines) { + $parts = $line -split "`t" + $parts[2] # column 3 = memory (0-based index) +} +$reportedColumn | Set-Content $reportedColumnFile + +# Combine both files +$combinedLines = @() +for ($i = 0; $i -lt $selectedColumns.Count; $i++) { + $combinedLines += "$($selectedColumns[$i])`t$($reportedColumn[$i])" +} +$combinedLines | Set-Content $finalFile + +# Now compare +Write-Host "`nCommand`tExpected`tThreshold`tActual`tExceededBy" +$failCount = 0 +$finalLines = Get-Content $finalFile + +foreach ($line in $finalLines) { + $parts = $line -split "`t" + $command = $parts[0] + $threshold = [double]$parts[1] + $expected = [double]$parts[2] + $reported = [double]$parts[3] + + $allowed = $expected + $threshold + $exceededBy = $reported - $expected + + if ($reported -gt $allowed) { + Write-Host "❌ $command exceeded the allowed usage." + Write-Host "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB" + $failCount++ + } else { + Write-Host "✅ $command passed the check." + Write-Host "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB" + } +} + +Write-Host "" + +if ($failCount -eq 0) { + Write-Host "✅ All runtime/memory checks passed." + exit 0 +} else { + Write-Host "❌ $failCount checks failed." + exit 1 +} diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh index 1bb95e79..f7c12cef 100644 --- a/test_scripts/verify_memory.sh +++ b/test_scripts/verify_memory.sh @@ -30,7 +30,7 @@ while IFS=$'\t' read -r command threshold expected reported; do else echo "✅ $command passed the memory check." diff=$(echo "$reported - $expected" | bc -l) - echo -e "$command\t$expected\t$threshold\t$reported\t$diff" + echo "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB" fi done < <(tail -n +2 "$final_file") From fd310c806a4ed895f5c9b06d9806f2aa9e90c64c Mon Sep 17 00:00:00 2001 From: Hashara Date: Thu, 3 Jul 2025 14:10:07 +1000 Subject: [PATCH 07/16] fix index in memory checking --- .github/workflows/ci.yaml | 10 ++++++---- test_scripts/test_data/expected_memory.tsv | 2 +- test_scripts/verify_memory.ps1 | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ffe32155..8f3537d1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,11 +25,13 @@ jobs: cmake-version: 3.14.7 upload: true runtime-arg: 4 + memory-arg: 3 # Latest supported gcc and cmake versions - gcc-version: 12 cmake-version: latest upload: false runtime-arg: 5 + memory-arg: 4 steps: - name: Checkout @@ -84,7 +86,7 @@ jobs: - name: Run verify_memory.sh run: | chmod +x test_scripts/verify_memory.sh - ./test_scripts/verify_memory.sh "${{ matrix.runtime-arg }}" + ./test_scripts/verify_memory.sh "${{ matrix.memory-arg }}" build-linux-aarch64: name: Linux aarch64 @@ -135,7 +137,7 @@ jobs: - name: Run verify_memory.sh run: | chmod +x test_scripts/verify_memory.sh - ./test_scripts/verify_memory.sh 6 + ./test_scripts/verify_memory.sh 5 compile-linux-universal: name: Linux Universal @@ -225,7 +227,7 @@ jobs: - name: Run verify_memory.sh run: | chmod +x test_scripts/verify_memory.sh - ./test_scripts/verify_memory.sh 7 + ./test_scripts/verify_memory.sh 6 build-macos-arm: name: Mac OS ARM64 @@ -278,7 +280,7 @@ jobs: - name: Run verify_memory.sh run: | chmod +x test_scripts/verify_memory.sh - ./test_scripts/verify_memory.sh 8 + ./test_scripts/verify_memory.sh 7 compile-mac-universal: name: Mac OS Universal diff --git a/test_scripts/test_data/expected_memory.tsv b/test_scripts/test_data/expected_memory.tsv index a85c9851..983ad54f 100644 --- a/test_scripts/test_data/expected_memory.tsv +++ b/test_scripts/test_data/expected_memory.tsv @@ -22,5 +22,5 @@ build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_dat build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.38 3.06 54.57 build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.29 6.55 5.93 2.29 3.09 55.05 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 11.79 11.80 10.67 6.39 6.78 55.1 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 43.78 22.79 18.28 18.67 10.61 58.11 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 43.78 27.91 18.28 18.67 10.61 58.11 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 50.73 51.92 26.53 23.55 16.72 57.86 diff --git a/test_scripts/verify_memory.ps1 b/test_scripts/verify_memory.ps1 index c962394c..6e7ef551 100644 --- a/test_scripts/verify_memory.ps1 +++ b/test_scripts/verify_memory.ps1 @@ -1,5 +1,5 @@ param ( - [int]$ExpectedColumn # 3 = ExpectedMemory or Runtime + [int] $ExpectedColumn = 7 ) $WD = "test_scripts/test_data" From 5c1c5b82dedadc7a5f4f387f5dfc21bdc6f9cfeb Mon Sep 17 00:00:00 2001 From: Hashara Date: Thu, 3 Jul 2025 15:20:53 +1000 Subject: [PATCH 08/16] fix index in memory checking, update values for failing checks --- test_scripts/test_data/expected_memory.tsv | 8 ++++---- test_scripts/verify_memory.ps1 | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test_scripts/test_data/expected_memory.tsv b/test_scripts/test_data/expected_memory.tsv index 983ad54f..592ffefa 100644 --- a/test_scripts/test_data/expected_memory.tsv +++ b/test_scripts/test_data/expected_memory.tsv @@ -13,14 +13,14 @@ build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR{1,1,1,1,1,1}+FO,GTR build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed 73073 3 10.57 10.45 8.80 5.86 6.78 58.03 build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed 73073 3 18.82 18.70 17.55 13.29 14.00 58.3 build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX+MF --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed 73073 3 14.55 15.50 11.68 9.21 9.28 57.19 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 12.72 58 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 15.77 58 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 3 76.22 67.05 26.73 23.80 16.39 58.03 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 27.49 27.51 26.11 22.30 16.56 58.13 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 35.97 27.51 26.11 22.30 16.56 58.13 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed 73073 -T 1 3 33.53 33.46 32.43 31.32 30.30 57.96 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed 73073 -T 1 3 18.26 18.32 16.95 14.17 12.81 58.07 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed 73073 3 16.49 16.11 13.53 11.07 9.69 57.98 build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.38 3.06 54.57 build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.29 6.55 5.93 2.29 3.09 55.05 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 11.79 11.80 10.67 6.39 6.78 55.1 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 43.78 27.91 18.28 18.67 10.61 58.11 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 50.73 51.92 26.53 23.55 16.72 57.86 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 43.78 35.18 18.28 18.67 10.61 58.11 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 50.73 59.30 26.53 23.55 16.72 57.86 diff --git a/test_scripts/verify_memory.ps1 b/test_scripts/verify_memory.ps1 index 6e7ef551..5d7e2f28 100644 --- a/test_scripts/verify_memory.ps1 +++ b/test_scripts/verify_memory.ps1 @@ -1,5 +1,5 @@ param ( - [int] $ExpectedColumn = 7 + [int] $ExpectedColumn = 8 ) $WD = "test_scripts/test_data" From c9c09f4af7245a4965d7bfac4594442f0b7cd066 Mon Sep 17 00:00:00 2001 From: Hashara Date: Thu, 3 Jul 2025 15:48:10 +1000 Subject: [PATCH 09/16] update values for failing checks --- test_scripts/test_data/expected_memory.tsv | 50 ++++++++++---------- test_scripts/test_data/expected_runtimes.tsv | 24 +++++----- test_scripts/test_iqtree.ps1 | 20 ++++++-- 3 files changed, 53 insertions(+), 41 deletions(-) diff --git a/test_scripts/test_data/expected_memory.tsv b/test_scripts/test_data/expected_memory.tsv index 592ffefa..c4ac1eec 100644 --- a/test_scripts/test_data/expected_memory.tsv +++ b/test_scripts/test_data/expected_memory.tsv @@ -1,26 +1,26 @@ Command diff-threshold Linux-gcc-9 Linux-gcc-12 Linux-aarch64 mac-os-x86-64 mac-os-arm64 windows-x86 -build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed 73073 3 18.98 18.89 17.73 13.53 15.53 57.84 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -seed 73073 3 19.04 19.05 17.79 13.18 13.97 58.07 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle.merge -seed 73073 3 19.15 19.08 17.99 13.54 15.52 58.04 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.merge.best_scheme.nex -z test_scripts/test_data/turtle.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle.test -seed 73073 -T 1 3 27.80 27.77 26.76 22.50 23.45 58 -build/iqtree3 -s test_scripts/test_data/turtle.fa -m GTR+F+I+R3+T -te test_scripts/test_data/turtle.trees -T 1 --prefix test_scripts/test_data/turtle.mix -seed 73073 3 9.79 10.05 8.92 4.39 5.44 58.15 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex.best_scheme.nex -z test_scripts/test_data/turtle.trees -n 0 -wpl --prefix test_scripts/test_data/turtle.wpl -seed 73073 -T 1 3 9.27 9.30 8.18 3.61 4.75 58.3 -build/iqtree3 -s test_scripts/test_data/turtle.fa -S test_scripts/test_data/turtle.nex --prefix test_scripts/test_data/turtle.loci -T 1 -seed 73073 3 10.43 10.55 8.79 5.66 6.59 58.02 -build/iqtree3 -t test_scripts/test_data/turtle.nex.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.29 2.75 55.18 -build/iqtree3 -t test_scripts/test_data/turtle.fa.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.27 3.00 38.01 -build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR+FO,GTR+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.link -seed 73073 -T 1 3 9.17 9.05 7.92 3.47 4.80 55.19 -build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.jc.link -seed 73073 -T 1 3 9.17 8.84 7.92 3.74 4.49 54.57 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed 73073 3 10.57 10.45 8.80 5.86 6.78 58.03 -build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed 73073 3 18.82 18.70 17.55 13.29 14.00 58.3 -build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX+MF --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed 73073 3 14.55 15.50 11.68 9.21 9.28 57.19 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 15.77 58 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 3 76.22 67.05 26.73 23.80 16.39 58.03 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 35.97 27.51 26.11 22.30 16.56 58.13 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed 73073 -T 1 3 33.53 33.46 32.43 31.32 30.30 57.96 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed 73073 -T 1 3 18.26 18.32 16.95 14.17 12.81 58.07 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed 73073 3 16.49 16.11 13.53 11.07 9.69 57.98 -build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.38 3.06 54.57 -build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.29 6.55 5.93 2.29 3.09 55.05 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 11.79 11.80 10.67 6.39 6.78 55.1 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 43.78 35.18 18.28 18.67 10.61 58.11 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 50.73 59.30 26.53 23.55 16.72 57.86 +build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed 73073 3 18.98 18.89 17.73 13.53 15.53 20.09 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -seed 73073 3 19.04 19.05 17.79 13.18 13.97 20.16 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle.merge -seed 73073 3 19.15 19.08 17.99 13.54 15.52 17.65 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.merge.best_scheme.nex -z test_scripts/test_data/turtle.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle.test -seed 73073 -T 1 3 27.80 27.77 26.76 22.50 23.45 28.15 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m GTR+F+I+R3+T -te test_scripts/test_data/turtle.trees -T 1 --prefix test_scripts/test_data/turtle.mix -seed 73073 3 9.79 10.05 8.92 4.39 5.44 9.45 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex.best_scheme.nex -z test_scripts/test_data/turtle.trees -n 0 -wpl --prefix test_scripts/test_data/turtle.wpl -seed 73073 -T 1 3 9.27 9.30 8.18 3.61 4.75 9.43 +build/iqtree3 -s test_scripts/test_data/turtle.fa -S test_scripts/test_data/turtle.nex --prefix test_scripts/test_data/turtle.loci -T 1 -seed 73073 3 10.43 10.55 8.79 5.66 6.59 10.3 +build/iqtree3 -t test_scripts/test_data/turtle.nex.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.29 2.75 6.57 +build/iqtree3 -t test_scripts/test_data/turtle.fa.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.27 3.00 6.59 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR+FO,GTR+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.link -seed 73073 -T 1 3 9.17 9.05 7.92 3.47 4.80 9.2 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.jc.link -seed 73073 -T 1 3 9.17 8.84 7.92 3.74 4.49 9.36 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed 73073 3 10.57 10.45 8.80 5.86 6.78 10.43 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed 73073 3 18.82 18.70 17.55 13.29 14.00 19.74 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX+MF --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed 73073 3 14.55 15.50 11.68 9.21 9.28 20.19 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 15.77 22.72 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 3 76.22 67.05 26.73 23.80 16.39 24.45 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 41.34 31.46 26.11 22.30 16.56 25.05 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed 73073 -T 1 3 33.53 33.46 32.43 31.32 30.30 33.82 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed 73073 -T 1 3 18.26 18.32 16.95 14.17 12.81 14.99 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed 73073 3 16.49 16.11 13.53 11.07 9.69 14.96 +build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.30 6.55 5.92 2.38 3.06 6.74 +build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.29 6.55 5.93 2.29 3.09 6.64 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 11.79 11.80 10.67 6.39 6.78 11.94 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 59.79 60.66 18.28 18.67 10.61 16.95 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 50.73 70.88 26.53 23.55 16.72 26.39 diff --git a/test_scripts/test_data/expected_runtimes.tsv b/test_scripts/test_data/expected_runtimes.tsv index 527e905c..a025d890 100644 --- a/test_scripts/test_data/expected_runtimes.tsv +++ b/test_scripts/test_data/expected_runtimes.tsv @@ -2,21 +2,21 @@ turtle.fa.iqtree Total CPU time used 2 3.128169 3.299343 4.909145 4.93771 3.595236 3.21875 turtle.loci.iqtree Total CPU time used 2 3.376 3.6 4.561 5.737 2.786 3.359 turtle.merge.iqtree Total CPU time used 2 3.22134 3.336272 4.881305 4.074864 3.063053 3.34375 -turtle.mix.iqtree Total CPU time used 1 2.288 2.437 3.653 2.043 2.607 2.391 -turtle.mix.jc.link.iqtree Total CPU time used 1 0.678048 0.716485 1.05925 0.79052 0.798578 0.8125 -turtle.mix.link.iqtree Total CPU time used 1 0.765474 0.829717 1.19517 0.856055 0.868658 0.90625 -turtle.mixfinder.iqtree Total CPU time used 3 9.34105 9.95267 14.5544 9.57637 8.78048 8.40625 +turtle.mix.iqtree Total CPU time used 1 2.288 2.437 3.653 4.416 2.607 2.391 +turtle.mix.jc.link.iqtree Total CPU time used 1 0.678048 0.716485 1.05925 1.97384 0.798578 0.8125 +turtle.mix.link.iqtree Total CPU time used 1 0.765474 0.829717 1.19517 2.31644 0.868658 0.90625 +turtle.mixfinder.iqtree Total CPU time used 3 9.34105 9.95267 14.5544 13.1422 8.78048 8.40625 turtle.nex.constr.iqtree Total CPU time used 3 2.74033 2.88714 3.45122 4.30755 2.83421 2.85938 turtle.nex.constr2.iqtree Total CPU time used 3 3.172122 3.296328 3.914713 4.247386 3.261848 3.484375 turtle.nex.iqtree Total CPU time used 3 3.139167 3.257494 4.000374 4.824423 3.217744 3.578125 turtle.test.iqtree Total CPU time used 1 0.235 0.242 0.349 0.192 0.225 0.234 turtle.wpl.iqtree Total CPU time used 1 0.037859 0.036415 0.043837 0.041274 0.030318 0.015625 -turtle_aa.fasta.iqtree Total CPU time used 12 61.60878 61.761949 100.241028 44.144877 44.523198 34.46875 -turtle_aa.loci.iqtree Total CPU time used 12 55.21 56.31 89.16 32.3 45.828247 31.66 -turtle_aa.merge.iqtree Total CPU time used 12 65.057715 65.34153 106.422985 48.539932 47.526024 36.890625 -turtle_aa.nex.constr.iqtree Total CPU time used 12 60.3527 60.7689 98.7859 47.122 38.9924 34.4219 -turtle_aa.nex.constr2.iqtree Total CPU time used 12 82.473306 82.646098 135.013106 54.514873 58.861398 47.40625 -turtle_aa.nex.iqtree Total CPU time used 12 70.691887 71.079425 115.466386 54.95159 52.16108 40.890625 -turtle_aa.test.iqtree Total CPU time used 1 1.69 1.81 2.72 0.862 0.979 0.922 +turtle_aa.fasta.iqtree Total CPU time used 12 61.60878 61.761949 100.241028 56.571182 44.523198 34.46875 +turtle_aa.loci.iqtree Total CPU time used 12 55.21 56.31 89.16 54.17 45.828247 31.66 +turtle_aa.merge.iqtree Total CPU time used 12 65.057715 65.34153 106.422985 76.722846 47.526024 36.890625 +turtle_aa.nex.constr.iqtree Total CPU time used 12 60.3527 60.7689 98.7859 59.6715 38.9924 34.4219 +turtle_aa.nex.constr2.iqtree Total CPU time used 12 82.473306 82.646098 135.013106 85.280632 58.861398 47.40625 +turtle_aa.nex.iqtree Total CPU time used 12 70.691887 71.079425 115.466386 71.812495 52.16108 40.890625 +turtle_aa.test.iqtree Total CPU time used 1 1.69 1.81 2.72 2.24 0.979 0.922 turtle_aa.wpl.iqtree Total CPU time used 3 1.6987 1.701 2.7838 0.89948 1.0239 0.96875 -turtle_aa.mix.iqtree Total CPU time used 3 12.8918 13.1371 21.3145 6.91331 9.35718 7.09375 \ No newline at end of file +turtle_aa.mix.iqtree Total CPU time used 3 12.8918 13.1371 21.3145 10.1353 9.35718 7.09375 \ No newline at end of file diff --git a/test_scripts/test_iqtree.ps1 b/test_scripts/test_iqtree.ps1 index 22ed581a..ac3b5e16 100755 --- a/test_scripts/test_iqtree.ps1 +++ b/test_scripts/test_iqtree.ps1 @@ -12,12 +12,18 @@ function Measure-IQTree { $startTime = Get-Date - # Start the command in a child PowerShell process - $proc = Start-Process -FilePath "powershell" -ArgumentList "-NoProfile", "-Command", $CommandLine -PassThru + # Split command and arguments + $exe, $args = $CommandLine -split '\s+', 2 + $tempOut = [System.IO.Path]::GetTempFileName() + + # Start the process with output redirection + $proc = Start-Process -FilePath $exe -ArgumentList $args ` + -RedirectStandardOutput $tempOut ` + -NoNewWindow -PassThru + $procId = $proc.Id $peakMemory = 0 - # Monitor the child process's memory usage while (-not $proc.HasExited) { Start-Sleep -Milliseconds 200 try { @@ -33,8 +39,14 @@ function Measure-IQTree { $endTime = Get-Date $elapsed = [math]::Round(($endTime - $startTime).TotalSeconds, 2) - # Write timing and memory data to log + # Show output + Get-Content $tempOut + + # Log timing and memory "$CommandLine`t$elapsed`t$([math]::Round($peakMemory, 2))" | Out-File -FilePath $LOGFILE -Append -Encoding utf8 + + # Cleanup + Remove-Item $tempOut } From e7115b81ca6e68bbbc7a1d15847c9f2f73df4e49 Mon Sep 17 00:00:00 2001 From: Hashara Date: Mon, 7 Jul 2025 11:00:24 +1000 Subject: [PATCH 10/16] resolve copilot suggestions --- test_scripts/verify_memory.ps1 | 1 - test_scripts/verify_memory.sh | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/test_scripts/verify_memory.ps1 b/test_scripts/verify_memory.ps1 index 5d7e2f28..d9574a96 100644 --- a/test_scripts/verify_memory.ps1 +++ b/test_scripts/verify_memory.ps1 @@ -33,7 +33,6 @@ for ($i = 0; $i -lt $selectedColumns.Count; $i++) { $combinedLines | Set-Content $finalFile # Now compare -Write-Host "`nCommand`tExpected`tThreshold`tActual`tExceededBy" $failCount = 0 $finalLines = Get-Content $finalFile diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh index f7c12cef..dc0c997e 100644 --- a/test_scripts/verify_memory.sh +++ b/test_scripts/verify_memory.sh @@ -15,8 +15,6 @@ paste "$selected_columns_file" /tmp/reported_column.tsv > "$final_file" fail_count=0 -echo -e "Command\tExpected\tThreshold\tActual\tExceededBy" - # Skip header while IFS=$'\t' read -r command threshold expected reported; do allowed=$(echo "$expected + $threshold" | bc -l) @@ -25,12 +23,12 @@ while IFS=$'\t' read -r command threshold expected reported; do if [ "$is_exceed" = "1" ]; then diff=$(echo "$reported - $expected" | bc -l) echo "❌ $command exceeded the allowed memory usage." - echo "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB" + echo "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB, Difference: $diff MB" ((fail_count++)) else echo "✅ $command passed the memory check." diff=$(echo "$reported - $expected" | bc -l) - echo "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB" + echo "Expected: $expected MB, Threshold: $threshold MB, Reported: $reported MB, Difference: $diff MB" fi done < <(tail -n +2 "$final_file") From fea468f03190d375ae711fc0ae7e9743f9fc8c25 Mon Sep 17 00:00:00 2001 From: Hashara Date: Mon, 7 Jul 2025 11:13:16 +1000 Subject: [PATCH 11/16] replace column index to column name for verify memory --- .github/workflows/ci.yaml | 12 ++++++------ test_scripts/verify_memory.sh | 12 +++++++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8f3537d1..8e20b284 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,13 +25,13 @@ jobs: cmake-version: 3.14.7 upload: true runtime-arg: 4 - memory-arg: 3 + memory-arg: Linux-gcc-9 # Latest supported gcc and cmake versions - gcc-version: 12 cmake-version: latest upload: false runtime-arg: 5 - memory-arg: 4 + memory-arg: Linux-gcc-12 steps: - name: Checkout @@ -137,7 +137,7 @@ jobs: - name: Run verify_memory.sh run: | chmod +x test_scripts/verify_memory.sh - ./test_scripts/verify_memory.sh 5 + ./test_scripts/verify_memory.sh Linux-aarch64 compile-linux-universal: name: Linux Universal @@ -227,7 +227,7 @@ jobs: - name: Run verify_memory.sh run: | chmod +x test_scripts/verify_memory.sh - ./test_scripts/verify_memory.sh 6 + ./test_scripts/verify_memory.sh mac-os-x86-64 build-macos-arm: name: Mac OS ARM64 @@ -280,7 +280,7 @@ jobs: - name: Run verify_memory.sh run: | chmod +x test_scripts/verify_memory.sh - ./test_scripts/verify_memory.sh 7 + ./test_scripts/verify_memory.sh mac-os-arm64 compile-mac-universal: name: Mac OS Universal @@ -394,6 +394,6 @@ jobs: run: | ./test_scripts/verify_runtime.ps1 - - name: Run verify_memory.sh + - name: Run verify_memory.ps1 run: | ./test_scripts/verify_memory.ps1 \ No newline at end of file diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh index dc0c997e..54701cac 100644 --- a/test_scripts/verify_memory.sh +++ b/test_scripts/verify_memory.sh @@ -5,7 +5,17 @@ WD="test_scripts/test_data" input_file="${WD}/expected_memory.tsv" reported_file="time_log.tsv" selected_columns_file="${WD}/selected_columns.tsv" -cut -f1,2,"$expected_column" "$input_file" > "${selected_columns_file}" + +# Get the column index (1-based) of the expected column name +col_index=$(head -1 "$input_file" | tr '\t' '\n' | awk -v col="$expected_column" '{if ($0 == col) print NR}') + +# Check if column was found +if [[ -z "$col_index" ]]; then + echo "Column '$expected_column' not found in $input_file" + exit 1 +fi + +cut -f1,2,"$col_index" "$input_file" > "${selected_columns_file}" final_file="${WD}/combined_with_reported.tsv" # assuming the reported file and expected file have the same order of commands From ee115db9de23dc693156d3828254aad2b5e46ca7 Mon Sep 17 00:00:00 2001 From: Hashara Date: Mon, 7 Jul 2025 12:05:49 +1000 Subject: [PATCH 12/16] add ps1 file to process with the column name update expected_memory.tsv for failing values update the verify_runtime.sh to check with usr/bin/time --- .github/workflows/ci.yaml | 10 +-- test_scripts/test_data/expected_memory.tsv | 4 +- test_scripts/test_data/expected_runtime.tsv | 26 ++++++++ test_scripts/verify_memory.ps1 | 18 ++++-- test_scripts/verify_memory.sh | 2 +- test_scripts/verify_runtime.sh | 68 +++++++++------------ 6 files changed, 77 insertions(+), 51 deletions(-) create mode 100644 test_scripts/test_data/expected_runtime.tsv diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8e20b284..4ca8feb9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,13 +24,13 @@ jobs: - gcc-version: 9 cmake-version: 3.14.7 upload: true - runtime-arg: 4 + runtime-arg: Linux-gcc-9 memory-arg: Linux-gcc-9 # Latest supported gcc and cmake versions - gcc-version: 12 cmake-version: latest upload: false - runtime-arg: 5 + runtime-arg: Linux-gcc-12 memory-arg: Linux-gcc-12 steps: @@ -132,7 +132,7 @@ jobs: - name: Run verify_runtimes.sh run: | chmod +x test_scripts/verify_runtime.sh - ./test_scripts/verify_runtime.sh 6 + ./test_scripts/verify_runtime.sh Linux-aarch64 - name: Run verify_memory.sh run: | @@ -222,7 +222,7 @@ jobs: - name: Run verify_runtimes.sh run: | chmod +x test_scripts/verify_runtime.sh - ./test_scripts/verify_runtime.sh 7 + ./test_scripts/verify_runtime.sh mac-os-x86-64 - name: Run verify_memory.sh run: | @@ -275,7 +275,7 @@ jobs: - name: Run verify_runtimes.sh run: | chmod +x test_scripts/verify_runtime.sh - ./test_scripts/verify_runtime.sh 8 + ./test_scripts/verify_runtime.sh mac-os-arm64 - name: Run verify_memory.sh run: | diff --git a/test_scripts/test_data/expected_memory.tsv b/test_scripts/test_data/expected_memory.tsv index c4ac1eec..cacb9473 100644 --- a/test_scripts/test_data/expected_memory.tsv +++ b/test_scripts/test_data/expected_memory.tsv @@ -14,8 +14,8 @@ build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turt build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed 73073 3 18.82 18.70 17.55 13.29 14.00 19.74 build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX+MF --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed 73073 3 14.55 15.50 11.68 9.21 9.28 20.19 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 15.77 22.72 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 3 76.22 67.05 26.73 23.80 16.39 24.45 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 41.34 31.46 26.11 22.30 16.56 25.05 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 3 76.22 67.05 26.73 23.80 16.39 28.9 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 41.34 31.46 26.11 22.30 16.56 28.35 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed 73073 -T 1 3 33.53 33.46 32.43 31.32 30.30 33.82 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed 73073 -T 1 3 18.26 18.32 16.95 14.17 12.81 14.99 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed 73073 3 16.49 16.11 13.53 11.07 9.69 14.96 diff --git a/test_scripts/test_data/expected_runtime.tsv b/test_scripts/test_data/expected_runtime.tsv new file mode 100644 index 00000000..98ebe004 --- /dev/null +++ b/test_scripts/test_data/expected_runtime.tsv @@ -0,0 +1,26 @@ +Command diff-threshold Linux-gcc-9 Linux-gcc-12 Linux-aarch64 mac-os-x86-64 mac-os-arm64 windows-x86 +build/iqtree3 -s test_scripts/test_data/turtle.fa -B 1000 -T 1 -seed 73073 2 3.24 3.32 5.03 3.62 2.96 4.55 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -seed 73073 2 3.46 3.59 4.32 3.63 2.74 4.06 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle.merge -seed 73073 2 3.35 3.49 5.01 4.14 3.00 3.86 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.merge.best_scheme.nex -z test_scripts/test_data/turtle.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle.test -seed 73073 -T 1 2 1.34 1.31 0.74 0.85 0.78 3.26 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m GTR+F+I+R3+T -te test_scripts/test_data/turtle.trees -T 1 --prefix test_scripts/test_data/turtle.mix -seed 73073 2 2.43 2.36 3.76 2.29 2.52 2.85 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex.best_scheme.nex -z test_scripts/test_data/turtle.trees -n 0 -wpl --prefix test_scripts/test_data/turtle.wpl -seed 73073 -T 1 2 0.05 0.05 0.05 0.13 0.04 0.62 +build/iqtree3 -s test_scripts/test_data/turtle.fa -S test_scripts/test_data/turtle.nex --prefix test_scripts/test_data/turtle.loci -T 1 -seed 73073 2 3.64 3.82 4.88 3.90 2.94 3.86 +build/iqtree3 -t test_scripts/test_data/turtle.nex.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 1 0.01 0.01 0.01 0.02 0.01 0.4 +build/iqtree3 -t test_scripts/test_data/turtle.fa.treefile --gcf test_scripts/test_data/turtle.loci.treefile -s test_scripts/test_data/turtle.fa --scf 100 -seed 73073 -T 1 1 0.01 0.01 0.01 0.02 0.01 0.41 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR+FO,GTR+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.link -seed 73073 -T 1 2 0.79 0.82 1.23 0.69 0.64 0.4 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR{1,1,1,1,1,1}+FO,GTR{1,1,1,1,1,1}+FO} --link-exchange-rates --prefix test_scripts/test_data/turtle.mix.jc.link -seed 73073 -T 1 2 0.70 0.74 1.09 0.82 0.71 0.41 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed 73073 2 3.05 3.17 3.83 3.62 2.22 3.47 +build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed 73073 2 3.50 3.58 4.25 3.95 2.49 4.27 +build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX+MF --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed 73073 3 9.15 8.47 14.31 9.81 8.20 0.42 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 12 62.06 65.05 100.61 35.56 40.99 35.76 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 12 71.33 72.66 116.11 44.03 46.82 41.86 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 12 65.65 67.02 106.90 39.94 40.45 37.61 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed 73073 -T 1 2 2.66 2.61 3.17 1.43 1.61 3.26 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -n 0 -wpl --prefix test_scripts/test_data/turtle_aa.wpl -seed 73073 -T 1 2 1.80 1.83 2.92 1.08 1.27 1.62 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed 73073 12 55.46 56.38 89.44 34.67 35.94 32.52 +build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 1 0.01 0.01 0.01 0.02 0.02 0.4 +build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 1 0.01 0.01 0.01 0.02 0.01 0.41 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 13.04 13.33 21.36 7.23 8.97 0.41 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 12 61.22 61.69 99.07 37.95 39.54 35.39 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 12 82.86 85.39 135.76 49.92 53.91 48.37 diff --git a/test_scripts/verify_memory.ps1 b/test_scripts/verify_memory.ps1 index d9574a96..d830604f 100644 --- a/test_scripts/verify_memory.ps1 +++ b/test_scripts/verify_memory.ps1 @@ -1,5 +1,5 @@ param ( - [int] $ExpectedColumn = 8 + [string] $ExpectedColumnName = "windows-x86" ) $WD = "test_scripts/test_data" @@ -9,11 +9,21 @@ $selectedColumnsFile = Join-Path $WD "selected_columns.tsv" $reportedColumnFile = "$env:TEMP\reported_column.tsv" $finalFile = Join-Path $WD "combined_with_reported.tsv" -# Read expected: Command, Threshold, ExpectedColumn +# Get the header and find the index of the expected column name +$header = Get-Content $expectedFile -TotalCount 1 +$columns = $header -split "`t" +$columnIndex = $columns.IndexOf($ExpectedColumnName) + +if ($columnIndex -lt 0) { + Write-Error "Column '$ExpectedColumnName' not found in $expectedFile" + exit 1 +} + +# Adjust to 0-based indexing for arrays $expectedLines = Get-Content $expectedFile | Select-Object -Skip 1 $selectedColumns = foreach ($line in $expectedLines) { $parts = $line -split "`t" - "$($parts[0])`t$($parts[1])`t$($parts[$ExpectedColumn - 1])" + "$($parts[0])`t$($parts[1])`t$($parts[$columnIndex])" } $selectedColumns | Set-Content $selectedColumnsFile @@ -59,7 +69,7 @@ foreach ($line in $finalLines) { Write-Host "" if ($failCount -eq 0) { - Write-Host "✅ All runtime/memory checks passed." + Write-Host "✅ All memory checks passed." exit 0 } else { Write-Host "❌ $failCount checks failed." diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh index 54701cac..03643cf6 100644 --- a/test_scripts/verify_memory.sh +++ b/test_scripts/verify_memory.sh @@ -43,7 +43,7 @@ while IFS=$'\t' read -r command threshold expected reported; do done < <(tail -n +2 "$final_file") if [ "$fail_count" -eq 0 ]; then - echo "✅ All runtime checks passed." + echo "✅ All memory checks passed." else echo "❌ $fail_count checks failed." exit 1 diff --git a/test_scripts/verify_runtime.sh b/test_scripts/verify_runtime.sh index f20f0790..14c2ced4 100644 --- a/test_scripts/verify_runtime.sh +++ b/test_scripts/verify_runtime.sh @@ -2,56 +2,46 @@ expected_column="$1" WD="test_scripts/test_data" -input_file="${WD}/expected_runtimes.tsv" -selected_colums_file="${WD}/selected_columns.tsv" -cut -f1,2,3,"$expected_column" "$input_file" > "${selected_colums_file}" +input_file="${WD}/expected_runtime.tsv" +reported_file="time_log.tsv" +selected_columns_file="${WD}/selected_columns.tsv" -fail_count=0 -line_num=0 - -while IFS=$'\t' read -r iqtree_file field_name threshold expected_value || [ -n "$iqtree_file" ]; do - ((line_num++)) +# Get the column index (1-based) of the expected column name +col_index=$(head -1 "$input_file" | tr '\t' '\n' | awk -v col="$expected_column" '{if ($0 == col) print NR}') - # Skip header (first line) - if [ "$line_num" -eq 1 ]; then - continue - fi +# Check if column was found +if [[ -z "$col_index" ]]; then + echo "Column '$expected_column' not found in $input_file" + exit 1 +fi - iqtree_file="${WD}/${iqtree_file}" +cut -f1,2,"$col_index" "$input_file" > "${selected_columns_file}" +final_file="${WD}/combined_with_reported.tsv" - if [ ! -f "$iqtree_file" ]; then - echo "File not found: $iqtree_file" - continue - fi +# assuming the reported file and expected file have the same order of commands +cut -f2 "$reported_file" > /tmp/reported_column.tsv +paste "$selected_columns_file" /tmp/reported_column.tsv > "$final_file" - # Look for the line containing the field name - report_line=$(grep -F "$field_name" "$iqtree_file") - if [ -z "$report_line" ]; then - echo "Field not found in $iqtree_file: $field_name" - continue - fi - # Extract the first numeric value from the matched line - report_value=$(echo "$report_line" | grep -Eo '[-+]?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?' | head -n1) - if [ -z "$report_value" ]; then - echo "No numeric value found in line: $report_line" - continue - fi +fail_count=0 - # Compute report value less than the highest value - higest_value=$(echo "$expected_value + $threshold" | bc -l) - result=$(echo "$report_value <= $higest_value" | bc -l) +# Skip header +while IFS=$'\t' read -r command threshold expected reported; do + allowed=$(echo "$expected + $threshold" | bc -l) + is_exceed=$(echo "$reported > $allowed" | bc -l) - if [ "$result" -eq 1 ]; then - echo "PASS: $iqtree_file -- Expected: ${expected_value}, Reported: ${report_value}, Threshold: $threshold" - else - echo "FAIL: $iqtree_file ($field_name)" - echo " Expected: ${expected_value}, Reported: ${report_value}, Threshold: $threshold" + if [ "$is_exceed" = "1" ]; then + diff=$(echo "$reported - $expected" | bc -l) + echo "❌ $command exceeded the allowed runtime usage." + echo "Expected: $expected S, Threshold: $threshold S, Reported: $reported S, Difference: $diff S" ((fail_count++)) + else + echo "✅ $command passed the runtime check." + diff=$(echo "$reported - $expected" | bc -l) + echo "Expected: $expected S, Threshold: $threshold S, Reported: $reported S, Difference: $diff S" fi -done < "$selected_colums_file" +done < <(tail -n +2 "$final_file") -echo if [ "$fail_count" -eq 0 ]; then echo "✅ All runtime checks passed." else From 4ff421ce88d1f22c110ebff4d29b199996c4fcbf Mon Sep 17 00:00:00 2001 From: Hashara Date: Mon, 7 Jul 2025 12:39:33 +1000 Subject: [PATCH 13/16] add verify_runtime.ps1 file to process with the column name remove expected_runtimes.tsv --- test_scripts/test_data/expected_runtimes.tsv | 22 ---- test_scripts/verify_runtime.ps1 | 100 +++++++++++-------- 2 files changed, 57 insertions(+), 65 deletions(-) delete mode 100644 test_scripts/test_data/expected_runtimes.tsv diff --git a/test_scripts/test_data/expected_runtimes.tsv b/test_scripts/test_data/expected_runtimes.tsv deleted file mode 100644 index a025d890..00000000 --- a/test_scripts/test_data/expected_runtimes.tsv +++ /dev/null @@ -1,22 +0,0 @@ -#file name key-words diff-threshold Linux-gcc-9 Linux-gcc-12 Linux-aarch64 mac-os-x86-64 mac-os-arm64 windows-x86 -turtle.fa.iqtree Total CPU time used 2 3.128169 3.299343 4.909145 4.93771 3.595236 3.21875 -turtle.loci.iqtree Total CPU time used 2 3.376 3.6 4.561 5.737 2.786 3.359 -turtle.merge.iqtree Total CPU time used 2 3.22134 3.336272 4.881305 4.074864 3.063053 3.34375 -turtle.mix.iqtree Total CPU time used 1 2.288 2.437 3.653 4.416 2.607 2.391 -turtle.mix.jc.link.iqtree Total CPU time used 1 0.678048 0.716485 1.05925 1.97384 0.798578 0.8125 -turtle.mix.link.iqtree Total CPU time used 1 0.765474 0.829717 1.19517 2.31644 0.868658 0.90625 -turtle.mixfinder.iqtree Total CPU time used 3 9.34105 9.95267 14.5544 13.1422 8.78048 8.40625 -turtle.nex.constr.iqtree Total CPU time used 3 2.74033 2.88714 3.45122 4.30755 2.83421 2.85938 -turtle.nex.constr2.iqtree Total CPU time used 3 3.172122 3.296328 3.914713 4.247386 3.261848 3.484375 -turtle.nex.iqtree Total CPU time used 3 3.139167 3.257494 4.000374 4.824423 3.217744 3.578125 -turtle.test.iqtree Total CPU time used 1 0.235 0.242 0.349 0.192 0.225 0.234 -turtle.wpl.iqtree Total CPU time used 1 0.037859 0.036415 0.043837 0.041274 0.030318 0.015625 -turtle_aa.fasta.iqtree Total CPU time used 12 61.60878 61.761949 100.241028 56.571182 44.523198 34.46875 -turtle_aa.loci.iqtree Total CPU time used 12 55.21 56.31 89.16 54.17 45.828247 31.66 -turtle_aa.merge.iqtree Total CPU time used 12 65.057715 65.34153 106.422985 76.722846 47.526024 36.890625 -turtle_aa.nex.constr.iqtree Total CPU time used 12 60.3527 60.7689 98.7859 59.6715 38.9924 34.4219 -turtle_aa.nex.constr2.iqtree Total CPU time used 12 82.473306 82.646098 135.013106 85.280632 58.861398 47.40625 -turtle_aa.nex.iqtree Total CPU time used 12 70.691887 71.079425 115.466386 71.812495 52.16108 40.890625 -turtle_aa.test.iqtree Total CPU time used 1 1.69 1.81 2.72 2.24 0.979 0.922 -turtle_aa.wpl.iqtree Total CPU time used 3 1.6987 1.701 2.7838 0.89948 1.0239 0.96875 -turtle_aa.mix.iqtree Total CPU time used 3 12.8918 13.1371 21.3145 10.1353 9.35718 7.09375 \ No newline at end of file diff --git a/test_scripts/verify_runtime.ps1 b/test_scripts/verify_runtime.ps1 index 188fe902..ea97ea1b 100755 --- a/test_scripts/verify_runtime.ps1 +++ b/test_scripts/verify_runtime.ps1 @@ -1,63 +1,77 @@ -param( - [int] $ExpectedColumn = 8, # 1-based index of the threshold column - [string]$input_file = "test_scripts/test_data/expected_runtimes.tsv" +param ( + [string] $ExpectedColumnName = "windows-x86" ) -$fail_count = 0 -$line_num = 0 +$WD = "test_scripts/test_data" +$expectedFile = Join-Path $WD "expected_runtime.tsv" +$reportedFile = "time_log.tsv" +$selectedColumnsFile = Join-Path $WD "selected_columns.tsv" +$reportedColumnFile = "$env:TEMP\reported_column.tsv" +$finalFile = Join-Path $WD "combined_with_reported.tsv" -Get-Content $input_file | ForEach-Object { - $line = $_.Trim() - $line_num++ +# Get the header and find the index of the expected column name +$header = Get-Content $expectedFile -TotalCount 1 +$columns = $header -split "`t" +$columnIndex = $columns.IndexOf($ExpectedColumnName) - if ($line_num -eq 1 -or $line -eq "") { - return # skip header or empty line - } - - $columns = $line -split "`t" - if ($columns.Count -lt 4) { - Write-Host "Skipping malformed line: $line" - return - } +if ($columnIndex -lt 0) { + Write-Error "Column '$ExpectedColumnName' not found in $expectedFile" + exit 1 +} - $iqtree_file = Join-Path "test_scripts/test_data" $columns[0] - $field_name = $columns[1] - $expected_value = [double]$columns[$ExpectedColumn] - $threshold = [double]$columns[2] +# Adjust to 0-based indexing for arrays +$expectedLines = Get-Content $expectedFile | Select-Object -Skip 1 +$selectedColumns = foreach ($line in $expectedLines) { + $parts = $line -split "`t" + "$($parts[0])`t$($parts[1])`t$($parts[$columnIndex])" +} +$selectedColumns | Set-Content $selectedColumnsFile - if (-not (Test-Path $iqtree_file)) { - Write-Host "File not found: ${iqtree_file}" - return - } +# Read reported column from time_log.tsv (column 3 = RealTime, 4 = Memory) +$reportedLines = Get-Content $reportedFile | Select-Object -Skip 1 +$reportedColumn = foreach ($line in $reportedLines) { + $parts = $line -split "`t" + $parts[1] # column 2 = runtime (0-based index) +} +$reportedColumn | Set-Content $reportedColumnFile - $actual_line = Select-String -Path $iqtree_file -Pattern ([regex]::Escape($field_name)) - if (-not $actual_line) { - Write-Host "Field not found in ${iqtree_file}: ${field_name}" - return - } +# Combine both files +$combinedLines = @() +for ($i = 0; $i -lt $selectedColumns.Count; $i++) { + $combinedLines += "$($selectedColumns[$i])`t$($reportedColumn[$i])" +} +$combinedLines | Set-Content $finalFile - $match = [regex]::Match($actual_line.Line, '[-+]?\d+(\.\d+)?([eE][-+]?\d+)?') +# Now compare +$failCount = 0 +$finalLines = Get-Content $finalFile - if (-not $match.Success) { - Write-Host "No numeric value found in line: $($actual_line.Line)" - return - } +foreach ($line in $finalLines) { + $parts = $line -split "`t" + $command = $parts[0] + $threshold = [double]$parts[1] + $expected = [double]$parts[2] + $reported = [double]$parts[3] - $actual_value = [double]$match.Value - $highest_value = $expected_value + $threshold + $allowed = $expected + $threshold + $exceededBy = $reported - $expected - if ($actual_value -le $highest_value) { - Write-Host "PASS: ${iqtree_file} -- Expected: ${expected_value}, Reported: ${actual_value}, Threshold: ${threshold}" + if ($reported -gt $allowed) { + Write-Host "❌ $command exceeded the allowed usage." + Write-Host "Expected: $expected S, Threshold: $threshold S, Reported: $reported S" + $failCount++ } else { - Write-Host "FAIL: ${iqtree_file} -- Expected: ${expected_value}, Reported: ${actual_value}, Threshold: ${threshold}" - $fail_count++ + Write-Host "✅ $command passed the check." + Write-Host "Expected: $expected S, Threshold: $threshold S, Reported: $reported S" } } Write-Host "" -if ($fail_count -eq 0) { + +if ($failCount -eq 0) { Write-Host "✅ All runtime checks passed." + exit 0 } else { - Write-Host "❌ ${fail_count} checks failed." + Write-Host "❌ $failCount checks failed." exit 1 } From 57e62c969252b1e1f28e092104a36163a204991b Mon Sep 17 00:00:00 2001 From: Hashara Date: Mon, 7 Jul 2025 13:00:50 +1000 Subject: [PATCH 14/16] update values of failing checks --- test_scripts/test_data/expected_memory.tsv | 4 ++-- test_scripts/test_data/expected_runtime.tsv | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test_scripts/test_data/expected_memory.tsv b/test_scripts/test_data/expected_memory.tsv index cacb9473..04dbdebd 100644 --- a/test_scripts/test_data/expected_memory.tsv +++ b/test_scripts/test_data/expected_memory.tsv @@ -13,7 +13,7 @@ build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX{GTR{1,1,1,1,1,1}+FO,GTR build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle.nex.constr -T 1 -seed 73073 3 10.57 10.45 8.80 5.86 6.78 10.43 build/iqtree3 -s test_scripts/test_data/turtle.fa -p test_scripts/test_data/turtle.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle.nex.constr2 -T 1 -seed 73073 3 18.82 18.70 17.55 13.29 14.00 19.74 build/iqtree3 -s test_scripts/test_data/turtle.fa -m MIX+MF --prefix test_scripts/test_data/turtle.mixfinder -T 1 -seed 73073 3 14.55 15.50 11.68 9.21 9.28 20.19 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 15.77 22.72 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -B 1000 -T 1 -seed 73073 3 25.57 25.66 24.47 21.26 15.77 26.65 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -seed 73073 3 76.22 67.05 26.73 23.80 16.39 28.9 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -B 1000 -T 1 -m MFP+MERGE -rcluster 10 --prefix test_scripts/test_data/turtle_aa.merge -seed 73073 3 41.34 31.46 26.11 22.30 16.56 28.35 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.merge.best_scheme.nex -z test_scripts/test_data/turtle_aa.trees -zb 10000 -au -n 0 --prefix test_scripts/test_data/turtle_aa.test -seed 73073 -T 1 3 33.53 33.46 32.43 31.32 30.30 33.82 @@ -23,4 +23,4 @@ build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_script build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 3 6.29 6.55 5.93 2.29 3.09 6.64 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 11.79 11.80 10.67 6.39 6.78 11.94 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 3 59.79 60.66 18.28 18.67 10.61 16.95 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 50.73 70.88 26.53 23.55 16.72 26.39 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 3 63.79 70.88 26.53 23.55 16.72 26.39 diff --git a/test_scripts/test_data/expected_runtime.tsv b/test_scripts/test_data/expected_runtime.tsv index 98ebe004..d4aa8392 100644 --- a/test_scripts/test_data/expected_runtime.tsv +++ b/test_scripts/test_data/expected_runtime.tsv @@ -21,6 +21,6 @@ build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_dat build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -S test_scripts/test_data/turtle_aa.nex --prefix test_scripts/test_data/turtle_aa.loci -T 1 -seed 73073 12 55.46 56.38 89.44 34.67 35.94 32.52 build/iqtree3 -t test_scripts/test_data/turtle_aa.nex.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 1 0.01 0.01 0.01 0.02 0.02 0.4 build/iqtree3 -t test_scripts/test_data/turtle_aa.fasta.treefile --gcf test_scripts/test_data/turtle_aa.loci.treefile -s test_scripts/test_data/turtle_aa.fasta --scf 100 -seed 73073 -T 1 1 0.01 0.01 0.01 0.02 0.01 0.41 -build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 13.04 13.33 21.36 7.23 8.97 0.41 +build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -m MIX{LG+F,WAG+F} --prefix test_scripts/test_data/turtle_aa.mix -seed 73073 -T 1 3 13.04 13.33 21.36 7.23 8.97 7.53 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree --prefix test_scripts/test_data/turtle_aa.nex.constr -T 1 -seed 73073 12 61.22 61.69 99.07 37.95 39.54 35.39 build/iqtree3 -s test_scripts/test_data/turtle_aa.fasta -p test_scripts/test_data/turtle_aa.nex -g test_scripts/test_data/turtle.constr.tree2 -B 1000 -alrt 1000 --prefix test_scripts/test_data/turtle_aa.nex.constr2 -T 1 -seed 73073 12 82.86 85.39 135.76 49.92 53.91 48.37 From 230ea88a6ff00aad818e40f6e30ea9daf76555b1 Mon Sep 17 00:00:00 2001 From: Hashara Date: Mon, 7 Jul 2025 14:04:59 +1000 Subject: [PATCH 15/16] add comment to clarify what are the expected inputs --- test_scripts/verify_memory.sh | 1 + test_scripts/verify_runtime.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh index 03643cf6..2e42a24b 100644 --- a/test_scripts/verify_memory.sh +++ b/test_scripts/verify_memory.sh @@ -1,4 +1,5 @@ #!/bin/bash +# expect the first argument to be the column name : contain what platform(OS) is running the script expected_column="$1" WD="test_scripts/test_data" diff --git a/test_scripts/verify_runtime.sh b/test_scripts/verify_runtime.sh index 14c2ced4..f42513bd 100644 --- a/test_scripts/verify_runtime.sh +++ b/test_scripts/verify_runtime.sh @@ -1,4 +1,5 @@ #!/bin/bash +# expect the first argument to be the column name : contain what platform(OS) is running the script expected_column="$1" WD="test_scripts/test_data" From 5dcdf010455f55b6eb1d6cb11014872377274d54 Mon Sep 17 00:00:00 2001 From: Hashara Kumarasinghe <47107459+Hashara@users.noreply.github.com> Date: Mon, 7 Jul 2025 14:36:34 +1000 Subject: [PATCH 16/16] Update test_scripts/verify_memory.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- test_scripts/verify_memory.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test_scripts/verify_memory.sh b/test_scripts/verify_memory.sh index 2e42a24b..ae23f9b9 100644 --- a/test_scripts/verify_memory.sh +++ b/test_scripts/verify_memory.sh @@ -20,8 +20,10 @@ cut -f1,2,"$col_index" "$input_file" > "${selected_columns_file}" final_file="${WD}/combined_with_reported.tsv" # assuming the reported file and expected file have the same order of commands -cut -f3 "$reported_file" > /tmp/reported_column.tsv -paste "$selected_columns_file" /tmp/reported_column.tsv > "$final_file" +temp_reported_column=$(mktemp) +cut -f3 "$reported_file" > "$temp_reported_column" +paste "$selected_columns_file" "$temp_reported_column" > "$final_file" +rm -f "$temp_reported_column" fail_count=0