performance-setup.sh 6.3 KB

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