Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion projects/hipfft/.jenkins/staticanalysis.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def runCI =
{
nodeDetails, jobName ->

def prj = new rocProject('hipFFT-internal', 'PreCheckin')
def prj = new rocProject('hipFFT', 'PreCheckin')
// customize for project
prj.libraryDependencies = ['rocRAND','rocFFT']

Expand Down
57 changes: 40 additions & 17 deletions projects/hipfft/clients/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ else( )
"Install path prefix, prepended onto install directories" )
endif( )

# Dependencies

find_package( ROCmCMakeBuildTools REQUIRED CONFIG PATHS /opt/rocm )
include(ROCMInstallTargets)
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake )


# This has to be initialized before the project() command appears
# Set the default of CMAKE_BUILD_TYPE to be release, unless user
# specifies with -D. MSVC_IDE does not use CMAKE_BUILD_TYPE
Expand All @@ -42,13 +49,19 @@ endif()

project( hipfft-clients-tests LANGUAGES CXX )

if( NOT HIPFFT_BUILD_SCOPE )
find_package( hipfft REQUIRED CONFIG PATHS )
endif()

find_package( Boost REQUIRED)

set( Boost_USE_STATIC_LIBS OFF )


find_package( FFTW 3.0 REQUIRED MODULE COMPONENTS FLOAT DOUBLE )

set( BUILD_WITH_LIB "ROCM" CACHE STRING "Build ${PROJECT_NAME} with ROCM or CUDA libraries" )

set( THREADS_PREFER_PTHREAD_FLAG ON )
find_package( Threads REQUIRED )

Expand Down Expand Up @@ -84,7 +97,7 @@ if( NOT BUILD_WITH_LIB STREQUAL "CUDA" )
if( WIN32 )
find_package( HIP CONFIG REQUIRED )
else()
find_package( HIP MODULE REQUIRED )
find_package( hip REQUIRED CONFIG PATHS /opt/rocm/lib/cmake/hip/ )
endif()
endif()

Expand All @@ -98,6 +111,14 @@ endif()
string( CONCAT TESTS_OUT_DIR "${PROJECT_BINARY_DIR}" ${TESTS_OUT_DIR} )

option( BUILD_CLIENTS_TESTS_OPENMP "Build tests with OpenMP" ON )
if( BUILD_CLIENTS_TESTS_OPENMP AND NOT BUILD_WITH_LIB STREQUAL "CUDA" )
# Attempt to find a config version, which provides openmp_LIB_DIR.
find_package( OpenMP CONFIG PATHS "${HIP_CLANG_ROOT}/lib/cmake" )
if( NOT OPENMP_FOUND OR NOT DEFINED ${openmp_LIB_DIR} )
# Fall-back to module mode.
find_package( OpenMP REQUIRED )
Comment thread
regan-amd marked this conversation as resolved.
endif()
endif()

foreach( target ${TEST_TARGETS} )
set_target_properties( ${target} PROPERTIES
Expand Down Expand Up @@ -140,34 +161,34 @@ foreach( target ${TEST_TARGETS} )
target_compile_definitions( ${target} PUBLIC _CUFFT_BACKEND )
endif()

if( BUILD_CLIENTS_TESTS_OPENMP )
find_package(OpenMP REQUIRED)
if( BUILD_WITH_LIB STREQUAL "CUDA" )
message( STATUS "OpenMP is not supported on CUDA, building tests without it" )
else()
target_compile_options( ${target} PRIVATE -DBUILD_CLIENTS_TESTS_OPENMP )
if(NOT (CMAKE_CXX_COMPILER MATCHES ".*hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+"))
target_link_libraries( ${target} PRIVATE OpenMP::OpenMP_CXX )
target_include_directories( ${target} PRIVATE ${HIP_CLANG_ROOT}/include )
else()
target_link_libraries( ${target} PRIVATE OpenMP::OpenMP_CXX )
endif()
endif()
endif()

target_include_directories( ${target}
PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${FFTW_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${hip_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../library/include>
if( HIPFFT_BUILD_SCOPE )
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../library/include>
endif()
)

target_link_libraries( ${target}
PRIVATE
hip::hipfft
${FFTW_LIBRARIES}
)

if( BUILD_CLIENTS_TESTS_OPENMP )
if( BUILD_WITH_LIB STREQUAL "CUDA" )
message( STATUS "OpenMP is not supported on CUDA, building tests without it" )
else()
if( DEFINED ${openmp_LIB_DIR} )
set_target_properties( ${target} PROPERTIES BUILD_RPATH "${HIP_CLANG_ROOT}/${openmp_LIB_DIR}" )
set_target_properties( ${target} PROPERTIES INSTALL_RPATH "${HIP_CLANG_ROOT}/${openmp_LIB_DIR}" )
Comment thread
regan-amd marked this conversation as resolved.
endif()
target_link_libraries( ${target} PRIVATE OpenMP::OpenMP_CXX )
endif()
endif()

if( HIPFFT_MPI_ENABLE )
target_link_libraries( ${target}
Expand All @@ -184,6 +205,8 @@ foreach( target ${TEST_TARGETS} )
rocm_install(TARGETS ${target} COMPONENT tests)
endforeach()

find_package( GTest 1.11.0 )

if( GTEST_FOUND )
target_include_directories( hipfft-test PRIVATE $<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}> )
target_link_libraries( hipfft-test PRIVATE ${GTEST_LIBRARIES} )
Expand Down Expand Up @@ -221,7 +244,7 @@ if (WIN32)
endif()

option(BUILD_CODE_COVERAGE "Build with code coverage flags (clang only)" OFF)
set(COVERAGE_TEST_OPTIONS "--smoketest" CACHE STRING "Command line arguments for hipfft-test when generating a code coverage report (Note: an additional run of hipfft-test targeting multi_gpu* and callback* tests is always executed and coverage results are aggregated)")
set(COVERAGE_TEST_OPTIONS "--smoketest;--gtest_filter=-*call*" CACHE STRING "Command line arguments for hipfft-test when generating a code coverage report (Note: an additional run of hipfft-test targeting multi_gpu* and callback* tests is always executed and coverage results are aggregated)")
if (BUILD_CODE_COVERAGE)
add_custom_target(
code_cov_tests
Expand Down
10 changes: 8 additions & 2 deletions projects/hipfft/shared/fft_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,10 @@ class fft_params
}
}

assert(selected_grid[0] * selected_grid[1] * selected_grid[2] == mp_ranks);
if(selected_grid[0] * selected_grid[1] * selected_grid[2] != mp_ranks)
{
throw std::runtime_error("Grid dimensions do not multiply to mp_ranks.");
}

fft_grid = {selected_grid[0], selected_grid[1], selected_grid[2]};
}
Expand Down Expand Up @@ -660,7 +663,10 @@ class fft_params
}
}

assert(selected_grid[0] * selected_grid[1] == mp_ranks);
if(selected_grid[0] * selected_grid[1] == mp_ranks)
{
throw std::runtime_error("Grid dimensions do not multiply to mp_ranks.");
}

fft_grid = {selected_grid[0], selected_grid[1]};
}
Expand Down
33 changes: 16 additions & 17 deletions projects/rocfft/clients/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,20 @@ set( rocfft-test_include_dirs
)

set( rocfft-test_link_libs
${FFTW_LIBRARIES} OpenMP::OpenMP_CXX
${FFTW_LIBRARIES}
)

option( BUILD_CLIENTS_TESTS_OPENMP "Build tests with OpenMP" ON )
if( BUILD_CLIENTS_TESTS_OPENMP )
# Attempt to find a config version, which provides openmp_LIB_DIR.
#find_package( OpenMP CONFIG PATHS "${HIP_CLANG_ROOT}/lib/cmake" )
if( NOT OPENMP_FOUND OR NOT DEFINED ${openmp_LIB_DIR} )
# Fall-back to module mode.
find_package( OpenMP REQUIRED )
endif()
list( APPEND rocfft-test_link_libs OpenMP::OpenMP_CXX )
endif()

include( ../cmake/build-gtest.cmake )

if( BUILD_GTEST OR NOT GTEST_FOUND )
Expand Down Expand Up @@ -262,28 +273,16 @@ if( USE_CUDA )
)
target_compile_definitions( rocfft-test PRIVATE __HIP_PLATFORM_NVCC__ )
endif( )
target_link_libraries( rocfft-test PRIVATE ${ROCFFT_CLIENTS_HOST_LINK_LIBS} ${ROCFFT_CLIENTS_DEVICE_LINK_LIBS} )
target_link_libraries( rocfft-test PRIVATE
${ROCFFT_CLIENTS_HOST_LINK_LIBS}
${ROCFFT_CLIENTS_DEVICE_LINK_LIBS} )

include( ../../cmake/sqlite.cmake )
target_link_libraries( rocfft-test PUBLIC ${ROCFFT_SQLITE_LIB} )
target_include_directories( rocfft-test PRIVATE ${sqlite_local_SOURCE_DIR} )

set_property( TARGET rocfft-test APPEND PROPERTY LINK_LIBRARIES ${ROCFFT_SQLITE_LIB} )

option( BUILD_CLIENTS_TESTS_OPENMP "Build tests with OpenMP" ON )

if( BUILD_CLIENTS_TESTS_OPENMP )
find_package(OpenMP REQUIRED)
if( CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" )
target_link_libraries( rocfft-test PRIVATE OpenMP::OpenMP_CXX -L${HIP_CLANG_ROOT}/lib -Wl,-rpath=${HIP_CLANG_ROOT}/lib )
target_include_directories( rocfft-test PRIVATE ${HIP_CLANG_ROOT}/include )
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries( rocfft-test PRIVATE OpenMP::OpenMP_CXX )
endif()
endif()
endif()

if(FFTW_MULTITHREAD)
target_compile_options( rocfft-test PRIVATE -DFFTW_MULTITHREAD )
endif( )
Expand Down Expand Up @@ -390,7 +389,7 @@ if( ROCFFT_MPI_ENABLE )

endif()

set(COVERAGE_TEST_OPTIONS "--smoketest" CACHE STRING "Command line arguments for rocfft-test when generating a code coverage report")
set(COVERAGE_TEST_OPTIONS "--smoketest;--gtest_filter=-*call*" CACHE STRING "Command line arguments for rocfft-test when generating a code coverage report")

if(BUILD_CODE_COVERAGE)
# Coverage won't work in a standalone build of the tests, as we can't
Expand Down
10 changes: 8 additions & 2 deletions projects/rocfft/shared/fft_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,10 @@ class fft_params
}
}

assert(selected_grid[0] * selected_grid[1] * selected_grid[2] == mp_ranks);
if(selected_grid[0] * selected_grid[1] * selected_grid[2] != mp_ranks)
{
throw std::runtime_error("Grid dimensions do not multiply to mp_ranks.");
}

fft_grid = {selected_grid[0], selected_grid[1], selected_grid[2]};
}
Expand Down Expand Up @@ -653,7 +656,10 @@ class fft_params
}
}

assert(selected_grid[0] * selected_grid[1] == mp_ranks);
if(selected_grid[0] * selected_grid[1] != mp_ranks)
{
throw std::runtime_error("Grid dimensions do not multiply to mp_ranks.");
}

fft_grid = {selected_grid[0], selected_grid[1]};
}
Expand Down