Jenkinsfile 4.2 KB
Newer Older
Paul's avatar
Paul committed
1

2
3
4
5
6
7
8
9
// def rocmtestnode(variant, name, body, args, pre) {
def rocmtestnode(Map conf) {
    def variant = conf.get("variant")
    def name = conf.get("node")
    def body = conf.get("body")
    def docker_args = conf.get("docker_args", "")
    def docker_build_args = conf.get("docker_build_args", "")
    def pre = conf.get("pre", {})
Paul Fultz II's avatar
Paul Fultz II committed
10
    def ccache = "/var/jenkins/.cache/ccache"
Paul's avatar
Paul committed
11
    def image = 'migraphxlib'
Paul Fultz II's avatar
Paul Fultz II committed
12
13
    env.CCACHE_COMPRESSLEVEL = 7
    env.CCACHE_DIR = ccache
Paul Fultz II's avatar
Paul Fultz II committed
14
15
16
17
    def cmake_build = { bconf ->
        def compiler = bconf.get("compiler", "/opt/rocm/llvm/bin/clang++")
        def flags = bconf.get("flags", "")
        def gpu_debug = bconf.get("gpu_debug", "0")
Paul's avatar
Paul committed
18
        def cmd = """
Paul's avatar
Paul committed
19
            ulimit -c unlimited
Paul's avatar
Paul committed
20
21
            echo "leak:dnnl::impl::malloc" > suppressions.txt
            export LSAN_OPTIONS="suppressions=\$(pwd)/suppressions.txt"
Paul Fultz II's avatar
Paul Fultz II committed
22
23
24
25
            export MIGRAPHX_GPU_DEBUG=${gpu_debug}
            export CXX=${compiler}
            export CXXFLAGS='-Werror'
            env
Paul's avatar
Paul committed
26
27
28
            rm -rf build
            mkdir build
            cd build
29
            cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_DEV=On -DCMAKE_EXECUTE_PROCESS_COMMAND_ECHO=STDOUT ${flags} ..
30
31
32
33
34
35
            git diff
            git diff-index --quiet HEAD || (echo "Git repo is not clean after running cmake." && exit 1)
            make -j\$(nproc) generate VERBOSE=1
            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 doc package check VERBOSE=1
Chris Austen's avatar
Chris Austen committed
36
            md5sum ./*.deb
Paul's avatar
Paul committed
37
38
39
        """
        echo cmd
        sh cmd
Umang Yadav's avatar
Umang Yadav committed
40
41
42
        // Only archive from master or develop
        if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master") {
            archiveArtifacts artifacts: "build/*.deb", allowEmptyArchive: true, fingerprint: true
Paul's avatar
Paul committed
43
        }
Paul's avatar
Paul committed
44
45
    }
    node(name) {
46
        withEnv(['HSA_ENABLE_SDMA=0']) {
Paul's avatar
Paul committed
47
48
49
            stage("checkout ${variant}") {
                checkout scm
            }
Paul's avatar
Paul committed
50
            gitStatusWrapper(credentialsId: "${env.status_wrapper_creds}", gitHubContext: "Jenkins - ${variant}", account: 'ROCmSoftwarePlatform', repo: 'AMDMIGraphX') {
Paul's avatar
Paul committed
51
52
53
54
55
56
                pre()
                stage("image ${variant}") {
                    try {
                        docker.build("${image}", "${docker_build_args} .")
                    } catch(Exception ex) {
                        docker.build("${image}", "${docker_build_args} --no-cache .")
Paul's avatar
Paul committed
57

Paul's avatar
Paul committed
58
                    }
Paul's avatar
Paul committed
59
                }
Paul Fultz II's avatar
Paul Fultz II committed
60
                withDockerContainer(image: image, args: "--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE -v=/var/jenkins/:/var/jenkins ${docker_args}") {
61
                    timeout(time: 2, unit: 'HOURS') {
Paul's avatar
Paul committed
62
63
                        body(cmake_build)
                    }
Paul's avatar
Paul committed
64
                }
Paul's avatar
Paul committed
65
66
67
68
69
70
            }
        }
    }
}
def rocmtest(m) {
    def builders = [:]
Paul Fultz II's avatar
Paul Fultz II committed
71
    m.each { e ->
Paul's avatar
Paul committed
72
73
74
75
76
77
78
79
80
        def label = e.key;
        def action = e.value;
        builders[label] = {
            action(label)
        }
    }
    parallel builders
}

81
def rocmnodename(name) {
Paul's avatar
Paul committed
82
83
84
85
86
87
    def rocmtest_name = "(rocmtest || migraphx)"
    def node_name = "${rocmtest_name}"
    if(name == "fiji") {
        node_name = "${rocmtest_name} && fiji";
    } else if(name == "vega") {
        node_name = "${rocmtest_name} && vega";
88
89
    } else if(name == "navi21") {
        node_name = "${rocmtest_name} && navi21";
90
    } else if(name == "mi100+") {
91
        node_name = "${rocmtest_name} && (gfx908 || gfx90a) && !vm";
92
    } else if(name == "cdna") {
93
        node_name = "${rocmtest_name} && (gfx908 || gfx90a || vega20) && !vm";
Paul's avatar
Paul committed
94
    } else if(name == "nogpu") {
95
        node_name = "${rocmtest_name} && nogpu";
Paul's avatar
Paul committed
96
    }
97
    return node_name
Paul's avatar
Paul committed
98
99
}

Paul Fultz II's avatar
Paul Fultz II committed
100
def rocmnode(name, body) {
101
102
103
    return { label ->
        rocmtestnode(variant: label, node: rocmnodename(name), body: body)
    }
Paul Fultz II's avatar
Paul Fultz II committed
104
105
}

Chris Austen's avatar
Chris Austen committed
106
107
rocmtest clang_ort: rocmnode('cdna') { cmake_build ->
    stage('ONNX Runtime') {
Paul Fultz II's avatar
Paul Fultz II committed
108
        cmake_build(flags: "-DCMAKE_BUILD_TYPE=release")
Paul Fultz II's avatar
Paul Fultz II committed
109
        sh '''
110
            apt install half
Chris Austen's avatar
Chris Austen committed
111
            env
Chris Austen's avatar
Chris Austen committed
112
            md5sum ./build/*.deb
113
            dpkg -i ./build/*.deb
Paul Fultz II's avatar
Paul Fultz II committed
114
115
116
117
            cd /onnxruntime && ./build_and_test_onnxrt.sh
        '''
    }
}