def _ctc_check_compile(ctc_lib_path): preamble = """ #include <string.h> #include "ctc.h" """ body = """ ctcOptions options; memset(&options, 0, sizeof(ctcOptions)); options.loc = CTC_CPU; options.num_threads = 1; """ params = [f"-I{os.path.dirname(__file__)}"] if ctc_lib_path is not None: params.extend([f"-I{os.path.join(config.ctc__root, 'include')}"]) params.extend([f"-L{ctc_lib_path}"]) params.extend(["-l", "warpctc"]) compiler_res = GCC_compiler.try_flags(params, preamble=preamble, body=body, try_run=False, output=True) avail, out, err = (compiler_res if isinstance(compiler_res, tuple) else (compiler_res, None, None)) if not avail: return ( False, ("cannot compile with warp-ctc. " "We got this error:\n" + str(err)), ) return True, None
def test_flag_detection(): # Check that the code detecting blas flags does not raise any exception. # It used to happen on python 3 because of improper string handling, # but was not detected because that path is not usually taken, # so we test it here directly. GCC_compiler.try_flags(["-lblas"])