Skip to content
Open
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
59 changes: 19 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)

option(HPL_VERBOSE_PRINT "Enable printing to terminal during run" OFF)
option(HPL_PROGRESS_REPORT "Enable printing progess report to terminal during run" OFF)
Expand Down Expand Up @@ -53,7 +53,7 @@ if(POLICY CMP0066)
endif()

# rocHPL project
project(rochpl LANGUAGES CXX)
project(rochpl LANGUAGES CXX HIP)

# Build flags
set(CMAKE_CXX_STANDARD 11)
Expand All @@ -79,47 +79,26 @@ list(REMOVE_ITEM rochpl_source ${rochpl_device_source})

# Flag source files as hip source files
foreach(i ${rochpl_device_source})
set_source_files_properties(${i} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT TRUE)
set_source_files_properties(${i} PROPERTIES LANGUAGE HIP)
endforeach()

# HIP flags workaround while target_compile_options does not work
list(APPEND HIP_HIPCC_FLAGS "-Wno-unused-command-line-argument -Wno-deprecated-declarations -fPIE -fopenmp")
list(APPEND CMAKE_HOST_FLAGS "-Wno-deprecated-declarations")
list(APPEND ROCHPL_COMPILE_FLAGS -Wno-deprecated-declarations)
list(APPEND ROCHPL_COMPILE_FLAGS $<$<COMPILE_LANGUAGE:HIP>:-Wno-unused-command-line-argument>)
list(APPEND ROCHPL_COMPILE_FLAGS $<$<COMPILE_LANGUAGE:HIP>:-fPIE>)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND HIP_HIPCC_FLAGS "-g -ggdb")
list(APPEND CMAKE_HOST_FLAGS "-O0;-g")
list(APPEND ROCHPL_COMPILE_FLAGS $<$<COMPILE_LANGUAGE:HIP>:-ggdb>)
else()
list(APPEND HIP_HIPCC_FLAGS "-O3 -march=native -ffp-contract=fast -ffast-math -funsafe-math-optimizations")
list(APPEND CMAKE_HOST_FLAGS "-O3;-march=native")
list(APPEND ROCHPL_COMPILE_FLAGS -march=native)
list(APPEND ROCHPL_COMPILE_FLAGS $<$<COMPILE_LANGUAGE:HIP>:-ffp-contract=fast>)
list(APPEND ROCHPL_COMPILE_FLAGS $<$<COMPILE_LANGUAGE:HIP>:-ffast-math>)
list(APPEND ROCHPL_COMPILE_FLAGS $<$<COMPILE_LANGUAGE:HIP>:-funsafe-math-optimizations>)
endif()

# GPU arch targets
set(TARGETS "gfx900;gfx906")
if(HIP_VERSION VERSION_GREATER_EQUAL "3.7")
set(TARGETS "${TARGETS};gfx908")
endif()
if(HIP_VERSION VERSION_GREATER_EQUAL "4.3")
set(TARGETS "${TARGETS};gfx90a")
endif()
if (HIP_VERSION VERSION_GREATER_EQUAL "5.7")
set(TARGETS "${TARGETS};gfx942")
endif()
if (HIP_VERSION VERSION_GREATER_EQUAL "6.5")
set(TARGETS "${TARGETS};gfx950;gfx1100")
endif()
if (HIP_VERSION VERSION_GREATER_EQUAL "7.0")
set(TARGETS "${TARGETS};gfx1201")
endif()

foreach(target ${TARGETS})
list(APPEND HIP_HIPCC_FLAGS "--offload-arch=${target}")
endforeach()

# Target executable
hip_add_executable(rochpl ${rochpl_source} ${rochpl_device_source})
add_executable(rochpl ${rochpl_source} ${rochpl_device_source})

target_compile_options(rochpl PRIVATE ${CMAKE_HOST_FLAGS})
target_compile_options(rochpl PRIVATE ${ROCHPL_COMPILE_FLAGS})

