| 1 |
// This file is for internal AMD use. |
| 2 |
// If you are interested in running your own Jenkins, please raise a github issue for assistance. |
| 3 |
|
| 4 |
def runCompileCommand(platform, project, jobName, boolean debug=false, boolean staticLibrary=false, boolean sameOrg=false) |
| 5 |
{ |
| 6 |
project.paths.construct_build_prefix() |
| 7 |
|
| 8 |
def getDependenciesCommand = "" |
| 9 |
if (project.installLibraryDependenciesFromCI) |
| 10 |
{ |
| 11 |
project.libraryDependencies.each |
| 12 |
{ |
| 13 |
libraryName -> |
| 14 |
getDependenciesCommand += auxiliary.getLibrary(libraryName, platform.jenkinsLabel, 'develop', sameOrg) |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
project.paths.build_command = './install -c' |
| 19 |
String buildTypeArg = debug ? '-DCMAKE_BUILD_TYPE=Debug' : '-DCMAKE_BUILD_TYPE=Release' |
| 20 |
String buildTypeDir = debug ? 'debug' : 'release' |
| 21 |
String buildStatic = staticLibrary ? '-DBUILD_SHARED_LIBS=OFF' : '-DBUILD_SHARED_LIBS=ON' |
| 22 |
String cmake = platform.jenkinsLabel.contains('centos') ? 'cmake3' : 'cmake' |
| 23 |
//Set CI node's gfx arch as target if PR, otherwise use default targets of the library |
| 24 |
String amdgpuTargets = env.BRANCH_NAME.startsWith('PR-') ? '-DAMDGPU_TARGETS=\$gfx_arch' : '' |
| 25 |
String compiler = '/opt/rocm/bin/hipcc' |
| 26 |
String useCUDA = '' |
| 27 |
if (platform.jenkinsLabel.contains('cuda')) |
| 28 |
{ |
| 29 |
compiler = 'g++' |
| 30 |
useCUDA = '-DBUILD_WITH_LIB=CUDA' |
| 31 |
amdgpuTargets = '' |
| 32 |
} |
| 33 |
|
| 34 |
def command = """#!/usr/bin/env bash |
| 35 |
set -x |
| 36 |
cd ${project.paths.project_build_prefix} |
| 37 |
${getDependenciesCommand} |
| 38 |
mkdir -p build/${buildTypeDir} && cd build/${buildTypeDir} |
| 39 |
# gfxTargetParser reads gfxarch and adds target features such as xnack |
| 40 |
${auxiliary.gfxTargetParser()} |
| 41 |
echo "ROCM_PATH = \${ROCM_PATH}" |
| 42 |
${cmake} -DCMAKE_CXX_COMPILER=${compiler} ${useCUDA} ${buildTypeArg} ${buildStatic} ${amdgpuTargets} -DBUILD_TEST=ON -DBUILD_BENCHMARK=ON ../.. |
| 43 |
make -j\$(nproc) |
| 44 |
""" |
| 45 |
|
| 46 |
platform.runCommand(this, command) |
| 47 |
} |
| 48 |
|
| 49 |
def runTestCommand (platform, project) |
| 50 |
{ |
| 51 |
String sudo = auxiliary.sudo(platform.jenkinsLabel) |
| 52 |
|
| 53 |
def extraArgs = platform.jenkinsLabel.contains('cuda') ? "-E test_hiprand_linkage" : "" |
| 54 |
def testCommand = "ctest ${extraArgs} --output-on-failure" |
| 55 |
|
| 56 |
def command = """#!/usr/bin/env bash |
| 57 |
set -x |
| 58 |
cd ${project.paths.project_build_prefix}/build/release |
| 59 |
make -j4 |
| 60 |
${sudo} LD_LIBRARY_PATH=/opt/rocm/lib/ ${testCommand} |
| 61 |
""" |
| 62 |
|
| 63 |
platform.runCommand(this, command) |
| 64 |
} |
| 65 |
|
| 66 |
def runPackageCommand(platform, project) |
| 67 |
{ |
| 68 |
def packageHelper = platform.makePackage(platform.jenkinsLabel,"${project.paths.project_build_prefix}/build/release") |
| 69 |
|
| 70 |
platform.runCommand(this, packageHelper[0]) |
| 71 |
platform.archiveArtifacts(this, packageHelper[1]) |
| 72 |
} |
| 73 |
|
| 74 |
return this |