Get native cuda compute capabilities. Args: environ_cp: copy of the os.environ. Returns: string of native cuda compute capabilities, separated by comma.
(environ_cp)
| 963 | |
| 964 | |
| 965 | def get_native_cuda_compute_capabilities(environ_cp): |
| 966 | """Get native cuda compute capabilities. |
| 967 | |
| 968 | Args: |
| 969 | environ_cp: copy of the os.environ. |
| 970 | |
| 971 | Returns: |
| 972 | string of native cuda compute capabilities, separated by comma. |
| 973 | """ |
| 974 | device_query_bin = os.path.join( |
| 975 | environ_cp.get('CUDA_TOOLKIT_PATH'), 'extras/demo_suite/deviceQuery') |
| 976 | if os.path.isfile(device_query_bin) and os.access(device_query_bin, os.X_OK): |
| 977 | try: |
| 978 | output = run_shell(device_query_bin).split('\n') |
| 979 | pattern = re.compile('[0-9]*\\.[0-9]*') |
| 980 | output = [pattern.search(x) for x in output if 'Capability' in x] |
| 981 | output = ','.join(x.group() for x in output if x is not None) |
| 982 | except subprocess.CalledProcessError: |
| 983 | output = '' |
| 984 | else: |
| 985 | output = '' |
| 986 | return output |
| 987 | |
| 988 | |
| 989 | def set_tf_cuda_compute_capabilities(environ_cp): |