MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / set_cc_opt_flags

Function set_cc_opt_flags

configure.py:509–534  ·  view source on GitHub ↗

Set up architecture-dependent optimization flags. Also append CC optimization flags to bazel.rc.. Args: environ_cp: copy of the os.environ.

(environ_cp)

Source from the content-addressed store, hash-verified

507
508
509def set_cc_opt_flags(environ_cp):
510 """Set up architecture-dependent optimization flags.
511
512 Also append CC optimization flags to bazel.rc..
513
514 Args:
515 environ_cp: copy of the os.environ.
516 """
517 if is_ppc64le():
518 # gcc on ppc64le does not support -march, use mcpu instead
519 default_cc_opt_flags = '-mcpu=native'
520 elif is_windows():
521 default_cc_opt_flags = '/arch:AVX'
522 else:
523 default_cc_opt_flags = '-march=native -Wno-sign-compare'
524 question = ('Please specify optimization flags to use during compilation when'
525 ' bazel option "--config=opt" is specified [Default is %s]: '
526 ) % default_cc_opt_flags
527 cc_opt_flags = get_from_env_or_user_or_default(environ_cp, 'CC_OPT_FLAGS',
528 question, default_cc_opt_flags)
529 for opt in cc_opt_flags.split():
530 write_to_bazelrc('build:opt --copt=%s' % opt)
531 # It should be safe on the same build host.
532 if not is_ppc64le() and not is_windows():
533 write_to_bazelrc('build:opt --host_copt=-march=native')
534 write_to_bazelrc('build:opt --define with_default_optimizations=true')
535
536
537def set_tf_cuda_clang(environ_cp):

Callers 1

mainFunction · 0.85

Calls 5

is_ppc64leFunction · 0.85
is_windowsFunction · 0.85
write_to_bazelrcFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected