File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1- use std:: fs:: File ;
21use std:: path:: { Path , PathBuf } ;
32
43pub fn get_cuda_path ( ) -> Option < & ' static Path > {
@@ -47,18 +46,19 @@ pub fn get_cuda_lib_path() -> Option<PathBuf> {
4746pub fn get_cuda_version ( ) -> Option < String > {
4847 if let Some ( version) = option_env ! ( "CUDA_VERSION" ) {
4948 Some ( version. to_string ( ) )
50- } else if let Some ( path ) = get_cuda_path ( ) {
49+ } else if get_cuda_path ( ) . is_some ( ) {
5150 let re = regex_lite:: Regex :: new ( r"V(?<version>\d{2}\.\d+\.\d+)" ) . unwrap ( ) ;
5251 let nvcc_out = std:: process:: Command :: new ( "nvcc" )
5352 . arg ( "--version" )
5453 . output ( )
5554 . expect ( "failed to start `nvcc`" ) ;
5655 let nvcc_str = std:: str:: from_utf8 ( & nvcc_out. stdout ) . expect ( "`nvcc` output is not UTF8" ) ;
57- let captures = re. captures ( & nvcc_str) . unwrap ( ) ;
58- let version = captures
56+ let version = re
57+ . captures ( nvcc_str)
58+ . unwrap ( )
5959 . get ( 0 )
6060 . expect ( "unable to find nvcc version in the form VMM.mm.pp in the output of `nvcc --version`:\n {nvcc_str}" )
61- . as_str ( )
61+ . as_str ( ) [ 1 .. ]
6262 . to_string ( ) ;
6363 Some ( version)
6464 } else {
You can’t perform that action at this time.
0 commit comments