Skip to content

Prep for v7.0 and refactor openMP build flags #204

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

Merged
merged 2 commits into from
May 16, 2025
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
18 changes: 8 additions & 10 deletions lib/meson.build
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
libtargets = []

# Add compile flags for OpenMP if enabled
openmpflags = []
if get_option('use_openmp')
openmpflags = ['-DXSS_USE_OPENMP=true', '-fopenmp']
endif

if cpp.has_argument('-march=haswell')
libtargets += static_library('libavx',
files(
'x86simdsort-avx2.cpp',
),
include_directories : [src],
cpp_args : ['-march=haswell', openmpflags],
cpp_args : ['-march=haswell'],
gnu_symbol_visibility : 'inlineshidden',
dependencies: [omp_dep],
)
endif

Expand All @@ -23,8 +18,9 @@ if cpp.has_argument('-march=skylake-avx512')
'x86simdsort-skx.cpp',
),
include_directories : [src],
cpp_args : ['-march=skylake-avx512', openmpflags],
cpp_args : ['-march=skylake-avx512'],
gnu_symbol_visibility : 'inlineshidden',
dependencies: [omp_dep],
)
endif

Expand All @@ -34,8 +30,9 @@ if cpp.has_argument('-march=icelake-client')
'x86simdsort-icl.cpp',
),
include_directories : [src],
cpp_args : ['-march=icelake-client', openmpflags],
cpp_args : ['-march=icelake-client'],
gnu_symbol_visibility : 'inlineshidden',
dependencies: [omp_dep],
)
endif

Expand All @@ -45,8 +42,9 @@ if cancompilefp16
'x86simdsort-spr.cpp',
),
include_directories : [src],
cpp_args : ['-march=sapphirerapids', openmpflags],
cpp_args : ['-march=sapphirerapids'],
gnu_symbol_visibility : 'inlineshidden',
dependencies: [omp_dep],
)
endif

Expand Down
16 changes: 12 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('x86-simd-sort', 'cpp',
version : '6.0.x',
version : '7.0.x',
license : 'BSD 3-clause',
default_options : ['cpp_std=c++17'])
fs = import('fs')
Expand Down Expand Up @@ -29,6 +29,14 @@ if get_option('build_vqsortbench')
benchvq = true
endif

# openMP:
omp = []
omp_dep = []
if get_option('use_openmp')
omp = dependency('openmp', required : true)
omp_dep = declare_dependency(dependencies: omp, compile_args: ['-DXSS_USE_OPENMP'])
endif

fp16code = '''#include<immintrin.h>
int main() {
__m512h temp = _mm512_set1_ph(1.0f);
Expand All @@ -43,8 +51,8 @@ if get_option('lib_type') == 'shared'
libsimdsort = shared_library('x86simdsortcpp',
'lib/x86simdsort.cpp',
include_directories : [src, utils, lib],
link_args : [openmpflags],
link_with : [libtargets],
dependencies: [omp_dep],
gnu_symbol_visibility : 'inlineshidden',
install : true,
soversion : 1,
Expand All @@ -53,8 +61,8 @@ else
libsimdsort = static_library('x86simdsortcpp',
'lib/x86simdsort.cpp',
include_directories : [src, utils, lib],
link_args : [openmpflags],
link_with : [libtargets],
dependencies: [omp_dep],
gnu_symbol_visibility : 'inlineshidden',
install : true,
pic: true,
Expand All @@ -63,7 +71,7 @@ endif

pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : libsimdsort,
version : '4.0',
version : '7.0',
name : 'libx86simdsortcpp',
filebase : 'x86simdsortcpp',
description : 'C++ template library for high performance SIMD based sorting routines.')
Expand Down
16 changes: 6 additions & 10 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
libtests = []

if get_option('use_openmp')
openmpflags = ['-DXSS_USE_OPENMP=true']
endif

# Add compile flags when needed for the ASAN CI run
testargs = []
if get_option('asan_ci_dont_validate')
Expand All @@ -16,21 +12,21 @@ endif

libtests += static_library('tests_qsort',
files('test-qsort.cpp', ),
dependencies: gtest_dep,
dependencies: [omp_dep, gtest_dep],
include_directories : [src, lib, utils],
cpp_args : [testargs, openmpflags],
cpp_args : [testargs],
)

libtests += static_library('tests_kvsort',
files('test-keyvalue.cpp', ),
dependencies: gtest_dep,
dependencies: [omp_dep, gtest_dep],
include_directories : [src, lib, utils],
cpp_args : [testargs, openmpflags],
cpp_args : [testargs],
)

libtests += static_library('tests_objsort',
files('test-objqsort.cpp', ),
dependencies: gtest_dep,
dependencies: [omp_dep, gtest_dep],
include_directories : [src, lib, utils],
cpp_args : [testargs, openmpflags],
cpp_args : [testargs],
)
Loading