def get_sunperf_link_options(context, config): """If successefull, returns the link flags. Returns: - st: int 0 : failed 1 : succeeded - flags: dict dictionary of the options. """ context.Message('Getting link options of sunperf ... ') opts = config test_code = cblas_sgemm env = context.env saved = save_and_set(env, opts) try: st = context.TryCompile(test_code, '.c') finally: restore(env, saved) if not st: return context.Result('Failed !'), None saved = save_and_set(env, opts) env.Append(LINKFLAGS = '-#') oldLINK = env['LINK'] env['LINK'] = '$CC' try: # XXX: does this scheme to get the program name always work ? Can # we use Scons to get the target name from the object name ? slast = str(context.lastTarget) prdir = dirname(slast) test_prog = pjoin(prdir, basename(slast).split('.')[0]) cmd = context.env.subst('$LINKCOM', target = context.env.File(test_prog), source = context.lastTarget) st, out = popen_wrapper(cmd, merge = True) finally: restore(env, saved) env['LINK'] = oldLINK # If getting the verbose output succeeds, parse the output if not st: return 1, sunperf_parser_link(out) else: return 0, None
def mkl_version_checker(context, opts): env = context.env version_code = r""" #include <stdio.h> #include <mkl.h> int main(void) { MKLVersion ver; MKLGetVersion(&ver); printf("Full version: %d.%d.%d\n", ver.MajorVersion, ver.MinorVersion, ver.BuildNumber); return 0; } """ opts['rpath'] = opts['library_dirs'] saved = save_and_set(env, opts) try: vst, out = context.TryRun(version_code, '.c') finally: restore(env, saved) if vst: m = re.search(r'Full version: (\d+[.]\d+[.]\d+)', out) if m: version = m.group(1) else: version = '' return vst, version
def atlas_version_checker(context, opts): env = context.env version_code = """ void ATL_buildinfo(void); int main(void) { ATL_buildinfo(); return 0; } """ opts['rpath'] = opts['library_dirs'] saved = save_and_set(env, opts) try: vst, out = context.TryRun(version_code, '.c') finally: restore(env, saved) if vst: m = re.search('ATLAS version (?P<version>\d+[.]\d+[.]\d+)', out) if m: version = m.group(1) else: version = '' else: version = '' return vst, version