Skip to content

Commit

Permalink
Merge 5.0 release branch into amd-fftw
Browse files Browse the repository at this point in the history
  • Loading branch information
BiplabRaut committed Oct 11, 2024
2 parents 5a64feb + 0e8e2a1 commit cfcb67c
Show file tree
Hide file tree
Showing 62 changed files with 819 additions and 100 deletions.
31 changes: 26 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.15)
cmake_minimum_required (VERSION 3.22)

if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
Expand All @@ -14,7 +14,7 @@ SET(AMD_ARCH "znver1" CACHE STRING "select AMD zen version for Clang toolchain")

if (CMAKE_C_COMPILER_ID MATCHES Clang)
if ("${AMD_ARCH}" STREQUAL "")
message(FATAL_ERROR "Machine arch missing! Select one of znver1, znver2, znver3 or znver4")
message(FATAL_ERROR "Machine arch missing! Select one of znver1, znver2, znver3, znver4 or znver5")
elseif (${AMD_ARCH} STREQUAL "znver1")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=znver1")
elseif (${AMD_ARCH} STREQUAL "znver2")
Expand All @@ -23,8 +23,10 @@ if (CMAKE_C_COMPILER_ID MATCHES Clang)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=znver3")
elseif (${AMD_ARCH} STREQUAL "znver4")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=znver4")
elseif (${AMD_ARCH} STREQUAL "znver5")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=znver5")
else ()
message(FATAL_ERROR "Unsupported Machine arch! Select one of znver1, znver2, znver3 or znver4")
message(FATAL_ERROR "Unsupported Machine arch! Select one of znver1, znver2, znver3, znver4 or znver5")
endif ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-prfchw")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mno-prfchw")
Expand Down Expand Up @@ -252,7 +254,7 @@ if (MSVC)
endif(MSVC)

string(TIMESTAMP TODAY "%Y%m%d")
add_compile_definitions(AOCL_FFTW_VERSION="AOCL-FFTW 4.2.0 Build ${TODAY}")
add_compile_definitions(AOCL_FFTW_VERSION="AOCL-FFTW 5.0.0 Build ${TODAY}")

find_library (LIBM_LIBRARY NAMES m)
if (LIBM_LIBRARY)
Expand All @@ -270,6 +272,10 @@ if (Threads_FOUND)
set (HAVE_THREADS TRUE)
endif ()

if (WIN32)
set(OpenMP_libomp_LIBRARY "C:/Program Files/LLVM/lib/libomp.lib" CACHE STRING "openmp library path")
endif (WIN32)

if (ENABLE_OPENMP)
find_package (OpenMP)
endif ()
Expand Down Expand Up @@ -614,6 +620,9 @@ if (OPENMP_FOUND)
target_include_directories (${lib_name} INTERFACE $<INSTALL_INTERFACE:include>)
target_link_libraries (${lib_name} ${CMAKE_THREAD_LIBS_INIT})
target_compile_options (${lib_name} PRIVATE ${OpenMP_C_FLAGS})
if (BUILD_SHARED_LIBS)
target_link_libraries(${lib_name} PRIVATE OpenMP::OpenMP_C)
endif(BUILD_SHARED_LIBS)
endif ()

if (HAVE_MPI)
Expand All @@ -623,6 +632,9 @@ if (HAVE_MPI)
target_include_directories (${lib_name} INTERFACE $<INSTALL_INTERFACE:include>)
target_link_libraries (${lib_name} ${CMAKE_THREAD_LIBS_INIT})
target_compile_options (${lib_name} PRIVATE ${OpenMP_C_FLAGS})
if (BUILD_SHARED_LIBS AND OPENMP_FOUND)
target_link_libraries(${lib_name} PRIVATE OpenMP::OpenMP_C)
endif()
endif ()


Expand Down Expand Up @@ -711,7 +723,7 @@ add_library (libtestbench STATIC tests/bench.c tests/hook.c tests/fftw-bench.c t
if(Threads_FOUND)
set(CMAKE_C_COMPILER_CFLAGS ${PTHREAD_CFLAGS})
if(NOT COMBINED_THREADS)
set(LIBFFTWTHREADS = libfftw3${PREC_SUFFIX}_threads)
set(LIBFFTWTHREADS libfftw3${PREC_SUFFIX}_threads)
endif()
elseif(OPENMP_FOUND)
set(CMAKE_C_COMPILER_CFLAGS ${OpenMP_C_FLAGS})
Expand All @@ -722,19 +734,28 @@ set(fftw${PREC_SUFFIX}-wisdom_src tools/fftw-wisdom.c)

add_executable(fftw${PREC_SUFFIX}-wisdom ${fftw${PREC_SUFFIX}-wisdom_src})
target_link_libraries(fftw${PREC_SUFFIX}-wisdom libbench2 ${LIBFFTWTHREADS} ${lib_name} libtestbench)
if (OPENMP_FOUND)
target_link_libraries(fftw${PREC_SUFFIX}-wisdom OpenMP::OpenMP_C)
endif ()
install(TARGETS fftw${PREC_SUFFIX}-wisdom ${INSTALL_TARGETS_DEFAULT_ARGS} DESTINATION ${CMAKE_INSTALL_BINDIR})


if (BUILD_TESTS)
add_executable (bench tests/bench.c tests/hook.c tests/fftw-bench.c)
target_link_libraries (bench libbench2)
target_link_libraries (bench ${lib_name})
if (OPENMP_FOUND)
target_link_libraries(bench OpenMP::OpenMP_C)
endif ()

if (HAVE_MPI)
add_executable (mpi-bench mpi/mpi-bench.c tests/hook.c tests/fftw-bench.c)
target_include_directories (mpi-bench PRIVATE ${CMAKE_SOURCE_DIR}/api)
target_include_directories (mpi-bench PRIVATE ${MPI_INCLUDE_PATH})
target_link_libraries (mpi-bench libbench2 ${MPI_LIBRARIES} ${lib_name})
if (OPENMP_FOUND)
target_link_libraries(mpi-bench OpenMP::OpenMP_C)
endif ()
endif ()

enable_testing ()
Expand Down
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
* Copyright (C) 2019-2023, Advanced Micro Devices, Inc. All Rights Reserved.
* Copyright (C) 2019-2024, Advanced Micro Devices, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit cfcb67c

Please sign in to comment.