if(HPL_VERBOSE_PRINT)
target_compile_definitions(rochpl PRIVATE HPL_VERBOSE_PRINT)
Expand All @@ -141,10 +120,12 @@ endif()
target_include_directories(rochpl
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${HIP_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${HPL_MPI_DIR}/include>
$<BUILD_INTERFACE:${ROCM_PATH}/include/roctracer>)
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
if(HPL_TRACING)
target_include_directories(rochpl
PRIVATE
$<BUILD_INTERFACE:${ROCM_PATH}/include/roctracer>)
endif()

#HIP
target_link_libraries(rochpl PRIVATE hip::host)
Expand Down Expand Up @@ -176,8 +157,6 @@ if(MPI_GTL)
target_link_libraries(rochpl PRIVATE "${GTL_LIB}")
endif()

set_target_properties(rochpl PROPERTIES HIP_ARCHITECTURES "${DEFAULT_AMDGPU_TARGETS}")

# Configure a header file to pass the rocHPL version
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/hpl_version.hpp.in"
"${PROJECT_BINARY_DIR}/include/hpl_version.hpp")
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rocHPL is a benchmark based on the [HPL][] benchmark application, implemented on

## Requirements
* Git
* CMake (3.10 or later)
* CMake (3.21 or later)
* MPI (Optional)
* AMD [ROCm] platform (3.5 or later)
* [rocBLAS][]
Expand All @@ -27,6 +27,7 @@ cd rocHPL
# --with-rocm=<dir> - Path to ROCm install (Default: /opt/rocm)
# --with-rocblas=<dir> - Path to rocBLAS library (Default: /opt/rocm/rocblas)
# --with-mpi=<dir> - Path to external MPI install (Default: clone+build OpenMPI)
# --archs=<list> - Comma separated architectures list to build (Default: Cmake default (device architectures detected on the system))"
# --verbose-print - Verbose output during HPL setup (Default: true)
# --progress-report - Print progress report to terminal during HPL run (Default: true)
# --detailed-timing - Record detailed timers during HPL run (Default: true)
Expand Down
12 changes: 10 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function display_help()
echo " [--with-rocblas=<dir>] Path to rocBLAS library (Default: /opt/rocm/rocblas)"
echo " [--with-mpi=<dir>] Path to external MPI install (Default: clone+build OpenMPI)"
echo " [--with-mpi-gtl=<dir>] Path to external MPI-GTL install (Optional: defaults to no gtl support)"
echo " [--archs] Comma separated architecture list to build (Default: Cmake default (device architectures detected on the system))"
echo " [--verbose-print] Verbose output during HPL setup (Default: true)"
echo " [--progress-report] Print progress report to terminal during HPL run (Default: true)"
echo " [--detailed-timing] Record detailed timers during HPL run (Default: true)"
Expand Down Expand Up @@ -219,6 +220,7 @@ build_release=true
with_rocm=/opt/rocm
with_mpi=tpl/openmpi
with_mpi_gtl=none
archs=default
with_rocblas=/opt/rocm/rocblas
verbose_print=true
progress_report=true
Expand All @@ -232,7 +234,7 @@ enable_tracing=false
# check if we have a modern version of getopt that can handle whitespace and long parameters
getopt -T
if [[ $? -eq 4 ]]; then
GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,debug,prefix:,with-rocm:,with-mpi:,with-mpi-gtl:,with-rocblas:,verbose-print:,progress-report:,detailed-timing:,enable-tracing: --options hg -- "$@")
GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,debug,prefix:,with-rocm:,with-mpi:,with-mpi-gtl:,with-rocblas:,archs:,verbose-print:,progress-report:,detailed-timing:,enable-tracing: --options hg -- "$@")
else
echo "Need a new version of getopt"
exit_with_error 1
Expand Down Expand Up @@ -269,6 +271,9 @@ while true; do
--with-rocblas)
with_rocblas=${2}
shift 2 ;;
--archs)
archs=${2}
shift 2 ;;
--verbose-print)
verbose_print=${2}
shift 2 ;;
Expand Down Expand Up @@ -325,7 +330,6 @@ pushd .
if [[ "${with_mpi_gtl}" != none ]]; then
cmake_common_options="${cmake_common_options} -DMPI_GTL=${with_mpi_gtl}"
fi


# build type
if [[ "${build_release}" == true ]]; then
Expand All @@ -334,6 +338,10 @@ pushd .
cmake_common_options="${cmake_common_options} -DCMAKE_BUILD_TYPE=Debug"
fi

if [[ "${archs}" != default ]]; then
cmake_common_options="${cmake_common_options} -DCMAKE_HIP_ARCHITECTURES=${archs}"
fi

shopt -s nocasematch
if [[ "${verbose_print}" == on || "${verbose_print}" == true || "${verbose_print}" == 1 || "${verbose_print}" == enabled ]]; then
cmake_common_options="${cmake_common_options} -DHPL_VERBOSE_PRINT=ON"
Expand Down