performance-setup.sh 7.9 KB

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