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

Allow specifying CPU target #240

Merged
merged 1 commit into from
Mar 14, 2022
Merged
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
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ option(FAABRIC_WASM_BUILD "Build Faabric wasm library" OFF)
option(FAABRIC_BUILD_TESTS "Build Faabric tests" ON)
option(FAABRIC_SELF_TRACING "Turn on system tracing using the logger" OFF)

option(FAABRIC_TARGET_CPU "CPU to optimise for, e.g. skylake, icelake or native" OFF)

# Enable colorized compiler output
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
Expand All @@ -13,7 +15,12 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif()

# Optimise for CPU
include(cmake/OptimiseCPU.cmake)
if(FAABRIC_TARGET_CPU)
message(STATUS "Optimising Faabric for CPU ${FAABRIC_TARGET_CPU}")
add_compile_options(-march=${FAABRIC_TARGET_CPU} -mtune=${FAABRIC_TARGET_CPU})
else()
message(STATUS "Faabric not optimised for specific CPU")
endif()

# Top-level CMake config
set(CMAKE_CXX_FLAGS "-Wall")
Expand Down
41 changes: 0 additions & 41 deletions cmake/OptimiseCPU.cmake

This file was deleted.

9 changes: 8 additions & 1 deletion tasks/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@

@task
def cmake(
ctx, clean=False, shared=False, build="Debug", sanitiser="None", prof=False
ctx,
clean=False,
shared=False,
build="Debug",
sanitiser="None",
prof=False,
cpu=None,
):
"""
Configures the build
Expand Down Expand Up @@ -44,6 +50,7 @@ def cmake(
"-DCMAKE_C_COMPILER=/usr/bin/clang-13",
"-DFAABRIC_USE_SANITISER={}".format(sanitiser),
"-DFAABRIC_SELF_TRACING=ON" if prof else "",
"-DFAABRIC_TARGET_CPU={}".format(cpu) if cpu else "",
PROJ_ROOT,
]

Expand Down