Commit e4e19b1d authored by Chris Austen's avatar Chris Austen
Browse files

change to new method

parent a8242371
// RULES:
// def rocmtestnode(variant, name, body, args, pre) { // 1) Build and cache the docker
def rocmtestnode(Map conf) { // 2) Be able to restart parts of the pipeline
def variant = conf.get("variant") // 3) Check your targets
def name = conf.get("node") //
def body = conf.get("body") // Build Process
def docker_args = conf.get("docker_args", "") //
def docker_build_args = conf.get("docker_build_args", "") // HIP Clang Docker --> "all targets", "clang asan", etc
def pre = conf.get("pre", {}) // ORT Docker --> "ORT benchmark"
def post = conf.get("post", {}) //
def ccache = "/var/jenkins/.cache/ccache" // Each docker can be used on any system
def image = 'migraphxlib'
env.CCACHE_COMPRESSLEVEL = 7
env.CCACHE_DIR = ccache
def cmake_build = { bconf -> def rocmnode(name) {
def compiler = bconf.get("compiler", "/opt/rocm/llvm/bin/clang++") return 'rocmtest && (' + name + ')'
def flags = bconf.get("flags", "") }
def gpu_debug = bconf.get("gpu_debug", "0")
def cmd = """ def getDockerImageName(dockerArgs)
ulimit -c unlimited {
echo "leak:dnnl::impl::malloc" > suppressions.txt sh "echo ${dockerArgs} > factors.txt"
export LSAN_OPTIONS="suppressions=\$(pwd)/suppressions.txt" def image = "rocm/migraphx-ci-ubuntu"
export MIGRAPHX_GPU_DEBUG=${gpu_debug} sh "md5sum Dockerfile requirements.txt dev-requirements.txt >> factors.txt"
export CXX=${compiler} def docker_hash = sh(script: "md5sum factors.txt | awk '{print \$1}' | head -c 6", returnStdout: true)
export CXXFLAGS='-Werror' sh "rm factors.txt"
env echo "Docker tag hash: ${docker_hash}"
rm -rf build image = "${image}:ci_${docker_hash}"
mkdir build if(params.DOCKER_IMAGE_OVERRIDE != '')
cd build {
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_DEV=On -DCMAKE_EXECUTE_PROCESS_COMMAND_ECHO=STDOUT ${flags} .. echo "Overriding the base docker image with ${params.DOCKER_IMAGE_OVERRIDE}"
git diff image = "${params.DOCKER_IMAGE_OVERRIDE}"
git diff-index --quiet HEAD || (echo "Git repo is not clean after running cmake." && exit 1) }
make -j\$(nproc) generate VERBOSE=1 return image
git diff
git diff-index --quiet HEAD || (echo "Generated files are different. Please run make generate and commit the changes." && exit 1) }
make -j\$(nproc) all package VERBOSE=1
md5sum ./*.deb def getDockerImage(Map conf=[:])
""" {
echo cmd env.DOCKER_BUILDKIT=1
sh cmd def gpu_arch = "gfx1030;gfx1100;gfx1101;gfx1102" // prebuilt dockers should have all the architectures enabled so one image can be used for all stages
// Only archive from master or develop def dockerArgs = "--build-arg GPU_TARGETS='${gpu_arch}'"
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master") { echo "Docker Args: ${dockerArgs}"
archiveArtifacts artifacts: "build/*.deb", allowEmptyArchive: true, fingerprint: true
} def image = getDockerImageName(dockerArgs)
}
node(name) { def dockerImage
withEnv(['HSA_ENABLE_SDMA=0']) { try{
stage("checkout ${variant}") { echo "Pulling down image: ${image}"
checkout scm dockerImage = docker.image("${image}")
} dockerImage.pull()
gitStatusWrapper(credentialsId: "${env.status_wrapper_creds}", gitHubContext: "Jenkins - ${variant}", account: 'ROCmSoftwarePlatform', repo: 'AMDMIGraphX') { }
pre() catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e){
stage("image ${variant}") { echo "The job was cancelled or aborted"
try { throw e
docker.build("${image}", "${docker_build_args} .") }
} catch(Exception ex) { catch(Exception ex)
docker.build("${image}", "${docker_build_args} --no-cache .") {
dockerImage = docker.build("${image}", "${dockerArgs} .")
} withDockerRegistry([ credentialsId: "docker_test_cred", url: "" ]) {
} dockerImage.push()
withDockerContainer(image: image, args: "--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE -v=/var/jenkins/:/var/jenkins ${docker_args}") { }
timeout(time: 2, unit: 'HOURS') { }
body(cmake_build) return [dockerImage, image]
} }
}
post()
}
} pipeline {
} agent none
} options {
def rocmtest(m) { parallelsAlwaysFailFast()
def builders = [:] }
m.each { e -> parameters {
def label = e.key; booleanParam(
def action = e.value; name: "BUILD_DOCKER",
builders[label] = { defaultValue: true,
action(label) description: "")
} booleanParam(
} name: "BUILD_STATIC_CHECKS",
parallel builders defaultValue: true,
} description: "")
string(name: "DOCKER_IMAGE_OVERRIDE",
def rocmnodename(name) { defaultValue: '',
def rocmtest_name = "(rocmtest || migraphx)" description: "")
def node_name = "${rocmtest_name}" }
if(name == "fiji") {
node_name = "${rocmtest_name} && fiji"; stages{
} else if(name == "vega") { stage('Build Docker'){
node_name = "${rocmtest_name} && vega"; when {
} else if(name == "navi") { expression { params.BUILD_DOCKER }
node_name = "${rocmtest_name} && (navi21 || navi31 || navi32)"; }
} else if(name == "mi100+") { agent{ label rocmnode("nogpu") }
node_name = "${rocmtest_name} && (gfx908 || gfx90a) && !vm"; steps{
} else if(name == "cdna") { getDockerImage()
node_name = "${rocmtest_name} && (gfx908 || gfx90a || vega20) && !vm"; }
} else if(name == "nogpu") { }
node_name = "${rocmtest_name} && nogpu"; stage("Static checks") {
} parallel{
return node_name stage('Hip Tidy') {
} agent{ label rocmnode("nogpu") }
environment{
def rocmnode(name, body) { }
return { label -> steps{
rocmtestnode(variant: label, node: rocmnodename(name), body: body) sh "echo Hi from Hip Tidy"
} }
} }
def onnxnode(name, body) { stage('Clang Format') {
return { label -> agent{ label rocmnode("nogpu") }
rocmtestnode(variant: label, node: rocmnodename(name), docker_args: '-u root', body: body, post: { steps{
sh ''' sh "echo Hi from Clang Format"
apt install half }
env }
md5sum ./build/*.deb }
dpkg -i ./build/*.deb }
cd /onnxruntime && ./build_and_test_onnxrt.sh }
''' }
})
}
}
rocmtest clang_ort: onnxnode('navi') { cmake_build ->
stage('ONNX Runtime') {
cmake_build(flags: "-DCMAKE_BUILD_TYPE=release -DGPU_TARGETS=\"gfx1030;gfx1100;gfx1101\"")
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment