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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ if ( NOT DEFINED CMAKE_Fortran_COMPILER AND NOT DEFINED ENV{FC} )
set( CMAKE_Fortran_COMPILER "gfortran" )
endif()



project( rocblas LANGUAGES CXX )

set(THREADS_PREFER_PTHREAD_FLAG ON)
Expand Down Expand Up @@ -139,6 +141,10 @@ include( ROCMInstallTargets )
include( ROCMPackageConfigHelpers )
include( ROCMInstallSymlinks )

include (cmake/os-detection.cmake)
get_os_id(OS_ID)
message (STATUS "OS detected is ${OS_ID}")

# Versioning via rocm-cmake
set ( VERSION_STRING "2.8.1" )
rocm_setup_version( VERSION ${VERSION_STRING} )
Expand Down
19 changes: 13 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ rocBLASCI:
rocblas.paths.build_command = './install.sh -lasm_ci -c'

// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(['gfx900 && ubuntu', 'gfx906 && ubuntu', 'gfx900 && centos7', 'gfx906 && centos7'], rocblas)
def nodes = new dockerNodes(['ubuntu && gfx900', 'gfx900 && centos7', 'gfx906 && centos7', 'sles && gfx906'], rocblas)

boolean formatCheck = true

Expand All @@ -52,6 +52,15 @@ rocBLASCI:
LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hipcc ${project.paths.build_command} --hip-clang
"""
}
else if(platform.jenkinsLabel.contains('sles'))
{
command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}
LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hipcc sudo ${project.paths.build_command}
"""
}

