Skip to content

Commit

Permalink
Merge pull request #15 from SC-SGS/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
breyerml authored Mar 11, 2022
2 parents db15b40 + 9bd8789 commit 08e81b1
Show file tree
Hide file tree
Showing 13 changed files with 373 additions and 15 deletions.
314 changes: 314 additions & 0 deletions .jenkins/Jenkinsfile-AMD-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
#!groovy

def buildbadge = addEmbeddableBadgeConfiguration(id: "Jenkins", subject: "Jenkins Tests", status: "skipped")

if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
print "INFO: Build on ${env.BRANCH_NAME}/${env.BUILD_NUMBER} triggered by branch indexing..."
if (env.BRANCH_NAME != "master") {
if (env.BUILD_NUMBER != "1") { // Always execute first build to load this configuration and thus the triggers
print "INFO: Build on ${env.BRANCH_NAME}/${env.BUILD_NUMBER} skipped due being triggered by Branch Indexing instead of SCM change!"
buildbadge.setStatus('skipped')
currentBuild.result = 'ABORTED'
return // early exit to avoid redundant builds
}
}
} else {
print "INFO: Build on ${env.BRANCH_NAME}/${env.BUILD_NUMBER} triggered by SCM change..."
print "Proceeding!"
}


pipeline {
agent { label 'sgs_amd_gpu_node' }

options {
buildDiscarder(
logRotator(
daysToKeepStr: "21",
numToKeepStr: "50",
artifactDaysToKeepStr: "21",
artifactNumToKeepStr: "50"
)
)
disableConcurrentBuilds()
}

triggers {
githubPush() // Trigger by push to respective github branch
pollSCM 'H/30 * * * *' // Fallback polling solution as some pushes are somehow lost
}

environment {
GITHUB_TOKEN = credentials('GITHUB_TOKEN')
BRANCH_NAME = "${env.BRANCH_NAME}"
}

stages {
stage('init') {
steps {
dir('plssvm') {
sh '''
gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':')
curl --verbose\
--request POST \
--url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \
--header "Content-Type: application/json" \
--header "authorization: Bearer ${gitlab_token}" \
--data "{
\\"state\\": \\"pending\\",
\\"context\\": \\"jenkins-ctest-amd\\",
\\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\",
\\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\"
}"
'''
}
}
}
stage('checkout') {
steps {
dir('plssvm') {
checkout scm
}
}
}
stage('setup python'){
steps{
sh '''
/usr/bin/python3.8 -m pip install --user arff
/usr/bin/python3.8 -m pip install --user pandas
/usr/bin/python3.8 -m pip install --user sklearn
/usr/bin/python3.8 -m pip install --user argparse
'''
}
}
stage('build plssvm Release') {
steps {
dir('plssvm') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/hip
module load plssvm/pcsgs09/dpcpp
module load cmake-3.22.2-gcc-9.3.0-wi6mnc2
mkdir -p build/Release
cd build/Release
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_HIP_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON -DPLSSVM_ENABLE_SYCL_BACKEND=OFF ../../
make -j4
'''
}
}
}
stage('run tests Release') {
steps {
dir('plssvm') {
warnError('Release tests failed!') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/hip
module load plssvm/pcsgs09/dpcpp
cd build/Release
ctest -j4 --no-compress-output -T Test
'''
}
}
}
}
stage('build plssvm hipSYCL Release') {
steps {
dir('plssvm') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/hipsycl
module load cmake-3.22.2-gcc-9.3.0-wi6mnc2
mkdir -p build/Release_hip
cd build/Release_hip
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_HIP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=OFF -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON ../../
make -j4
'''
}
}
}
stage('run tests hipSYCL Release') {
steps {
dir('plssvm') {
warnError('hipSYCL Release tests failed!') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/hipsycl
cd build/Release_hip
ctest -j4 --no-compress-output -T Test
'''
}
}
}
}
stage('build plssvm DPC++ Release') {
steps {
dir('plssvm') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/dpcpp
module load cmake-3.22.2-gcc-9.3.0-wi6mnc2
mkdir -p build/Release_dpcpp
cd build/Release_dpcpp
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS="amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_HIP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=OFF -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON ../../
make -j4
'''
}
}
}
stage('run tests DPC++ Release') {
steps {
dir('plssvm') {
warnError('DPC++ Release tests failed!') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/dpcpp
cd build/Release_dpcpp
ctest -j4 --no-compress-output -T Test
'''
}
}
}
}
stage('build plssvm Debug') {
steps {
dir('plssvm') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/hip
module load plssvm/pcsgs09/dpcpp
module load cmake-3.22.2-gcc-9.3.0-wi6mnc2
mkdir -p build/Debug_cov
cd build/Debug_cov
rm -rf *
cmake -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_SYCL_BACKEND=OFF ../../
make -j4
'''
}
}
}
stage('build plssvm hipSYCL Debug') {
steps {
dir('plssvm') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/hipsycl
module load cmake-3.22.2-gcc-9.3.0-wi6mnc2
mkdir -p build/Debug_hip
cd build/Debug_hip
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=OFF -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON ../../
make -j4
'''
}
}
}
/*
stage('build plssvm DPC++ Debug') {
steps {
dir('plssvm') {
sh '''
source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh
module use /home/breyerml/.modulefiles/
module load plssvm/pcsgs09/dpcpp
mkdir -p build/Debug_dpcpp
cd build/Debug_dpcpp
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug -DPLSSVM_TARGET_PLATFORMS="nvidia:sm_80" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=ON -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON ../../
make -j4
'''
}
}
}
*/
}
post {
always {
// Process the CTest xml output with the xUnit plugin
xunit (
testTimeMargin: '3000',
thresholdMode: 1,
thresholds: [
skipped(failureThreshold: '0'),
failed(failureThreshold: '0')
],
tools: [CTest(
pattern: 'plssvm/build/*/Testing/**/*.xml',
deleteOutputFiles: true,
failIfNotNew: false,
skipNoTestFiles: true,
stopProcessingIfError: true
)]
)

}
success {
script {
buildbadge.setStatus('success')
}
sh '''
gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':')
curl --verbose\
--request POST \
--url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \
--header "Content-Type: application/json" \
--header "authorization: Bearer ${gitlab_token}" \
--data "{
\\"state\\": \\"success\\",
\\"context\\": \\"jenkins-ctest-amd\\",
\\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\",
\\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\"
}"
'''
}
failure {
script {
buildbadge.setStatus('failing')
}
sh '''
gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':')
curl --verbose\
--request POST \
--url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \
--header "Content-Type: application/json" \
--header "authorization: Bearer ${gitlab_token}" \
--data "{
\\"state\\": \\"failure\\",
\\"context\\": \\"jenkins-ctest-amd\\",
\\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\",
\\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\"
}"
'''
}
aborted {
script {
buildbadge.setStatus('aborted')
}
sh '''
gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':')
curl --verbose\
--request POST \
--url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \
--header "Content-Type: application/json" \
--header "authorization: Bearer ${gitlab_token}" \
--data "{
\\"state\\": \\"error\\",
\\"context\\": \\"jenkins-ctest-amd\\",
\\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\",
\\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\"
}"
'''
}
}
}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
cmake_minimum_required(VERSION 3.18)

