Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
git clone https://github.com/google/benchmark.git
cd benchmark
cmake -E make_directory "build"
cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
cmake -E chdir "build" cmake -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ../
sudo cmake --build "build" --config Release --target install

- name: Install Intel SDE
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
cd benchmark
pip3 install -r requirements.txt
cmake -E make_directory "build"
cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
cmake -E chdir "build" cmake -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ../
sudo cmake --build "build" --config Release --target install

- name: Run bench-compare
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
*.out
*.app

# Build or IDE artifacts
**/.vscode

/builddir/
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
CXX ?= g++-12
CXXFLAGS += -I$(SRCDIR) -I$(UTILS) -O3
GTESTCFLAGS = `pkg-config --cflags gtest_main`
GTESTLDFLAGS = `pkg-config --static --libs gtest_main`
GBENCHCFLAGS = `pkg-config --cflags benchmark`
GBENCHLDFLAGS = `pkg-config --static --libs benchmark`
MARCHFLAG = -march=sapphirerapids

SRCDIR = ./src
TESTDIR = ./tests
BENCHDIR = ./benchmarks
Expand All @@ -8,13 +15,16 @@ TESTS = $(wildcard $(TESTDIR)/*.cpp)
BENCHS = $(wildcard $(BENCHDIR)/*.cpp)
TESTOBJS = $(patsubst $(TESTDIR)/%.cpp,$(TESTDIR)/%.o,$(TESTS))
BENCHOBJS = $(patsubst $(BENCHDIR)/%.cpp,$(BENCHDIR)/%.o,$(BENCHS))
BENCHOBJS := $(filter-out $(BENCHDIR)/main.o ,$(BENCHOBJS))
CXXFLAGS += -I$(SRCDIR) -I$(UTILS)
GTESTCFLAGS = `pkg-config --cflags gtest_main`
GTESTLDFLAGS = `pkg-config --libs gtest_main`
GBENCHCFLAGS = `pkg-config --cflags benchmark`
GBENCHLDFLAGS = `pkg-config --libs benchmark`
MARCHFLAG = -march=sapphirerapids -O3

# Compiling AVX512-FP16 instructions isn't possible for g++ < 12
ifeq ($(shell expr `$(CXX) -dumpversion | cut -d '.' -f 1` \< 12), 1)
MARCHFLAG = -march=icelake-client
BENCHOBJS_SKIP += bench-qsortfp16.o
TESTOBJS_SKIP += test-qsortfp16.o
endif

BENCHOBJS := $(filter-out $(addprefix $(BENCHDIR)/, $(BENCHOBJS_SKIP)) ,$(BENCHOBJS))
TESTOBJS := $(filter-out $(addprefix $(TESTDIR)/, $(TESTOBJS_SKIP)) ,$(TESTOBJS))

all : test bench

Expand All @@ -31,7 +41,7 @@ $(BENCHDIR)/%.o : $(BENCHDIR)/%.cpp $(SRCS)
$(CXX) $(CXXFLAGS) $(MARCHFLAG) $(GBENCHCFLAGS) -c $< -o $@

bench: $(BENCHOBJS) $(UTILS)/cpuinfo.o
$(CXX) $(BENCHDIR)/main.cpp $(BENCHOBJS) $(MARCHFLAG) $(CXXFLAGS) $(GBENCHLDFLAGS) $(UTILS)/cpuinfo.o -o benchexe
$(CXX) $(BENCHOBJS) $(UTILS)/cpuinfo.o $(MARCHFLAG) $(CXXFLAGS) -lbenchmark_main $(GBENCHLDFLAGS) -o benchexe

meson:
meson setup --warnlevel 0 --buildtype plain builddir
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/main.cpp

This file was deleted.

7 changes: 4 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ src = include_directories('src')
bench = include_directories('benchmarks')
utils = include_directories('utils')
tests = include_directories('tests')
gtest_dep = dependency('gtest_main', required : true)
gbench_dep = dependency('benchmark', required : true)
gtest_dep = dependency('gtest_main', required : true, static: true)
gbench_dep = dependency('benchmark', required : true, static: true)

fp16code = '''#include<immintrin.h>
int main() {
Expand All @@ -28,9 +28,10 @@ testexe = executable('testexe',
link_whole : [libtests, libcpuinfo]
)

benchexe = executable('benchexe', 'benchmarks/main.cpp',
benchexe = executable('benchexe',
include_directories : [src, utils, bench],
dependencies : [gbench_dep],
link_args: ['-lbenchmark_main'],
link_whole : [libbench, libcpuinfo],
)

Expand Down