| 1 |
#!/usr/bin/env bash |
| 2 |
|
| 3 |
source_directory=$BUILD_SOURCESDIRECTORY |
| 4 |
core_root_directory= |
| 5 |
baseline_core_root_directory= |
| 6 |
architecture=x64 |
| 7 |
framework=netcoreapp5.0 |
| 8 |
compilation_mode=tiered |
| 9 |
repository=$BUILD_REPOSITORY_NAME |
| 10 |
branch=$BUILD_SOURCEBRANCH |
| 11 |
commit_sha=$BUILD_SOURCEVERSION |
| 12 |
build_number=$BUILD_BUILDNUMBER |
| 13 |
internal=false |
| 14 |
compare=false |
| 15 |
kind="micro" |
| 16 |
run_categories="Libraries Runtime" |
| 17 |
csproj="src\benchmarks\micro\MicroBenchmarks.csproj" |
| 18 |
configurations="CompliationMode=$compilation_mode RunKind=$kind" |
| 19 |
run_from_perf_repo=false |
| 20 |
use_core_run=true |
| 21 |
use_baseline_core_run=true |
| 22 |
|
| 23 |
while (($# > 0)); do |
| 24 |
lowerI="$(echo $1 | awk '{print tolower($0)}')" |
| 25 |
case $lowerI in |
| 26 |
--sourcedirectory) |
| 27 |
source_directory=$2 |
| 28 |
shift 2 |
| 29 |
;; |
| 30 |
--corerootdirectory) |
| 31 |
core_root_directory=$2 |
| 32 |
shift 2 |
| 33 |
;; |
| 34 |
--baselinecorerootdirectory) |
| 35 |
baseline_core_root_directory=$2 |
| 36 |
shift 2 |
| 37 |
;; |
| 38 |
--architecture) |
| 39 |
architecture=$2 |
| 40 |
shift 2 |
| 41 |
;; |
| 42 |
--framework) |
| 43 |
framework=$2 |
| 44 |
shift 2 |
| 45 |
;; |
| 46 |
--compilationmode) |
| 47 |
compilation_mode=$2 |
| 48 |
shift 2 |
| 49 |
;; |
| 50 |
--repository) |
| 51 |
repository=$2 |
| 52 |
shift 2 |
| 53 |
;; |
| 54 |
--branch) |
| 55 |
branch=$2 |
| 56 |
shift 2 |
| 57 |
;; |
| 58 |
--commitsha) |
| 59 |
commit_sha=$2 |
| 60 |
shift 2 |
| 61 |
;; |
| 62 |
--buildnumber) |
| 63 |
build_number=$2 |
| 64 |
shift 2 |
| 65 |
;; |
| 66 |
--kind) |
| 67 |
kind=$2 |
| 68 |
shift 2 |
| 69 |
;; |
| 70 |
--runcategories) |
| 71 |
run_categories=$2 |
| 72 |
shift 2 |
| 73 |
;; |
| 74 |
--csproj) |
| 75 |
csproj=$2 |
| 76 |
shift 2 |
| 77 |
;; |
| 78 |
--internal) |
| 79 |
internal=true |
| 80 |
shift 1 |
| 81 |
;; |
| 82 |
--compare) |
| 83 |
compare=true |
| 84 |
shift 1 |
| 85 |
;; |
| 86 |
--configurations) |
| 87 |
configurations=$2 |
| 88 |
shift 2 |
| 89 |
;; |
| 90 |
--help) |
| 91 |
echo "Common settings:" |
| 92 |
echo " --corerootdirectory <value> Directory where Core_Root exists, if running perf testing with --corerun" |
| 93 |
echo " --architecture <value> Architecture of the testing being run" |
| 94 |
echo " --configurations <value> List of key=value pairs that will be passed to perf testing infrastructure." |
| 95 |
echo " ex: --configurations \"CompilationMode=Tiered OptimzationLevel=PGO\"" |
| 96 |
echo " --help Print help and exit" |
| 97 |
echo "" |
| 98 |
echo "Advanced settings:" |
| 99 |
echo " --framework <value> The framework to run, if not running in master" |
| 100 |
echo " --compliationmode <value> The compilation mode if not passing --configurations" |
| 101 |
echo " --sourcedirectory <value> The directory of the sources. Defaults to env:BUILD_SOURCESDIRECTORY" |
| 102 |
echo " --repository <value> The name of the repository in the <owner>/<repository name> format. Defaults to env:BUILD_REPOSITORY_NAME" |
| 103 |
echo " --branch <value> The name of the branch. Defaults to env:BUILD_SOURCEBRANCH" |
| 104 |
echo " --commitsha <value> The commit sha1 to run against. Defaults to env:BUILD_SOURCEVERSION" |
| 105 |
echo " --buildnumber <value> The build number currently running. Defaults to env:BUILD_BUILDNUMBER" |
| 106 |
echo " --csproj The relative path to the benchmark csproj whose tests should be run. Defaults to src\benchmarks\micro\MicroBenchmarks.csproj" |
| 107 |
echo " --kind <value> Related to csproj. The kind of benchmarks that should be run. Defaults to micro" |
| 108 |
echo " --runcategories <value> Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\"" |
| 109 |
echo " --internal If the benchmarks are running as an official job." |
| 110 |
echo "" |
| 111 |
exit 0 |
| 112 |
;; |
| 113 |
esac |
| 114 |
done |
| 115 |
|
| 116 |
if [ "$repository" == "dotnet/performance" ] || [ "$repository" == "dotnet-performance" ]; then |
| 117 |
run_from_perf_repo=true |
| 118 |
fi |
| 119 |
|
| 120 |
if [ -z "$configurations" ]; then |
| 121 |
configurations="CompliationMode=$compilation_mode" |
| 122 |
fi |
| 123 |
|
| 124 |
if [ -z "$core_root_directory" ]; then |
| 125 |
use_core_run=false |
| 126 |
fi |
| 127 |
|
| 128 |
if [ -z "$baseline_core_root_directory" ]; then |
| 129 |
use_baseline_core_run=false |
| 130 |
fi |
| 131 |
|
| 132 |
payload_directory=$source_directory/Payload |
| 133 |
performance_directory=$payload_directory/performance |
| 134 |
workitem_directory=$source_directory/workitem |
| 135 |
extra_benchmark_dotnet_arguments="--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" |
| 136 |
perflab_arguments= |
| 137 |
queue=Ubuntu.1804.Amd64.Open |
| 138 |
creator=$BUILD_DEFINITIONNAME |
| 139 |
helix_source_prefix="pr" |
| 140 |
|
| 141 |
if [[ "$compare" == true ]]; then |
| 142 |
extra_benchmark_dotnet_arguments= |
| 143 |
perflab_arguments= |
| 144 |
|
| 145 |
# No open queues for arm64 |
| 146 |
if [[ "$architecture" = "arm64" ]]; then |
| 147 |
echo "Compare not available for arm64" |
| 148 |
exit 1 |
| 149 |
fi |
| 150 |
|
| 151 |
queue=Ubuntu.1804.Amd64.Tiger.Perf.Open |
| 152 |
fi |
| 153 |
|
| 154 |
if [[ "$internal" == true ]]; then |
| 155 |
perflab_arguments="--upload-to-perflab-container" |
| 156 |
helix_source_prefix="official" |
| 157 |
creator= |
| 158 |
extra_benchmark_dotnet_arguments= |
| 159 |
|
| 160 |
if [[ "$architecture" = "arm64" ]]; then |
| 161 |
queue=Ubuntu.1804.Arm64.Perf |
| 162 |
else |
| 163 |
queue=Ubuntu.1804.Amd64.Tiger.Perf |
| 164 |
fi |
| 165 |
fi |
| 166 |
|
| 167 |
common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" |
| 168 |
setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" |
| 169 |
|
| 170 |
if [[ "$run_from_perf_repo" = true ]]; then |
| 171 |
payload_directory= |
| 172 |
workitem_directory=$source_directory |
| 173 |
performance_directory=$workitem_directory |
| 174 |
setup_arguments="--perf-hash $commit_sha $common_setup_arguments" |
| 175 |
else |
| 176 |
git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $performance_directory |
| 177 |
|
| 178 |
docs_directory=$performance_directory/docs |
| 179 |
mv $docs_directory $workitem_directory |
| 180 |
fi |
| 181 |
|
| 182 |
if [[ "$use_core_run" = true ]]; then |
| 183 |
new_core_root=$payload_directory/Core_Root |
| 184 |
mv $core_root_directory $new_core_root |
| 185 |
fi |
| 186 |
|
| 187 |
if [[ "$use_baseline_core_run" = true ]]; then |
| 188 |
new_baseline_core_root=$payload_directory/Baseline_Core_Root |
| 189 |
mv $baseline_core_root_directory $new_baseline_core_root |
| 190 |
fi |
| 191 |
|
| 192 |
ci=true |
| 193 |
|
| 194 |
_script_dir=$(pwd)/eng/common |
| 195 |
. "$_script_dir/pipeline-logging-functions.sh" |
| 196 |
|
| 197 |
# Make sure all of our variables are available for future steps |
| 198 |
Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false |
| 199 |
Write-PipelineSetVariable -name "UseBaselineCoreRun" -value "$use_baseline_core_run" -is_multi_job_variable false |
| 200 |
Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false |
| 201 |
Write-PipelineSetVariable -name "PayloadDirectory" -value "$payload_directory" -is_multi_job_variable false |
| 202 |
Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_directory" -is_multi_job_variable false |
| 203 |
Write-PipelineSetVariable -name "WorkItemDirectory" -value "$workitem_directory" -is_multi_job_variable false |
| 204 |
Write-PipelineSetVariable -name "Queue" -value "$queue" -is_multi_job_variable false |
| 205 |
Write-PipelineSetVariable -name "SetupArguments" -value "$setup_arguments" -is_multi_job_variable false |
| 206 |
Write-PipelineSetVariable -name "Python" -value "$python3" -is_multi_job_variable false |
| 207 |
Write-PipelineSetVariable -name "PerfLabArguments" -value "$perflab_arguments" -is_multi_job_variable false |
| 208 |
Write-PipelineSetVariable -name "ExtraBenchmarkDotNetArguments" -value "$extra_benchmark_dotnet_arguments" -is_multi_job_variable false |
| 209 |
Write-PipelineSetVariable -name "BDNCategories" -value "$run_categories" -is_multi_job_variable false |
| 210 |
Write-PipelineSetVariable -name "TargetCsproj" -value "$csproj" -is_multi_job_variable false |
| 211 |
Write-PipelineSetVariable -name "RunFromPerfRepo" -value "$run_from_perf_repo" -is_multi_job_variable false |
| 212 |
Write-PipelineSetVariable -name "Creator" -value "$creator" -is_multi_job_variable false |
| 213 |
Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix" -is_multi_job_variable false |
| 214 |
Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false |
| 215 |
Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false |
| 216 |
Write-PipelineSetVariable -name "Compare" -value "$compare" -is_multi_job_variable false |