else
{
command = """#!/usr/bin/env bash
Expand All @@ -63,15 +72,13 @@ rocBLASCI:
platform.runCommand(this, command)
}

rocblas.timeout.test = 600

def testCommand =
{
platform, project->

def command

if(platform.jenkinsLabel.contains('centos'))
if(platform.jenkinsLabel.contains('centos') || platform.jenkinsLabel.contains('sles'))
{
if(auxiliary.isJobStartedByTimer())
{
Expand All @@ -92,7 +99,7 @@ rocBLASCI:
LD_LIBRARY_PATH=/opt/rocm/hcc/lib ./example-sscal
LD_LIBRARY_PATH=/opt/rocm/hcc/lib GTEST_LISTENER=NO_PASS_LINE_IN_LOG sudo ./rocblas-test --gtest_output=xml --gtest_color=yes --gtest_filter=*quick*:*pre_checkin*-*known_bug* #--gtest_filter=*checkin*
"""

platform.runCommand(this, command)
junit "${project.paths.project_build_prefix}/build/release/clients/staging/*.xml"
}
Expand Down Expand Up @@ -145,7 +152,7 @@ rocBLASCI:
platform.runCommand(this, command)
platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/release/package/*.rpm""")
}
else if(platform.jenkinsLabel.contains('hip-clang'))
else if(platform.jenkinsLabel.contains('hip-clang') || platform.jenkinsLabel.contains('sles'))
{
packageCommand = null
}
Expand Down
2 changes: 1 addition & 1 deletion clients/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endif()
# This project may compile dependencies for clients
project( rocblas-clients LANGUAGES CXX )

if(EXISTS /etc/redhat-release)
if(OS_ID_rhel OR OS_ID_centos OR OS_ID_sles)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp=libgomp -pthread")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -pthread")
Expand Down
20 changes: 14 additions & 6 deletions clients/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ target_include_directories( rocblas-bench
set( BLIS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/build/deps/blis/include/blis )
set( BLIS_LIBRARY ${CMAKE_SOURCE_DIR}/build/deps/blis/lib/libblis.so )

if( EXISTS /etc/redhat-release)

if( OS_ID_rhel OR OS_ID_centos OR OS_ID_sles)
if( OS_ID_rhel OR OS_ID_centos)
set( OPENMP_INCLUDE_DIR /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include )
set( OPENMP_LIBRARY /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/libgomp.so )
set( OPENMP_LIBRARY /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/libgomp.so )

if(EXISTS /opt/rocm/hcc/lib/clang/10.0.0/include/immintrin.h)
set( CLANG_INCLUDE_DIR /opt/rocm/hcc/lib/clang/10.0.0/include )
Expand All @@ -76,18 +78,24 @@ if( EXISTS /etc/redhat-release)
else()
error("cannot find immintrin.h")
endif()
else()
#SLES
set( OPENMP_INCLUDE_DIR /usr/lib64/gcc/x86_64-suse-linux/7/include/ )
set( OPENMP_LIBRARY /usr/lib64/gcc/x86_64-suse-linux/7/libgomp.so )
set( CLANG_INCLUDE_DIR /opt/rocm/hcc/lib/clang/9.0.0/include )
endif()

# External header includes included as system files
target_include_directories( rocblas-bench
SYSTEM PRIVATE
$<BUILD_INTERFACE:${CLANG_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CLANG_INCLUDE_DIR}>
$<BUILD_INTERFACE:${BLIS_INCLUDE_DIR}>
$<BUILD_INTERFACE:${HIP_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${HCC_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${CBLAS_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${OPENMP_INCLUDE_DIR}>
)
$<BUILD_INTERFACE:${OPENMP_INCLUDE_DIR}>
)
if(LINK_BLIS)
target_link_libraries( rocblas-bench PRIVATE ${Boost_LIBRARIES} ${BLIS_LIBRARY} ${OPENMP_LIBRARY} cblas lapack roc::rocblas )
else()
Expand All @@ -104,7 +112,7 @@ else()
$<BUILD_INTERFACE:${CBLAS_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${BLIS_INCLUDE_DIR}>
)

if(LINK_BLIS)
target_link_libraries( rocblas-bench PRIVATE ${Boost_LIBRARIES} ${BLIS_LIBRARY} cblas lapack roc::rocblas )
else()
Expand Down
15 changes: 11 additions & 4 deletions clients/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ target_include_directories( rocblas-test
set( BLIS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/build/deps/blis/include/blis )
set( BLIS_LIBRARY ${CMAKE_SOURCE_DIR}/build/deps/blis/lib/libblis.so )

if( EXISTS /etc/redhat-release)
if( OS_ID_rhel OR OS_ID_centos OR OS_ID_sles)
if( OS_ID_rhel OR OS_ID_centos)
set( OPENMP_INCLUDE_DIR /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include )
set( OPENMP_LIBRARY /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/libgomp.so )

Expand All @@ -112,18 +113,24 @@ if( EXISTS /etc/redhat-release)
else()
error("cannot find immintrin.h")
endif()
else()
#SLES
set( OPENMP_INCLUDE_DIR /usr/lib64/gcc/x86_64-suse-linux/7/include/ )
set( OPENMP_LIBRARY /usr/lib64/gcc/x86_64-suse-linux/7/libgomp.so )
set( CLANG_INCLUDE_DIR /opt/rocm/hcc/lib/clang/9.0.0/include )
endif()

# External header includes included as system files
target_include_directories( rocblas-test
SYSTEM PRIVATE
$<BUILD_INTERFACE:${CLANG_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CLANG_INCLUDE_DIR}>
$<BUILD_INTERFACE:${BLIS_INCLUDE_DIR}>
$<BUILD_INTERFACE:${HIP_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${HCC_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${CBLAS_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${OPENMP_INCLUDE_DIR}>
$<BUILD_INTERFACE:${OPENMP_INCLUDE_DIR}>
)

if(LINK_BLIS)
Expand All @@ -142,7 +149,7 @@ else()
$<BUILD_INTERFACE:${CBLAS_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${BLIS_INCLUDE_DIR}>
)

if(LINK_BLIS)
target_link_libraries( rocblas-test PRIVATE ${GTEST_LIBRARIES} ${Boost_LIBRARIES} ${BLIS_LIBRARY} cblas lapack roc::rocblas )
else()
Expand Down
24 changes: 24 additions & 0 deletions cmake/os-detection.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ########################################################################
# Copyright 2019 Advanced Micro Devices, Inc.
# ########################################################################

function (get_os_id OS_ID)
set(_os_id "unknown")
if (EXISTS "/etc/os-release")
read_key("ID" _os_id)
endif()
set(${OS_ID} ${_os_id} PARENT_SCOPE)
set(${OS_ID}_${_os_id} TRUE PARENT_SCOPE)
endfunction()

function (read_key KEYVALUE OUTPUT)
#finds the line with the keyvalue
file (STRINGS /etc/os-release _keyvalue_line REGEX "^${KEYVALUE}=")

#remove keyvalue=
string (REGEX REPLACE "^${KEYVALUE}=\"?(.*)" "\\1" _output "${_keyvalue_line}")

#remove trailing quote
string (REGEX REPLACE "\"$" "" _output "${_output}")
set(${OUTPUT} ${_output} PARENT_SCOPE)
endfunction ()
53 changes: 53 additions & 0 deletions docker/dockerfile-build-sles
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Parameters related to building rocBLAS
ARG base_image

FROM ${base_image}
LABEL maintainer="rocblas-maintainer@amd.com"

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 zypper -n update && zypper -n install\
rock-dkms \
sudo \
ca-certificates \
git \
gcc-c++ \
gcc-fortran \
make \
cmake \
fftw3-devel \
rpm-build \
dpkg \
python2-PyYAML \
libboost_program_options1_66_0-devel\
libcxxtools9 \
libnuma1 \
llvm7-devel \
python3-pip

RUN pip3 install wheel && pip3 install tox pyyaml

# 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 video --shell /bin/bash jenkins && \
echo '%video ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd && \
chmod 400 /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}
5 changes: 5 additions & 0 deletions docker/dockerfile-install-sles
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Parameters related to building rocblas
ARG base_image

FROM ${base_image}
LABEL maintainer="rocblas-maintainer@amd.com"
47 changes: 39 additions & 8 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ supported_distro( )
fi

case "${ID}" in
ubuntu|centos|rhel|fedora)
ubuntu|centos|rhel|fedora|sles)
true
;;
*) printf "This script is currently supported on Ubuntu, CentOS, RHEL and Fedora\n"
Expand Down Expand Up @@ -104,6 +104,17 @@ install_dnf_packages( )
done
}

install_zypper_packages( )
{
package_dependencies=("$@")
for package in "${package_dependencies[@]}"; do
if [[ $(rpm -q ${package} &> /dev/null; echo $? ) -ne 0 ]]; then
printf "\033[32mInstalling \033[33m${package}\033[32m from distro package manager\033[0m\n"
elevate_if_not_root zypper install -y ${package}
fi
done
}

# Take an array of packages as input, and delegate the work to the appropriate distro installer
# prereq: ${ID} must be defined before calling
# prereq: ${build_clients} must be defined before calling
Expand Down Expand Up @@ -133,17 +144,21 @@ install_packages( )
"python34" "PyYAML" "python3*-PyYAML"
"gcc-c++" "libcxx-devel" "libgomp"
"hip_hcc" "rocm_smi64" "zlib-devel" )
local library_dependencies_sles=( "make" "cmake" "python3-PyYAM"
"hip_hcc" "gcc-c++" "libcxxtools9" "rpm-build" )

if [[ "${build_cuda}" == true ]]; then
# Ideally, this could be cuda-cublas-dev, but the package name has a version number in it
library_dependencies_ubuntu+=( "cuda" )
library_dependencies_centos+=( "" ) # how to install cuda on centos?
library_dependencies_fedora+=( "" ) # how to install cuda on fedora?
library_dependencies_sles+=( "" )
fi

local client_dependencies_ubuntu=( "gfortran" "libboost-program-options-dev" "libomp-dev")
local client_dependencies_centos=( "gcc-gfortran" "boost-devel" "libgomp")
local client_dependencies_fedora=( "gcc-gfortran" "boost-devel" "libgomp")
local client_dependencies_sles=( "gcc-fortran" "boost-devel" "libboost_program_options1_66_0-devel" "libgomp1")

case "${ID}" in
ubuntu)
Expand Down Expand Up @@ -174,6 +189,14 @@ install_packages( )
install_dnf_packages "${client_dependencies_fedora[@]}"
fi
;;

sles)
install_zypper_packages "${client_dependencies_sles[@]}"

if [[ "${build_clients}" == true ]]; then
install_zypper_packages "${client_dependencies_sles[@]}"
fi
;;
*)
echo "This script is currently supported on Ubuntu, CentOS, RHEL and Fedora"
exit 2
Expand Down Expand Up @@ -347,13 +370,18 @@ fi
if [[ "${cpu_ref_lib}" == blis ]] && [[ ! -f "${build_dir}/deps/blis/lib/libblis.so" ]]; then
git submodule update --init
cd extern/blis
if [[ -e "/etc/redhat-release" ]]; then
echo 'CentOS detected'
./configure --prefix=../../${build_dir}/deps/blis --enable-threading=openmp auto
else
echo 'Ubuntu detected'
./configure --prefix=../../${build_dir}/deps/blis --enable-threading=openmp CC=/opt/rocm/hcc/bin/clang auto
fi
case "${ID}" in
centos|rhel|sles)
./configure --prefix=../../${build_dir}/deps/blis --enable-threading=openmp auto
;;
ubuntu)
./configure --prefix=../../${build_dir}/deps/blis --enable-threading=openmp CC=/opt/rocm/hcc/bin/clang auto
;;
*)
echo "Unsupported OS for this script"
./configure --prefix=../../${build_dir}/deps/blis --enable-threading=openmp auto
;;
esac
make install
cd ../..
fi
Expand Down Expand Up @@ -442,6 +470,9 @@ esac
fedora)
elevate_if_not_root dnf install rocblas-*.rpm
;;
sles)
elevate_if_not_root zypper --no-gpg-checks in -y install rocblas-*.rpm
;;
esac

fi
Expand Down