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.txt update #7

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ include
.cache
img
.vscode
.DS_Store
32 changes: 17 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# CMake Configuration
cmake_minimum_required(VERSION 3.12)

list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS ON)

project(fft_benchmark)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

if (MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
Expand All @@ -12,19 +14,19 @@ endif ()
add_compile_definitions(CMAKE_CXX_COMPILER_ID="${CMAKE_CXX_COMPILER_ID}")
add_compile_definitions(CMAKE_CXX_COMPILER_VERSION="${CMAKE_CXX_COMPILER_VERSION}")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

set(COMMON_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/src)

set(COMMON_SRCS ${CMAKE_CURRENT_LIST_DIR}/src/fft_benchmark.cpp ${CMAKE_CURRENT_LIST_DIR}/src/benchmark.hpp
${CMAKE_CURRENT_LIST_DIR}/src/benchmark.cpp ${CMAKE_CURRENT_LIST_DIR}/src/utils.cpp)
# Project information & includes
project(fft_benchmark)
add_compile_options(-Wextra -Wno-sign-compare -Wimplicit-fallthrough)

function (add_fft NAME)
cmake_parse_arguments(LIB "" "" "SOURCES;LIBRARIES;INCLUDES" ${ARGN})
if(APPLE)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
set(CMAKE_INSTALL_NAME_DIR "@rpath")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "@loader_path")
endif()

add_executable(fft_benchmark_${NAME} ${COMMON_SRCS} ${LIB_SOURCES})
target_link_libraries(fft_benchmark_${NAME} PRIVATE ${LIB_LIBRARIES})
target_include_directories(fft_benchmark_${NAME} PRIVATE ${COMMON_INCLUDES} ${LIB_INCLUDES})
endfunction ()
include(DisableInSourceBuild)
include(FindPackageStandard)

add_subdirectory(fftlibs)
# Adding libraries
add_subdirectory(src)
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Use the rootproject/root image as the base image
FROM rootproject/root:latest

# Update package lists and install necessary packages
ENV LANG=C.UTF-8
ENV DEBIAN_FRONTEND noninteractive
ENV NPROC=8

COPY Dockerfile.packages packages

RUN apt-get update -qq && \
ln -sf /usr/share/zoneinfo/UTC /etc/localtime && \
apt-get -y install $(cat packages | grep -v '#') && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/cache/apt/archives/* && \
rm -rf /var/lib/apt/lists/*

ENV LD_LIBRARY_PATH /usr/local/lib:/usr:/usr/lib/aarch64-linux-gnu:/usr/lib/x86_64-linux-gnu

COPY . /opt/fft-benchmark
WORKDIR /opt/fft-benchmark

# KFR5/6
RUN wget https://github.com/kfrlib/kfr/archive/refs/tags/6.0.2.tar.gz
RUN tar -xzvf 6.0.2.tar.gz
RUN cd kfr-6.0.2 && mkdir build
RUN cd kfr-6.0.2/build && cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/opt/kfr/6.0.2
RUN cd kfr-6.0.2/build && make -j8 && make install

RUN wget https://github.com/kfrlib/kfr/archive/refs/tags/5.2.0.tar.gz
RUN tar -xzvf 5.2.0.tar.gz
RUN cd kfr-5.2.0 && mkdir build
RUN cd kfr-5.2.0/build && cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/opt/kfr/5.2.0
RUN cd kfr-5.2.0/build && make -j8 && make install

RUN wget https://github.com/kfrlib/kfr/archive/refs/tags/5.0.0.tar.gz
RUN tar -xzvf 5.0.0.tar.gz
RUN cd kfr-5.0.0 && mkdir build
RUN cd kfr-5.0.0/build && cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/opt/kfr/5.0.0
RUN cd kfr-5.0.0/build && make -j8 && make install

# FFTW3 (Optional)
RUN apt-get update && apt-get install libfftw3-dev || true

# Intel IPP (Optional)
RUN wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/046b1402-c5b8-4753-9500-33ffb665123f/l_ipp_oneapi_p_2021.10.1.16.sh || true
RUN ./l_ipp_oneapi_p_2021.10.1.16.sh || true

# Intel MKP (Optional)
RUN apt-get update && apt-get install intel-oneapi-mkl-devel || true

CMD ["make", "all"]
12 changes: 12 additions & 0 deletions Dockerfile.packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bash
git
wget
make
supervisor
lsb-release
gnupg2
ca-certificates
nano
procps
cmake
clang
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.PHONY: all smalln highn potn plot
all:
@$(MAKE) smalln
@$(MAKE) highn
@$(MAKE) potn

@$(MAKE) plot

smalln:
@share/benchmark/fftdivision share/kfr5-smalln kfr5 1000 100
@share/benchmark/fftdivision share/kfr6-smalln kfr6 1000 100
@share/benchmark/fftdivision share/fftw-smalln fftw 1000 100
@share/benchmark/fftdivision share/ipp-smalln ipp 1000 100
@share/benchmark/fftdivision share/mkl-smalln mkl 1000 100

highn:
@share/benchmark/fftdivision share/kfr5-highn kfr5 1000000 100
@share/benchmark/fftdivision share/kfr6-highn kfr6 1000000 100
@share/benchmark/fftdivision share/fftw-highn fftw 1000000 100
@share/benchmark/fftdivision share/ipp-highn ipp 1000000 100
@share/benchmark/fftdivision share/mkl-highn mkl 1000000 100

potn:
@share/benchmark/fftpot share/kfr5-potn kfr5 20
@share/benchmark/fftpot share/kfr6-potn kfr6 20
@share/benchmark/fftpot share/fftw-potn fftw 20
@share/benchmark/fftpot share/ipp-potn ipp 20
@share/benchmark/fftpot share/mkl-potn mkl 20

plot:
@share/benchmark/plot.py share/kfr5-highn/*.json share/kfr6-highn/*.json share/fftw-highn/*.json share/ipp-highn/*.json share/mkl-highn/*.json
@share/benchmark/plot.py share/kfr5-smalln/*.json share/kfr6-smalln/*.json share/fftw-smalln/*.json share/ipp-smalln/*.json share/mkl-smalln/*.json
@share/benchmark/plot.py share/kfr5-potn/*.json share/kfr6-potn/*.json share/fftw-potn/*.json share/ipp-potn/*.json share/mkl-potn/*.json

@root -l share/benchmark/plot.C share/kfr5-highn/*.json share/kfr6-highn/*.json share/fftw-highn/*.json share/ipp-highn/*.json share/mkl-highn/*.json
@root -l share/benchmark/plot.C share/kfr5-smalln/*.json share/kfr6-smalln/*.json share/fftw-smalln/*.json share/ipp-smalln/*.json share/mkl-smalln/*.json
@root -l share/benchmark/plot.C share/kfr5-potn/*.json share/kfr6-potn/*.json share/fftw-potn/*.json share/ipp-potn/*.json share/mkl-potn/*.json

13 changes: 13 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/bash

# KFR 5
mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../install \
-DKFR5="$KFR5" -DKFR6="$KFR6" \
-DFFTW="$FFTW" \
-DIPP="$IPP" \
-DMKL="$MKL"\

make -j8 && make install
cd ..
5 changes: 5 additions & 0 deletions cmake/DisableInSourceBuild.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Check if the source directory is the same as the binary directory
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Display a fatal error message if it's an in-source build
message(FATAL_ERROR "In-source build not allowed. Please make a new directory (called a build directory) and run the cmake command from there (don't forget now to remove the cached variables).")
endif()
Loading