Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Style file for MLSE Libraries based on the modified rocBLAS style

# Common settings
BasedOnStyle: WebKit
TabWidth: 4
IndentWidth: 4
UseTab: Never
ColumnLimit: 100

# Other languages JavaScript, Proto

---
Language: Cpp

# http://releases.llvm.org/6.0.1/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code
# int formatted_code;
# // clang-format off
# void unformatted_code ;
# // clang-format on
# void formatted_code_again;

DisableFormat: false
Standard: Cpp11

AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom
# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
# AfterExternBlock : 'true'
}

#BreakAfterJavaFieldAnnotations: true
#BreakBeforeInheritanceComma: false
#BreakBeforeBinaryOperators: None
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializersBeforeComma: true
#BreakStringLiterals: true

CommentPragmas: '^ IWYU pragma:'
#CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
#SpaceBeforeCpp11BracedList: false
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
#FixNamespaceComments: true
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
#JavaScriptQuotes: Double
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 4
#ObjCSpaceAfterProperty: true
#ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000

PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
#SpaceAfterTemplateKeyword: true
#SpaceBeforeInheritanceColon: true

#SortUsingDeclarations: true
SortIncludes: true

# Comments are for developers, they should arrange them
ReflowComments: false

#IncludeBlocks: Preserve
#IndentPPDirectives: AfterHash
---
8 changes: 8 additions & 0 deletions .githooks/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

cd $(git rev-parse --git-dir)
cd hooks

echo "Installing hooks..."
ln -s ../../.githooks/pre-commit pre-commit
echo "Done!"
58 changes: 58 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/sh
#
# This pre-commit hook checks if any versions of clang-format
# are installed, and if so, uses the installed version to format
# the staged changes.

base=clang-format-3.8
format=""

# Redirect output to stderr.
exec 1>&2

# check if clang-format is installed
type "$base" >/dev/null 2>&1 && format="$base"

# no versions of clang-format are installed
if [ -z "$format" ]
then
echo "$base is not installed. Commit is cancelled. Delete the hook to force commit."
exit 1
fi

# Do everything from top - level
cd $(git rev-parse --show-toplevel)

if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

exitCode=0

# do the formatting
for file in $(git diff-index --cached --name-only $against | grep -E '\.h$|\.hpp$|\.cpp$|\.cl$|\.h\.in$|\.hpp\.in$|\.cpp\.in$')
do
if [ -e "$file" ]
then
# echo "$format $file"
"$format" -style=file -output-replacements-xml "$file" | grep "\<replacement\>" >/dev/null
if [ $? -ne 1 ]; then
echo "$format" -i -style=file "$file"
exitCode=1
fi

fi
done

if [ $exitCode -eq 1 ]; then
echo "Please fix the errors by running the commands listed above."
echo "Commit is cancelled. You may force by deleting the hook in .githook"
else
echo "Clang format checks passed"
fi

exit $exitCode
62 changes: 62 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env groovy
@Library('rocJenkins') _
import com.amd.project.*
import com.amd.docker.*

////////////////////////////////////////////////////////////////////////
import java.nio.file.Path;

rocprimCI:
{

def rocprim = new rocProject('rocprim')

def nodes = new dockerNodes(['gfx803', 'gfx900', 'gfx906'], rocprim)

boolean formatCheck = false

def compileCommand =
{
platform, project->

project.paths.construct_build_prefix()
def command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}
LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=${project.compiler.compiler_path} ${project.paths.build_command}
"""
platform.runCommand(this, command)
}

def testCommand =
{
platform, project->

def testCommand = 'ctest --output-on-failure -E rocprim.hip.device_merge_sort'

def command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}
cd ${project.testDirectory}
LD_LIBRARY_PATH=/opt/rocm/hcc/lib ${testCommand}
"""

platform.runCommand(this, command)
}

def packageCommand =
{
platform, project->

def command = """
echo "rocPRIM is a header only library and does not need packaging"
"""

platform.runCommand(this, command)
}

buildProject(rocprim, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)

}


50 changes: 50 additions & 0 deletions docker/dockerfile-build-ubuntu-rock
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Parameters related to building hip
ARG base_image

FROM ${base_image}
LABEL maintainer="kent.knox@amd"

ARG user_uid

# Install dependent packages
# Dependencies:
# * hcc-config.cmake: pkg-config
# * tensile: python2.7, python-yaml
# * rocblas-test: gfortran, googletest
# * rocblas-bench: libboost-program-options-dev
# * libhsakmt.so: libnuma1
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
rock-dkms \
sudo \
ca-certificates \
git \
make \
cmake \
clang-format-3.8 \
pkg-config \
python2.7 \
python-yaml \
gfortran \
libboost-program-options-dev \
libnuma1 \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# docker pipeline runs containers with particular uid
# create a jenkins user with this specific uid so it can use sudo priviledges
# Grant any member of sudo group password-less sudo privileges
RUN useradd --create-home -u ${user_uid} -o -G sudo --shell /bin/bash jenkins && \
mkdir -p /etc/sudoers.d/ && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd

ARG ROCBLAS_SRC_ROOT=/usr/local/src/rocBLAS

# Clone rocblas repo
# Build client dependencies and install into /usr/local (LAPACK & GTEST)
RUN mkdir -p ${ROCBLAS_SRC_ROOT} && cd ${ROCBLAS_SRC_ROOT} && \
git clone -b saad/develop --depth=1 https://github.com/saadrahim/rocPRIM . #&& \
#mkdir -p build/deps && cd build/deps && \
#cmake -DBUILD_BOOST=OFF ${ROCBLAS_SRC_ROOT}/deps && \
#make -j $(nproc) install && \
#rm -rf ${ROCBLAS_SRC_ROOT}
54 changes: 54 additions & 0 deletions docker/dockerfile-install-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Parameters related to building hip
ARG base_image

FROM ${base_image}
LABEL maintainer="kent.knox@amd"

ARG user_uid

# Install dependent packages
# Dependencies:
# * hcc-config.cmake: pkg-config
# * tensile: python2.7, python-yaml
# * rocblas-test: gfortran, googletest
# * rocblas-bench: libboost-program-options-dev
# * libhsakmt.so: libnuma1

USER root

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python2.7-minimal
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
ca-certificates \
git \
make \
cmake \
clang-format-3.8 \
pkg-config \
python2.7 \
python-yaml \
gfortran \
libboost-program-options-dev \
libnuma1 \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# docker pipeline runs containers with particular uid
# create a jenkins user with this specific uid so it can use sudo priviledges
# Grant any member of sudo group password-less sudo privileges
RUN useradd --create-home -u ${user_uid} -o -G sudo --shell /bin/bash jenkins && \
mkdir -p /etc/sudoers.d/ && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd

ARG ROCBLAS_SRC_ROOT=/usr/local/src/rocBLAS

# Clone rocblas repo
# Build client dependencies and install into /usr/local (LAPACK & GTEST)
RUN mkdir -p ${ROCBLAS_SRC_ROOT} && cd ${ROCBLAS_SRC_ROOT} && \
git clone -b develop --depth=1 https://github.com/ROCmSoftwarePlatform/rocBLAS . && \
mkdir -p build/deps && cd build/deps && \
cmake -DBUILD_BOOST=OFF ${ROCBLAS_SRC_ROOT}/deps && \
make -j $(nproc) install
# rm -rf ${ROCBLAS_SRC_ROOT}
Loading