Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
saadrahim committed Mar 4, 2020
2 parents 0e85414 + 87e7c25 commit 6042e8a
Show file tree
Hide file tree
Showing 54 changed files with 8,989 additions and 8,087 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci-gputest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ test:s9300:
tags:
- s9300
- rocm
allow_failure: true

test:mi25:
extends: .test
Expand Down
84 changes: 84 additions & 0 deletions .jenkins/common.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// This file is for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.

def runCompileCommand(platform, project, jobName)
{
project.paths.construct_build_prefix()

def command

if(jobName.contains('hipclang'))
{
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 ${project.paths.build_command} --hip-clang
"""
}
else
{
command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}
LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hcc ${project.paths.build_command}
"""
}

platform.runCommand(this, command)
}

def runTestCommand (platform, project)
{
String sudo = auxiliary.sudo(platform.jenkinsLabel)
def testCommand = 'ctest --output-on-failure'

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

platform.runCommand(this, command)
}

def runPackageCommand(platform, project, jobName)
{
def command

if(platform.jenkinsLabel.contains('centos'))
{
command = """
set -x
cd ${project.paths.project_build_prefix}/${project.testDirectory}
make package
rm -rf package && mkdir -p package
mv *.rpm package/
rpm -qlp package/*.rpm
"""

platform.runCommand(this, command)
platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/${project.testDirectory}/package/*.rpm""")
}
else if(jobName.contains('hipclang'))
{
packageCommand = null
}
else
{
command = """
set -x
cd ${project.paths.project_build_prefix}/${project.testDirectory}
make package
rm -rf package && mkdir -p package
mv *.deb package/
dpkg -c package/*.deb
"""

platform.runCommand(this, command)
platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/${project.testDirectory}/package/*.deb""")
}
}

return this

81 changes: 81 additions & 0 deletions .jenkins/precheckin.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env groovy
@Library('rocJenkins@pong') _
import com.amd.project.*
import com.amd.docker.*
import java.nio.file.Path;

def runCI =
{
nodeDetails, jobName->

def prj = new rocProject('rocPRIM', 'PreCheckin')

def nodes = new dockerNodes(nodeDetails, jobName, prj)

def commonGroovy

boolean formatCheck = false

def compileCommand =
{
platform, project->

commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName)
}

def testCommand =
{
platform, project->

commonGroovy.runTestCommand(platform, project)
}

def packageCommand =
{
platform, project->

commonGroovy.runPackageCommand(platform, project, jobName)
}

buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
}

ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)

def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 0')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)

def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu16:['gfx900'],centos7:['gfx906'],sles15sp1:['gfx908']]),
"compute-rocm-dkms-no-npi-hipclang":([ubuntu16:['gfx900'],centos7:['gfx906'],sles15sp1:['gfx908']]),
"rocm-docker":([ubuntu16:['gfx900'],centos7:['gfx906'],sles15sp1:['gfx908']])]
jobNameList = auxiliary.appendJobNameList(jobNameList)

propertyList.each
{
jobName, property->
if (urlJobName == jobName)
properties(auxiliary.addCommonProperties(property))
}

jobNameList.each
{
jobName, nodeDetails->
if (urlJobName == jobName)
stage(jobName) {
runCI(nodeDetails, jobName)
}
}

// For url job names that are not listed by the jobNameList i.e. compute-rocm-dkms-no-npi-1901
if(!jobNameList.keySet().contains(urlJobName))
{
properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
stage(urlJobName) {
runCI([ubuntu16:['gfx906']], urlJobName)
}
}
}
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -73,7 +73,7 @@ include(cmake/Dependencies.cmake)
set(AMDGPU_TARGETS gfx803;gfx900;gfx906;gfx908 CACHE STRING "List of specific machine types for library to target")

# Setup VERSION
set(VERSION_STRING "2.8.0")
set(VERSION_STRING "2.10.0")
rocm_setup_version(VERSION ${VERSION_STRING})

# Print configuration summary
Expand Down Expand Up @@ -101,8 +101,8 @@ endif()

# Package

set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip_hcc (>= 1.5.18263)") # 1.5.18263 is HIP version in ROCm 1.8.2
set(CPACK_RPM_PACKAGE_REQUIRES "hip_hcc >= 1.5.18263")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-dev (>= 2.5.27)")
set(CPACK_RPM_PACKAGE_REQUIRES "rocm-dev >= 2.5.27")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
if(NOT CPACK_PACKAGING_INSTALL_PREFIX)
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
Expand All @@ -113,5 +113,5 @@ set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "\${CPACK_PACKAGING_INSTALL_PR
rocm_create_package(
NAME rocprim
DESCRIPTION "Radeon Open Compute Parallel Primitives Library"
MAINTAINER "Saad Rahim <saad.rahim@amd.com>"
MAINTAINER "rocPRIM Maintainer <rocprim-maintainer@amd.com>"
)
118 changes: 0 additions & 118 deletions Jenkinsfile

This file was deleted.

39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ performant GPU-accelerated code on AMD ROCm platform.
* Git
* CMake (3.5.1 or later)
* AMD [ROCm](https://rocm.github.io/install.html) platform (1.8.2 or later)
* Including [HCC](https://github.com/RadeonOpenCompute/hcc) compiler, which must be
set as C++ compiler on ROCm platform.
* Including [HCC](https://github.com/RadeonOpenCompute/hcc) compiler
* Alternatively [HIP-clang](https://github.com/ROCm-Developer-Tools/HIP/blob/master/INSTALL.md#hip-clang) compiler

Optional:

Expand All @@ -32,12 +32,17 @@ cd rocPRIM; mkdir build; cd build
# Build options:
# BUILD_TEST - on by default,
# BUILD_BENCHMARK - off by default.
# AMDGPU_TARGETS - list of AMD architectures, default: gfx803;gfx900;gfx906.
# You can make compilation faster if you want to test/benchmark only on one architecture,
# for example, add -DAMDGPU_TARGETS=gfx906 to 'cmake' parameters.
#
# ! IMPORTANT !
# On ROCm platform set C++ compiler to HCC. You can do it by adding 'CXX=<path-to-hcc>'
# before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the HCC compiler.
#
# Set C++ compiler to HCC or HIP-clang. You can do it by adding 'CXX=<path-to-compiler>'
# before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the compiler.
# Using HCC:
[CXX=hcc] cmake -DBUILD_BENCHMARK=ON ../. # or cmake-gui ../.
# or using HIP-clang:
[CXX=hipcc] cmake -DBUILD_BENCHMARK=ON ../.

# Build
make -j4
Expand Down Expand Up @@ -87,6 +92,30 @@ ctest
./test/rocprim/<unit-test-name>
```

## Using custom seeds for the tests

Go to the `rocPRIM/test/rocprim/test_seed.hpp` file.
```cpp
//(1)
static constexpr int random_seeds_count = 10;

//(2)
static constexpr unsigned int seeds [] = {0, 2, 10, 1000};

//(3)
static constexpr size_t seed_size = sizeof(seeds) / sizeof(seeds[0]);
```
(1) defines a constant that sets how many passes over the tests will be done with runtime-generated seeds. Modify at will.
(2) defines the user generated seeds. Each of the elements of the array will be used as seed for all tests. Modify at will. If no static seeds are desired, the array should be left empty.
```cpp
static constexpr unsigned int seeds [] = {};
```

(3) this line should never be modified.

## Running Benchmarks

```shell
Expand Down
Loading

0 comments on commit 6042e8a

Please sign in to comment.