Commit c70703f6 authored by Paul's avatar Paul
Browse files

Add docker and jenkins file

parent 8f0108f8
FROM ubuntu:16.04
ARG PREFIX=/opt/rocm
# Support multiarch
RUN dpkg --add-architecture i386
# Add rocm repository
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl apt-utils wget
RUN curl https://raw.githubusercontent.com/RadeonOpenCompute/ROCm-docker/develop/add-rocm.sh | bash
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
apt-utils \
build-essential \
clang-5.0 \
clang-format-5.0 \
clang-tidy-5.0 \
cmake \
curl \
doxygen \
git \
hcc \
lcov \
libnuma-dev \
python \
python-dev \
python-pip \
rocm-opencl \
rocm-opencl-dev \
software-properties-common \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install cget
RUN pip install cget
# Install cppcheck
RUN cget -p $PREFIX install danmar/cppcheck@ab02595be1b17035b534db655f9e119080a368bc
RUN cget -p $PREFIX install pfultz2/rocm-recipes
# Install dependencies
ADD requirements.txt /requirements.txt
RUN cget -p $PREFIX install -f /requirements.txt
# Install doc requirements
# ADD doc/requirements.txt /doc-requirements.txt
# RUN pip install -r /doc-requirements.txt
def rocmtestnode(variant, name, body) {
def image = 'miopen'
def cmake_build = { compiler, flags ->
def cmd = """
rm -rf build
mkdir build
cd build
CXX=${compiler} CXXFLAGS='-Werror' cmake -DCMAKE_CXX_FLAGS_DEBUG='-g -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined' ${flags} ..
CTEST_PARALLEL_LEVEL=32 make -j32 check
"""
echo cmd
sh cmd
}
node(name) {
stage("checkout ${variant}") {
env.HSA_ENABLE_SDMA=0
checkout scm
}
stage("image ${variant}") {
try {
docker.build("${image}", "--build-arg .")
} catch(Exception ex) {
docker.build("${image}", "--build-arg --no-cache .")
}
}
withDockerContainer(image: image, args: '--device=/dev/kfd --device=/dev/dri --group-add video') {
timeout(time: 1, unit: 'HOURS') {
body(cmake_build)
}
}
}
}
@NonCPS
def rocmtest(m) {
def builders = [:]
for(e in m) {
def label = e.key;
def action = e.value;
builders[label] = {
action(label)
}
}
parallel builders
}
@NonCPS
def rocmnode(name, body) {
def node_name = 'rocmtest || rocm'
if(name == 'fiji') {
node_name = 'rocmtest && fiji';
} else if(name == 'vega') {
node_name = 'rocmtest && vega';
} else {
node_name = name
}
return { label ->
rocmtestnode(label, node_name, body)
}
}
@NonCPS
def rocmnode(body) {
rocmnode('rocmtest || rocm', body)
}
// Static checks
rocmtest tidy: rocmnode('rocm') { cmake_build ->
stage('Clang Tidy') {
sh '''
rm -rf build
mkdir build
cd build
CXX='clang++-5.0' cmake ..
make -j8 -k analyze
'''
}
}, format: rocmnode('rocm') { cmake_build ->
stage('Clang Format') {
sh '''
find . -iname \'*.h\' \
-o -iname \'*.hpp\' \
-o -iname \'*.cpp\' \
-o -iname \'*.h.in\' \
-o -iname \'*.hpp.in\' \
-o -iname \'*.cpp.in\' \
-o -iname \'*.cl\' \
| grep -v 'build/' \
| xargs -n 1 -P 1 -I{} -t sh -c \'clang-format-5.0 -style=file {} | diff - {}\'
'''
}
}, clang: rocmnode('rocm') { cmake_build ->
stage('Clang Debug') {
cmake_build('clang++-5.0', '-DCMAKE_BUILD_TYPE=debug')
}
stage('Clang Release') {
cmake_build('clang++-5.0', '-DCMAKE_BUILD_TYPE=release')
}
}, gcc: rocmnode('rocm') { cmake_build ->
stage('GCC Debug') {
cmake_build('g++-5', '-DCMAKE_BUILD_TYPE=debug')
}
stage('GCC Release') {
cmake_build('g++-5', '-DCMAKE_BUILD_TYPE=release')
}
}
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