Skip to content

Commit

Permalink
Try to fix CI tests (gwastro#4394)
Browse files Browse the repository at this point in the history
* Switch FFTW/MKL order of preference

* Swap backend order and force gomp import

* FIx typo

* Do need openmpi in tox.ini

* Fix bug in MKL error function

* Force FFTW on this one.

* CC

* Requested Josh changes
  • Loading branch information
spxiwh authored and PRAVEEN-mnl committed Jun 19, 2023
1 parent e188b2d commit 39dcbe3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions examples/inference/lisa_smbhb_inj/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ pycbc_inference \
--config-files `dirname "$0"`/lisa_smbhb_relbin.ini \
--output-file lisa_smbhb_inj_pe.hdf \
--force \
--fft-backends fftw \
--verbose

# PLEASE NOTE: This example is currently forcing a FFTW backend because MKL
# seems to fail for FFT lengths > 2^24. This is fine for most LIGO
# applications, but an issue for most LISA applications.
2 changes: 1 addition & 1 deletion pycbc/fft/backend_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
_backend_dict = {'fftw' : 'fftw',
'mkl' : 'mkl',
'numpy' : 'npfft'}
_backend_list = ['fftw','mkl','numpy']
_backend_list = ['mkl', 'fftw', 'numpy']

_alist, _adict = _list_available(_backend_list, _backend_dict)

Expand Down
9 changes: 7 additions & 2 deletions pycbc/fft/fftw.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ def _init_threads(backend):
raise ValueError("Backend {0} for FFTW threading does not exist!".format(backend))
if double_threaded_libname is not None:
try:
# For reasons Ian doesn't understand we should not load libgomp
# first using RTLD_DEEPBIND, so force loading it here if needed
if backend == 'openmp':
get_ctypes_library('gomp', [], mode=ctypes.DEFAULT_MODE)
# Note that the threaded libraries don't have their own pkg-config
# files we must look for them wherever we look for double or single
# FFTW itself.
Expand Down Expand Up @@ -152,8 +156,9 @@ def set_threads_backend(backend=None):
if retval != 0:
raise RuntimeError("Could not initialize FFTW threading backend {0}".format(backend))
else:
# Note that we pop() from the end, so 'openmp' is the first thing tried
_backend_list = ['unthreaded','pthreads','openmp']
# Note that we pop() from the end, so 'pthreads'
# is the first thing tried
_backend_list = ['unthreaded','openmp', 'pthreads']
while not _fftw_threaded_set:
_next_backend = _backend_list.pop()
retval = _init_threads(_next_backend)
Expand Down
2 changes: 1 addition & 1 deletion pycbc/fft/mkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def check_status(status):
there is an error.
"""
if status:
lib.DftiErrorMessage.restype = ctypes.c_char_p
msg = lib.DftiErrorMessage(status)
msg = ctypes.c_char_p(msg).value
raise RuntimeError(msg)

def create_descriptor(size, idtype, odtype, inplace):
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ conda_deps=
binutils_linux-64>=2.39
gsl
lapack==3.6.1
openmpi
conda_channels=conda-forge
setenv = PYCBC_TEST_TYPE=docs
commands = bash tools/pycbc_test_suite.sh

0 comments on commit 39dcbe3

Please sign in to comment.