Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeLists: add PPC support, unbreak build on Darwin #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,29 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(ENABLE_IBM OFF)
set(ENABLE_PPC OFF)

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
set(ENABLE_IBM ON)
endif()

# For now this should do. Notice, however, that ppc32 is used with *BSD and Linux as well,
# so at some point a finer approach may be needed.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc|ppc64")
if(APPLE)
set(ENABLE_PPC ON)
else()
set(ENABLE_IBM ON)
endif()
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(HPTT_CXX_FLAGS ${HPTT_CXX_FLAGS} -qopenmp -xhost)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(ENABLE_IBM)
set(HPTT_CXX_FLAGS ${HPTT_CXX_FLAGS} -fopenmp)
elseif(ENABLE_PPC)
set(HPTT_CXX_FLAGS ${HPTT_CXX_FLAGS} -fopenmp -mtune=native)
else()
set(HPTT_CXX_FLAGS ${HPTT_CXX_FLAGS} -fopenmp -march=native -mtune=native)
endif()
Expand All @@ -33,6 +46,10 @@ elseif(ENABLE_ARM)
set(HPTT_CXX_FLAGS ${HPTT_CXX_FLAGS} -mfpu=neon -DHPTT_ARCH_ARM)
elseif(ENABLE_IBM)
set(HPTT_CXX_FLAGS ${HPTT_CXX_FLAGS} -mtune=native -DHPTT_ARCH_IBM -maltivec -mabi=altivec)
# If the code will move to use VSX insns, please retain non-VSX version for macOS PPC.
# Until then perhaps a common define can be used.
elseif(ENABLE_PPC)
set(HPTT_CXX_FLAGS ${HPTT_CXX_FLAGS} -mtune=native -DHPTT_ARCH_IBM -faltivec)
endif()

set(HPTT_SRCS src/hptt.cpp src/plan.cpp src/transpose.cpp src/utils.cpp)
Expand Down