1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
#!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
@Library('rocJenkins@pong') _
// This is file for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
import com.amd.project.*
import com.amd.docker.*
import java.nio.file.Path
def runCompileCommand(platform, project, jobName, boolean debug=false, boolean buildStatic=false)
{
def reference = (env.BRANCH_NAME ==~ /PR-\d+/) ? 'develop' : 'master'
project.paths.construct_build_prefix()
def getDependenciesCommand = ""
if (project.installLibraryDependenciesFromCI)
{
project.libraryDependencies.each
{ libraryName ->
getDependenciesCommand += auxiliary.getLibrary(libraryName, platform.jenkinsLabel, null, false)
}
}
dir("${project.paths.project_build_prefix}/ref-repo") {
git branch: "${reference}", url: 'https://github.com/ROCmSoftwarePlatform/rocFFT.git'
}
String clientArgs = '-DBUILD_CLIENTS_SAMPLES=ON -DBUILD_CLIENTS_TESTS=ON -DBUILD_CLIENTS_BENCH=ON'
String noclientArgs = '-DBUILD_CLIENTS_SAMPLES=OFF -DBUILD_CLIENTS_TESTS=OFF -DBUILD_CLIENTS_BENCH=OFF'
String warningArgs = '-DWERROR=ON'
String buildTypeArg = debug ? '-DCMAKE_BUILD_TYPE=Debug -DROCFFT_DEVICE_FORCE_RELEASE=ON' : '-DCMAKE_BUILD_TYPE=Release'
String buildTypeDir = debug ? 'debug' : 'release'
String rtcBuildCache = "-DROCFFT_BUILD_KERNEL_CACHE_PATH=\$JENKINS_HOME_LOCAL/rocfft_build_cache.db"
String cmake = platform.jenkinsLabel.contains('centos') ? 'cmake3' : 'cmake'
def command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}
${getDependenciesCommand}
set -e
mkdir -p build/${buildTypeDir} && pushd build/${buildTypeDir}
${auxiliary.gfxTargetParser()}
${cmake} -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc -DCMAKE_C_COMPILER=/opt/rocm/bin/hipcc -DAMDGPU_TARGETS=\$gfx_arch -DSINGLELIB=on ${buildTypeArg} ${clientArgs} ${warningArgs} ${rtcBuildCache} ../..
make -j\$(nproc)
popd
cd ref-repo
mkdir -p build/${buildTypeDir} && pushd build/${buildTypeDir}
${auxiliary.gfxTargetParser()}
${cmake} -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc -DCMAKE_C_COMPILER=/opt/rocm/bin/hipcc -DAMDGPU_TARGETS=\$gfx_arch -DSINGLELIB=on ${buildTypeArg} ${noclientArgs} ${warningArgs} ${rtcBuildCache} ../..
make -j\$(nproc)
"""
platform.runCommand(this, command)
}
def runTestCommand (platform, project, boolean debug=false)
{
String sudo = auxiliary.sudo(platform.jenkinsLabel)
String directory = debug ? 'debug' : 'release'
def dataTypes = ['single', 'double']
for (def dataType in dataTypes)
{
def command = """#!/usr/bin/env bash
set -ex
pwd
cd ${project.paths.project_build_prefix}
./scripts/perf/rocfft-perf run --bench ./build/${directory}/clients/staging/dyna-rocfft-bench --lib ./ref-repo/build/${directory}/library/src/librocfft.so --lib ./build/${directory}/library/src/librocfft.so --out ./${dataType}_ref --out ./${dataType}_change --device 0 --precision ${dataType} --suite benchmarks
ls ${dataType}_change
ls ${dataType}_ref
mkdir ${dataType}_results
./scripts/perf/rocfft-perf post ./${dataType}_results ./${dataType}_ref ./${dataType}_change
ls ${dataType}_change/*.mdat
./scripts/perf/rocfft-perf html ./${dataType}_results ./${dataType}_ref ./${dataType}_change
mv ${dataType}_results/figs.html ${dataType}_results/figs_${platform.gpu}.html
"""
platform.runCommand(this, command)
archiveArtifacts "${project.paths.project_build_prefix}/${dataType}_results/*.html"
publishHTML([allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: false,
reportDir: "${project.paths.project_build_prefix}/${dataType}_results",
reportFiles: "figs_${platform.gpu}.html",
reportName: "${dataType}-precision-${platform.gpu}",
reportTitles: "${dataType}-precision-${platform.gpu}"])
}
withCredentials([gitUsernamePassword(credentialsId: 'GitHub-ROCmMathLibrariesBot-Token', gitToolName: 'git-tool')])
{
platform.runCommand(
this,
"""
cd ${project.paths.build_prefix}
git clone https://github.com/ROCmSoftwarePlatform/rocPTS.git -b release/rocpts-rel-1.2.0
cd rocPTS
python3 -m pip install build
python3 -m build
python3 -m pip install .
"""
)
}
writeFile(
file: project.paths.project_build_prefix + "/record_pts.py",
text: libraryResource("com/amd/scripts/record_pts.py"))
def setupBranch = env.CHANGE_ID ? "git branch \$BRANCH_NAME" : ""
def command = """#!/usr/bin/env bash
set -ex
cd ${project.paths.project_build_prefix}
${setupBranch}
git checkout \$BRANCH_NAME
benchmark_folder=rocFFT_Benchmark_Dataset_\$(date +%Y%m%d)
mkdir -p \${benchmark_folder}/all_change \${benchmark_folder}/all_ref
cp -uf ./*_change/* \${benchmark_folder}/all_change
cp -uf ./*_ref/* \${benchmark_folder}/all_ref
python3 ./record_pts.py \
--dataset-path \$PWD/\${benchmark_folder} \
--reference-dataset all_ref \
--new-dataset all_change \
--new-build . \
--reference-build ./ref-repo\
-v 5.5 \
-l pts_rocfft_benchmark_data-v1.0.0
"""
withCredentials([usernamePassword(credentialsId: 'PTS_API_ID_KEY_PROD', usernameVariable: 'PTS_API_ID', passwordVariable: 'PTS_API_KEY')])
{
platform.runCommand(this, command)
}
}
def runCI =
{
nodeDetails, jobName->
def prj = new rocProject('rocFFT-internal', 'Performance')
prj.defaults.ccache = true
prj.timeout.compile = 600
prj.timeout.test = 600
prj.libraryDependencies = ['rocRAND','hipRAND']
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
boolean formatCheck = false
def commonGroovy
def gpus = []
def dataTypes = ['single', 'double']
def compileCommand =
{
platform, project->
gpus.add(platform.gpu)
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
runCompileCommand(platform, project, jobName)
}
def testCommand =
{
platform, project->
runTestCommand(platform, project)
}
buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, null)
def commentString = "Performance reports: \n" + "Commit hashes: \n"
for(parentHash in prj.gitParentHashes) {
commentString += "${parentHash} \n"
}
for (gpu in gpus) {
for (dataType in dataTypes) {
commentString += "[${gpu} ${dataType} report](${JOB_URL}/${dataType}-precision-${gpu})\n"
}
}
boolean commentExists = false
for (prComment in pullRequest.comments) {
if (prComment.body.contains("Performance reports:"))
{
commentExists = true
prComment.body = commentString
}
}
if (!commentExists) {
def comment = pullRequest.comment(commentString)
}
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = ["compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])]]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900','gfx906']])]
jobNameList = auxiliary.appendJobNameList(jobNameList)
propertyList.each
{
jobName, property->
if (urlJobName == jobName)
properties(auxiliary.addCommonProperties(property))
}
jobNameList.each
{
jobName, nodeDetails->
if (urlJobName == jobName)
stage(jobName) {
runCI(nodeDetails, jobName)
}
}
// For url job names that are not listed by the jobNameList i.e. compute-rocm-dkms-no-npi-1901
if(!jobNameList.keySet().contains(urlJobName))
{
properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
stage(urlJobName) {
runCI([ubuntu18:['gfx906']], urlJobName)
}
}
}
|