project("PLSSVM - Parallel Least Squares Support Vector Machine"
VERSION 1.1.0
VERSION 1.1.1
LANGUAGES CXX
DESCRIPTION "A Least Squares Support Vector Machine implementation using different backends.")

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ The currently available frameworks (also called backends in our PLSSVM implement
- [OpenMP](https://www.openmp.org/)
- [CUDA](https://developer.nvidia.com/cuda-zone)
- [OpenCL](https://www.khronos.org/opencl/)
- [SYCL](https://www.khronos.org/sycl/) (tested implementations are [DPC++](https://github.com/intel/llvm) and [hipSYCL](https://github.com/illuhad/hipSYCL))
- [SYCL](https://www.khronos.org/sycl/) (tested implementations are [DPC++](https://github.com/intel/llvm) and [hipSYCL](https://github.com/illuhad/hipSYCL); specifically the commits [faaba28](https://github.com/intel/llvm/tree/faaba28541138d7ad39a7fa85fa85b863560b45f) and [6962942](https://github.com/illuhad/hipSYCL/tree/6962942c430a7b221eb167b4272c29cf397cda06) respectivelly)

// tested with commit!

## Getting Started

Expand Down Expand Up @@ -171,6 +173,7 @@ If `PLSSVM_ENABLE_TESTING` is set to `ON`, the following options can also be set

- `PLSSVM_GENERATE_TEST_FILE=ON|OFF` (default: `ON`): automatically generate test files
- `PLSSVM_TEST_FILE_NUM_DATA_POINTS` (default: `5000`): the number of data points in the test file
- `PLSSVM_TEST_FILE_NUM_FEATURES` (default: `2000`): the number of features per data point in the test file

If the SYCL backend is available and DPC++ is used, the option `PLSSVM_SYCL_DPCPP_USE_LEVEL_ZERO` can be used to select Level-Zero as the
DPC++ backend instead of OpenCL.
Expand Down
4 changes: 3 additions & 1 deletion include/plssvm/backends/OpenCL/q_kernel.cl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* @brief Defines CUDA functions for generating the `q` vector.
*/

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

/**
* @brief Calculates the `q` vector using the linear C-SVM kernel.
* @details Supports multi-GPU execution.
Expand Down Expand Up @@ -47,7 +49,7 @@ __kernel void device_kernel_q_poly(__global real_type *q, __global real_type *da
for (int i = 0; i < num_cols; ++i) {
temp += data_d[i * num_rows + index] * data_last[i];
}
q[index] = pow(gamma * temp + coef0, degree);
q[index] = pown(gamma * temp + coef0, degree);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion include/plssvm/backends/OpenCL/svm_kernel.cl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ __kernel void device_kernel_poly(__global const real_type *q, __global real_type
real_type ret_jx = 0.0;
#pragma unroll INTERNAL_BLOCK_SIZE
for (kernel_index_type y = 0; y < INTERNAL_BLOCK_SIZE; ++y) {
const real_type temp = (pow(gamma * matr[x][y] + coef0, degree) + QA_cost - q[i + y] - q[j + x]) * add;
const real_type temp = (pown(gamma * matr[x][y] + coef0, degree) + QA_cost - q[i + y] - q[j + x]) * add;
if (i + x > j + y) {
// upper triangular matrix
atomicAdd(&ret[i + y], temp * d[j + x]);
Expand Down
4 changes: 2 additions & 2 deletions include/plssvm/backends/SYCL/csvm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ class csvm : public ::plssvm::detail::gpu_csvm<T, ::plssvm::sycl::detail::device
/**
* @copydoc plssvm::detail::gpu_csvm::run_q_kernel
*/
void run_q_kernel(std::size_t device, const ::plssvm::detail::execution_range &range, device_ptr_type &q_d, std::size_t num_features) final;
void run_q_kernel(std::size_t device, [[maybe_unused]] const ::plssvm::detail::execution_range &range, device_ptr_type &q_d, std::size_t num_features) final;
/**
* @copydoc plssvm::detail::gpu_csvm::run_svm_kernel
*/
void run_svm_kernel(std::size_t device, const ::plssvm::detail::execution_range &range, const device_ptr_type &q_d, device_ptr_type &r_d, const device_ptr_type &x_d, const real_type add, std::size_t num_features) final;
/**
* @copydoc plssvm::detail::gpu_csvm::run_w_kernel
*/
void run_w_kernel(std::size_t device, const ::plssvm::detail::execution_range &range, device_ptr_type &w_d, const device_ptr_type &alpha_d, std::size_t num_features) final;
void run_w_kernel(std::size_t device, [[maybe_unused]] const ::plssvm::detail::execution_range &range, device_ptr_type &w_d, const device_ptr_type &alpha_d, std::size_t num_features) final;
/**
* @copydoc plssvm::detail::gpu_csvm::run_predict_kernel
*/
Expand Down
Loading

0 comments on commit 08e81b1

Please sign in to comment.