(
src_files: List[str],
dst_file: str,
dst_file_ext: str,
)
| 2106 | |
| 2107 | |
| 2108 | def cuda_compile_command( |
| 2109 | src_files: List[str], |
| 2110 | dst_file: str, |
| 2111 | dst_file_ext: str, |
| 2112 | ) -> str: |
| 2113 | include_paths = _cutlass_include_paths() |
| 2114 | cuda_lib_options = _cuda_lib_options() |
| 2115 | nvcc_host_compiler_options = _nvcc_host_compiler_options() |
| 2116 | nvcc_compiler_options = _nvcc_compiler_options() |
| 2117 | options = ( |
| 2118 | nvcc_compiler_options |
| 2119 | + [ |
| 2120 | f"-Xcompiler {opt}" if "=" in opt else f"-Xcompiler={opt}" |
| 2121 | for opt in nvcc_host_compiler_options |
| 2122 | ] |
| 2123 | + ["-I" + path for path in include_paths] |
| 2124 | + cuda_lib_options |
| 2125 | ) |
| 2126 | src_file = " ".join(src_files) |
| 2127 | res = "" |
| 2128 | if dst_file_ext == "o": |
| 2129 | res = f"{_cuda_compiler()} {' '.join(options)} -c -o {dst_file} {src_file}" |
| 2130 | elif dst_file_ext == "so": |
| 2131 | options.append("-shared") |
| 2132 | res = f"{_cuda_compiler()} {' '.join(options)} -o {dst_file} {src_file}" |
| 2133 | else: |
| 2134 | raise NotImplementedError(f"Unsupported output file suffix {dst_file_ext}!") |
| 2135 | log.debug("CUDA command: %s", res) |
| 2136 | return res |
| 2137 | |
| 2138 | |
| 2139 | class DLLWrapper: |
no test coverage detected
searching dependent graphs…