diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b08796f..08ff59a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,15 @@ Documentation for rocRAND is available at ### Changed +* Removed a section in `cmake/Dependencies.cmake` that was forcing `DCMAKE_CXX_COMPILER` to be set to either `cl` or `g++` if the compiler was not `GNU`. * `--test|-t` is no longer a required flag for `rtest.py`. Instead, the user can use either `--emulation|-e` or `--test|-t`, but not both. * Removed TBB dependency for multi-core processing of host-side generation. +## Resolved issues + +* Fixed an issue where `CMAKE_PREFIX_PATH` was not defined properly in `CMAKELists.txt` and `toolchain-linux.cmake`. +* Fixed an issue in `rmake.py` where `cmake_platform_opts` was sometimes a string instead of a list. + ## rocRAND 3.2.0 for ROCm 6.3.0 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index ef8102fd..ff8bab44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ # SOFTWARE. cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +cmake_policy(VERSION 3.16...3.25) # Build options include(CMakeDependentOption) @@ -29,22 +30,48 @@ option(BUILD_FORTRAN_WRAPPER "Build Fortran wrapper" OFF) option(BUILD_TEST "Build tests (requires googletest)" OFF) option(BUILD_BENCHMARK "Build benchmarks" OFF) cmake_dependent_option(BUILD_BENCHMARK_TUNING - "Build extra benchmarks for kernel configuration tuning" OFF "BUILD_BENCHMARK" OFF) +"Build extra benchmarks for kernel configuration tuning" OFF "BUILD_BENCHMARK" OFF) option(BUILD_ADDRESS_SANITIZER "Build with address sanitizer enabled" OFF) option(CODE_COVERAGE "Build with code coverage flags (clang only)" OFF) option(DEPENDENCIES_FORCE_DOWNLOAD "Don't search the system for dependencies, always download them" OFF) cmake_dependent_option(RUN_SLOW_TESTS "Run extra tests with CTest. These cover niche functionality and take long time" OFF "BUILD_TEST" OFF) + +if (NOT DEFINED ENV{ROCM_PATH}) +#Path to ROCm installation + set(ENV{ROCM_PATH} "/opt/rocm") +endif() + # Install prefix -set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "Install path prefix, prepended onto install directories") +set(CMAKE_INSTALL_PREFIX "$ENV{ROCM_PATH}" CACHE PATH "Install path prefix, prepended onto install directories") + +if(WIN32) + set(CPACK_SOURCE_GENERATOR "ZIP") + set(CPACK_GENERATOR "ZIP") + set(CMAKE_INSTALL_PREFIX "C:/hipSDK" CACHE PATH "Install path") + set(INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + set(CPACK_SET_DESTDIR OFF) + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_INSTALL_PREFIX}") + set(CPACK_PACKAGING_INSTALL_PREFIX "") + set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) +else() + set(CMAKE_INSTALL_PREFIX "$ENV{ROCM_PATH}" CACHE PATH "Install path prefix, prepended onto install directories") + #Adding CMAKE_PREFIX_PATH + if(NOT DEFINED CMAKE_PREFIX_PATH) + list( APPEND CMAKE_PREFIX_PATH $ENV{ROCM_PATH}/llvm $ENV{ROCM_PATH}) + endif() + if(NOT CPACK_PACKAGING_INSTALL_PREFIX) + set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + endif() +endif() # CMake modules list(APPEND CMAKE_MODULE_PATH - ${CMAKE_CURRENT_SOURCE_DIR}/cmake - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules - $ENV{ROCM_PATH}/lib/cmake/hip - ${HIP_PATH}/cmake $ENV{ROCM_PATH}/hip/cmake # FindHIP.cmake - $ENV{ROCM_PATH}/llvm +${CMAKE_CURRENT_SOURCE_DIR}/cmake +${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules +$ENV{ROCM_PATH}/lib/cmake/hip +${HIP_PATH}/cmake $ENV{ROCM_PATH}/hip/cmake # FindHIP.cmake +$ENV{ROCM_PATH}/llvm ) # @@ -192,23 +219,6 @@ endif() # Package (make package) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") set(CPACK_RPM_PACKAGE_LICENSE "MIT") -if(WIN32) - set(CPACK_SOURCE_GENERATOR "ZIP") - set(CPACK_GENERATOR "ZIP") - set(CMAKE_INSTALL_PREFIX "C:/hipSDK" CACHE PATH "Install path") - set(INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - set(CPACK_SET_DESTDIR OFF) - set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_INSTALL_PREFIX}") - set(CPACK_PACKAGING_INSTALL_PREFIX "") - set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) -else() - set(CMAKE_INSTALL_PREFIX "$ENV{ROCM_PATH}" CACHE PATH "Install path prefix, prepended onto install directories") - #Adding CMAKE_PREFIX_PATH - list( APPEND CMAKE_PREFIX_PATH $ENV{ROCM_PATH}/llvm $ENV{ROCM_PATH} ) - if(NOT CPACK_PACKAGING_INSTALL_PREFIX) - set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - endif() -endif() if( HIP_RUNTIME_LOWER STREQUAL "rocclr" ) if(BUILD_ADDRESS_SANITIZER) diff --git a/benchmark/custom_csv_formater.hpp b/benchmark/custom_csv_formater.hpp index 75d05fa6..20451202 100644 --- a/benchmark/custom_csv_formater.hpp +++ b/benchmark/custom_csv_formater.hpp @@ -152,20 +152,13 @@ inline void customCSVReporter::ReportRuns(const std::vector& reports) inline void customCSVReporter::PrintRunData(const Run& run) { std::ostream& Out = GetOutputStream(); - std::ostream& Err = GetErrorStream(); //get the name of the engine and distribution: - std::string temp = run.benchmark_name(); - std::string deviceName = std::string(temp.begin(), temp.begin() + temp.find("<")); - temp.erase(0, temp.find("<") + 1); - std::string engineName = std::string(temp.begin(), temp.begin() + temp.find(",")); - temp.erase(0, engineName.size() + 1); - std::string mode = "default"; if(deviceName != "device_kernel") @@ -174,7 +167,6 @@ inline void customCSVReporter::PrintRunData(const Run& run) temp.erase(0, temp.find(",") + 1); } std::string disName = std::string(temp.begin(), temp.begin() + temp.find(">")); - std::string lambda = ""; size_t ePos = disName.find("="); @@ -186,13 +178,6 @@ inline void customCSVReporter::PrintRunData(const Run& run) Out << engineName << "," << disName << "," << mode << ","; Out << CsvEscape(run.benchmark_name()) << ","; - if(run.error_occurred) - { - Err << std::string(elements.size() - 3, ','); - Err << "true,"; - Err << CsvEscape(run.error_message) << "\n"; - return; - } // Do not print iteration on bigO and RMS report if(!run.report_big_o && !run.report_rms) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 09b7286a..36c60444 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -80,7 +80,6 @@ if(BUILD_TEST) endif() endif() - # Benchmark dependencies if(BUILD_BENCHMARK) if(NOT DEPENDENCIES_FORCE_DOWNLOAD) @@ -94,19 +93,12 @@ if(BUILD_BENCHMARK) message(FATAL_ERROR "DownloadProject.cmake doesn't support multi-configuration generators.") endif() set(GOOGLEBENCHMARK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/deps/googlebenchmark CACHE PATH "") - if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) - # hip-clang cannot compile googlebenchmark for some reason - if(WIN32) - set(COMPILER_OVERRIDE "-DCMAKE_CXX_COMPILER=cl") - else() - set(COMPILER_OVERRIDE "-DCMAKE_CXX_COMPILER=g++") - endif() - endif() - + option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." OFF) + option(BENCHMARK_ENABLE_INSTALL "Enable installation of benchmark." OFF) download_project( PROJ googlebenchmark GIT_REPOSITORY https://github.com/google/benchmark.git - GIT_TAG v1.6.1 + GIT_TAG v1.8.0 INSTALL_DIR ${GOOGLEBENCHMARK_ROOT} CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX= -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE} LOG_DOWNLOAD TRUE @@ -116,6 +108,8 @@ if(BUILD_BENCHMARK) BUILD_PROJECT TRUE UPDATE_DISCONNECTED TRUE ) + set(HAVE_STD_REGEX ON) + set(RUN_HAVE_STD_REGEX 1) endif() find_package(benchmark REQUIRED CONFIG PATHS ${GOOGLEBENCHMARK_ROOT} NO_DEFAULT_PATH) endif() diff --git a/rmake.py b/rmake.py index 99d74ec3..90887d29 100644 --- a/rmake.py +++ b/rmake.py @@ -10,6 +10,7 @@ import ctypes import pathlib from fnmatch import fnmatchcase +import shutil args = {} param = {} @@ -109,10 +110,11 @@ def config_cmd(): cmake_options.append( generator ) else: rocm_path = os.getenv( 'ROCM_PATH', "/opt/rocm") - if (OS_info["ID"] in ['centos', 'rhel']): - cmake_executable = "cmake3" - else: - cmake_executable = "cmake" + + cmake_executable = 'cmake' + if shutil.which('cmake3') is not None: + cmake_executable = 'cmake3' + toolchain = "toolchain-linux.cmake" cmake_platform_opts = [f"-DROCM_DIR:PATH={rocm_path}", f"-DCPACK_PACKAGING_INSTALL_PREFIX={rocm_path}"] diff --git a/toolchain-linux.cmake b/toolchain-linux.cmake index 4f06a391..ce435596 100644 --- a/toolchain-linux.cmake +++ b/toolchain-linux.cmake @@ -2,12 +2,18 @@ #set(CMAKE_GENERATOR "Ninja") # Ninja doesn't support platform #set(CMAKE_GENERATOR_PLATFORM x64) +if (NOT python) + set(python "python3") # default for linux +endif() -if (DEFINED ENV{ROCM_PATH}) - set(rocm_bin "$ENV{ROCM_PATH}/bin") -else() - set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to the ROCm installation.") - set(rocm_bin "/opt/rocm/bin") + +if (NOT DEFINED ENV{ROCM_PATH}) + set(ENV{ROCM_PATH} "/opt/rocm" CACHE PATH "Path to the ROCm installation.") +endif() + +set(rocm_bin "$ENV{ROCM_PATH}/bin") +if (NOT DEFINED CMAKE_PREFIX_PATH) + list( APPEND CMAKE_PREFIX_PATH $ENV{ROCM_PATH}/llvm $ENV{ROCM_PATH}) endif() if (NOT DEFINED ENV{CXX})