Skip to content

Commit

Permalink
Merge pull request #44 from ROCmSoftwarePlatform/develop
Browse files Browse the repository at this point in the history
develop to master
  • Loading branch information
ex-rzr committed Feb 6, 2019
2 parents 02d6006 + bf19e05 commit 41ff492
Show file tree
Hide file tree
Showing 70 changed files with 1,453 additions and 1,026 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

### Build dirs ###
build/

Expand Down Expand Up @@ -56,4 +55,7 @@ compile_commands.json
CTestTestfile.cmake
build

### Gtilab CI ###
.gitlab-ci-gputest.yml

# End of https://www.gitignore.io/api/c++,cmake
14 changes: 14 additions & 0 deletions .gitlab-ci-gputest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
test:rocm241:
extends: .unittest
tags:
- tag241

test:rocm243:
extends: .unittest
tags:
- tag243

test:rocm244:
extends: .unittest
tags:
- tag244
22 changes: 8 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ before_script:

build:rocm:
stage: build
tags:
- rocm
variables:
SUDO_CMD: "sudo -E"
script:
Expand All @@ -71,9 +73,7 @@ build:rocm:
- build/rocprim*.zip
expire_in: 2 weeks

test:rocm243:
tags:
- tag243
.unittest:
stage: test
variables:
SUDO_CMD: "sudo -E"
Expand All @@ -83,20 +83,12 @@ test:rocm243:
- cd build
- $SUDO_CMD ctest --output-on-failure --repeat-until-fail 2

test:rocm244:
tags:
- tag244
stage: test
variables:
SUDO_CMD: "sudo -E"
dependencies:
- build:rocm
script:
- cd build
- $SUDO_CMD ctest --output-on-failure --repeat-until-fail 2
include: '.gitlab-ci-gputest.yml'

test:rocm_package:
stage: test
tags:
- rocm
variables:
SUDO_CMD: "sudo -E"
dependencies:
Expand All @@ -112,6 +104,8 @@ test:rocm_package:

test:rocm_install:
stage: test
tags:
- rocm
variables:
SUDO_CMD: "sudo -E"
script:
Expand Down
21 changes: 14 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "Install path prefix, prepended onto install directories")

# rocPRIM project
project(rocprim VERSION 1.0.1.0 LANGUAGES CXX)
project(rocprim VERSION 1.0.2.0 LANGUAGES CXX)

