advanced/meson.build#
The file advanced/meson.build
can be used to build the advanced examples
using Meson.
# This meson.build file is included in the build using subdir().
# Note that the top-level meson.build script has already created the
# following dependencies: hpk_core, hpk_fft_fp32, hpk_fft_fp64, dl
# This example uses both single and double precision.
executable('fft_12', 'fft_12.cpp',
dependencies: [hpk_fft_fp32, hpk_fft_fp64, hpk_core, dl])
# The same example as above, but disabling dlsym() lookup.
executable('fft_12_ndlsym', 'fft_12.cpp',
cpp_args: '-DHPK_FFT_NDLSYM',
dependencies: [hpk_fft_fp32, hpk_fft_fp64, hpk_core])
# This 2D example uses only single precision. Note that we are *not* linking
# the AVX512 FFT library, but the code itself will try to dynamically load it.
# If that succeeds, AVX512 code will be used on AVX512 hardware.
executable('fft_3x6', 'fft_3x6.cpp',
dependencies: [hpk_fft_fp32, hpk_core, dl])
# The remainder of this file builds a binary that may actually be useful.
# Note that these utilities respect the process's CPU affinity. For example,
# taskset -c 0 ncore
# prints 1, as only a single core is available to the process.
# SEE ALSO: nproc(1), taskset(1), sched_getaffinity(2)
# First build ncpu, which prints the number of CPUs available to the current
# process. (This is similar to nproc in the GNU core utilities.)
ncpu_exe = executable('ncpu', 'ncpu.cpp', dependencies: hpk_core)
# We'll use a Python script to make hard links in the filesystem.
python_prg = find_program('python3')
python_scr = files('link-f.py')
# When invoked as ncore, the binary prints the number of cores available to
# the current process. The target below makes ncore a hard link to ncpu.
custom_target(input: ncpu_exe,
output: 'ncore',
command: [python_prg, python_scr, '@INPUT@', '@OUTPUT@'],
build_by_default: true)
# When invoked as ndie, the binary prints the number of dies available to
# the current process. The target below makes ndie a hard link to ncpu.
custom_target(input: ncpu_exe,
output: 'ndie',
command: [python_prg, python_scr, '@INPUT@', '@OUTPUT@'],
build_by_default: true)
# When invoked as npkg, the binary prints the number of packages available to
# the current process. The target below makes npkg a hard link to ncpu.
custom_target(input: ncpu_exe,
output: 'npkg',
command: [python_prg, python_scr, '@INPUT@', '@OUTPUT@'],
build_by_default: true)