# CMake modules
list(APPEND CMAKE_MODULE_PATH
Expand All @@ -46,11 +46,18 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOLEAN "Add paths to linker se
# Verify that hcc compiler is used on ROCM platform
include(cmake/VerifyCompiler.cmake)

# Build option to disable -Werror
option(DISABLE_WERROR "Disable building with Werror" ON)

# Set CXX flags
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
if(DISABLE_WERROR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
endif()

# Build options
option(BUILD_TEST "Build tests (requires googletest)" ON)
Expand All @@ -62,13 +69,13 @@ option(ONLY_INSTALL "Only install" OFF)
# Get dependencies
include(cmake/Dependencies.cmake)

# AMD targets
set(AMDGPU_TARGETS gfx803;gfx900;gfx906 CACHE STRING "List of specific machine types for library to target")

# Print configuration summary
include(cmake/Summary.cmake)
print_configuration_summary()

# AMD targets
set(AMDGPU_TARGETS gfx803;gfx900;gfx906 CACHE STRING "List of specific machine types for library to target")

# rocPRIM works only on hcc
if(HIP_PLATFORM STREQUAL "hcc")
# rocPRIM library
Expand Down Expand Up @@ -117,13 +124,13 @@ set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "\${CPACK_PACKAGING_INSTALL_PR
if(HIP_PLATFORM STREQUAL "hcc")
rocm_create_package(
NAME rocprim
DESCRIPTION "Radeon Open Compute Parallel Primitives Libary"
DESCRIPTION "Radeon Open Compute Parallel Primitives Library"
MAINTAINER "Stream HPC Maintainers <[email protected]>"
)
else()
rocm_create_package(
NAME rocprim-hipcub
DESCRIPTION "Radeon Open Compute Parallel Primitives Libary (hipCUB only)"
DESCRIPTION "Radeon Open Compute Parallel Primitives Library (hipCUB only)"
MAINTAINER "Stream HPC Maintainers <[email protected]>"
)
endif()
2 changes: 1 addition & 1 deletion benchmark/benchmark_hc_block_histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "benchmark_utils.hpp"

// rocPRIM
#include <rocprim/block/block_histogram.hpp>
#include <rocprim/rocprim.hpp>

#ifndef DEFAULT_N
const size_t DEFAULT_N = 1024 * 1024 * 128;
Expand Down
2 changes: 2 additions & 0 deletions benchmark/benchmark_hc_block_radix_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
#include <chrono>
#include <vector>
#include <limits>
#include <codecvt>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <locale>

// Google Benchmark
#include "benchmark/benchmark.h"
Expand Down
14 changes: 1 addition & 13 deletions benchmark/benchmark_hc_block_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,17 @@
#include <string>
#include <cstdio>
#include <cstdlib>
#include <locale>

// Google Benchmark
#include "benchmark/benchmark.h"
// CmdParser
#include "cmdparser.hpp"
#include "benchmark_utils.hpp"

// HIP API
#include <hip/hip_runtime.h>
#include <hip/hip_hcc.h>

// rocPRIM
#include <rocprim/rocprim.hpp>

#define HIP_CHECK(condition) \
{ \
hipError_t error = condition; \
if(error != hipSuccess){ \
std::cout << "HIP error: " << error << " line: " << __LINE__ << std::endl; \
exit(error); \
} \
}

#ifndef DEFAULT_N
const size_t DEFAULT_N = 1024 * 1024 * 128;
#endif
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_hc_device_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// HC API
#include <hcc/hc.hpp>

// rocPRIM HIP API
// rocPRIM
#include <rocprim/rocprim.hpp>

// CmdParser
Expand Down
11 changes: 1 addition & 10 deletions benchmark/benchmark_hc_warp_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,10 @@
// HC API
#include <hcc/hc.hpp>
// rocPRIM
#include <rocprim/warp/warp_scan.hpp>
#include <rocprim/rocprim.hpp>

#include "benchmark_utils.hpp"

#define HIP_CHECK(condition) \
{ \
hipError_t error = condition; \
if(error != hipSuccess){ \
std::cout << "HIP error: " << error << " line: " << __LINE__ << std::endl; \
exit(error); \
} \
}

#ifndef DEFAULT_N
const size_t DEFAULT_N = 1024 * 1024 * 32;
#endif
Expand Down
11 changes: 1 addition & 10 deletions benchmark/benchmark_hc_warp_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,10 @@
// HC API
#include <hcc/hc.hpp>
// rocPRIM
#include <rocprim/warp/warp_sort.hpp>
#include <rocprim/rocprim.hpp>

#include "benchmark_utils.hpp"

#define HIP_CHECK(condition) \
{ \
hipError_t error = condition; \
if(error != hipSuccess){ \
std::cout << "HIP error: " << error << " line: " << __LINE__ << std::endl; \
exit(error); \
} \
}

#ifndef DEFAULT_N
const size_t DEFAULT_N = 1024 * 1024 * 32;
#endif
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_hip_block_histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <hip/hip_hcc.h>

// rocPRIM
#include <rocprim/block/block_histogram.hpp>
#include <rocprim/rocprim.hpp>

#define HIP_CHECK(condition) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_hip_block_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <hip/hip_hcc.h>

// rocPRIM
#include <rocprim/block/block_reduce.hpp>
#include <rocprim/rocprim.hpp>

#define HIP_CHECK(condition) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_hip_device_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <hip/hip_runtime.h>

// rocPRIM HIP API
#include <rocprim/device/device_reduce_hip.hpp>
#include <rocprim/rocprim.hpp>

// CmdParser
#include "cmdparser.hpp"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_hip_device_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <hip/hip_runtime.h>
#include <hip/hip_hcc.h>
// rocPRIM
#include <rocprim/device/device_scan_hip.hpp>
#include <rocprim/rocprim.hpp>

#include "benchmark_utils.hpp"

Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_hip_warp_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <hip/hip_runtime.h>
#include <hip/hip_hcc.h>
// rocPRIM
#include <rocprim/warp/warp_scan.hpp>
#include <rocprim/rocprim.hpp>

#include "benchmark_utils.hpp"

Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_hip_warp_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <hip/hip_runtime.h>
#include <hip/hip_hcc.h>
// rocPRIM
#include <rocprim/warp/warp_sort.hpp>
#include <rocprim/rocprim.hpp>

#include "benchmark_utils.hpp"

Expand Down
2 changes: 1 addition & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if(BUILD_TEST)
download_project(
PROJ googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
GIT_TAG release-1.8.1
INSTALL_DIR ${GTEST_ROOT}
CMAKE_ARGS -DBUILD_GTEST=ON -DINSTALL_GTEST=ON -Dgtest_force_shared_crt=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
LOG_DOWNLOAD TRUE
Expand Down
3 changes: 2 additions & 1 deletion cmake/SetupNVCC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,5 @@ string(REPLACE " " ";" HIP_CPP_CONFIG_FLAGS ${HIP_CPP_CONFIG_FLAGS})
list(APPEND CUDA_NVCC_FLAGS "-std=c++11 ${HIP_CPP_CONFIG_FLAGS} ${HIP_NVCC_FLAGS}")

# Ignore warnings about #pragma unroll
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
# and about deprecated CUDA function(s) used in hip/nvcc_detail/hip_runtime_api.h
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas -Wno-deprecated-declarations")
1 change: 1 addition & 0 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function(print_configuration_summary)
message(STATUS " CXX flags : ${CMAKE_CXX_FLAGS_STRIP}")
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS " Install prefix : ${CMAKE_INSTALL_PREFIX}")
message(STATUS " Device targets : ${AMDGPU_TARGETS}")
message(STATUS "")
message(STATUS " BUILD_TEST : ${BUILD_TEST}")
message(STATUS " BUILD_BENCHMARK : ${BUILD_BENCHMARK}")
Expand Down
4 changes: 2 additions & 2 deletions hipcub/include/hipcub/config.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2017 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
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
Expand All @@ -10,7 +10,7 @@
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED >AS IS>, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Expand Down
8 changes: 4 additions & 4 deletions hipcub/include/hipcub/rocprim/block/block_scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ class BlockScan
HIPCUB_DEVICE inline
void ExclusiveSum(T input, T& output)
{
base_type::exclusive_scan(input, output, temp_storage_);
base_type::exclusive_scan(input, output, T(0), temp_storage_);
}

HIPCUB_DEVICE inline
void ExclusiveSum(T input, T& output, T& block_aggregate)
{
base_type::exclusive_scan(input, output, block_aggregate, temp_storage_);
base_type::exclusive_scan(input, output, T(0), block_aggregate, temp_storage_);
}

template<typename BlockPrefixCallbackOp>
Expand All @@ -212,15 +212,15 @@ class BlockScan
HIPCUB_DEVICE inline
void ExclusiveSum(T(&input)[ITEMS_PER_THREAD], T(&output)[ITEMS_PER_THREAD])
{
base_type::exclusive_scan(input, output, temp_storage_);
base_type::exclusive_scan(input, output, T(0), temp_storage_);
}

template<int ITEMS_PER_THREAD>
HIPCUB_DEVICE inline
void ExclusiveSum(T(&input)[ITEMS_PER_THREAD], T(&output)[ITEMS_PER_THREAD],
T& block_aggregate)
{
base_type::exclusive_scan(input, output, block_aggregate, temp_storage_);
base_type::exclusive_scan(input, output, T(0), block_aggregate, temp_storage_);
}

template<int ITEMS_PER_THREAD, typename BlockPrefixCallbackOp>
Expand Down
Loading

0 comments on commit 41ff492

Please sign in to comment.