From 02a4720281d930b1bf01095f6d69f171497905c5 Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Sat, 27 Feb 2016 21:26:40 -0600 Subject: [PATCH] add check for hip platform configuration [ROCm/hip commit: 352c056ea6a031a22af981e30b5f2895e2312f81] --- projects/hip/bin/hipconfig | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/projects/hip/bin/hipconfig b/projects/hip/bin/hipconfig index fbb1472e14..d5f068c097 100755 --- a/projects/hip/bin/hipconfig +++ b/projects/hip/bin/hipconfig @@ -15,6 +15,7 @@ GetOptions( ,"platform|P" => \$p_platform ,"cpp_config|cxx_config|C" => \$p_cpp_config ,"full|f|info" => \$p_full, + ,"check" => \$p_check, ,"newline|n" => \$p_newline ); @@ -25,6 +26,7 @@ if ($p_help) { print " --compiler, -c : print compiler (hcc or nvcc)\n"; print " --platform, -P : print platform (hcc or nvcc)\n"; print " --full, -f : print full config\n"; + print " --check : check configuration\n"; print " --newline, -n : print newline\n"; print " --help, -h : print help message\n"; exit(); @@ -37,6 +39,9 @@ $CUDA_PATH='/usr/local/cuda' unless defined $CUDA_PATH; $HCC_HOME=$ENV{'HCC_HOME'}; $HCC_HOME='/opt/hcc' unless defined $HCC_HOME; +$HSA_PATH=$ENV{'HSA_PATH'}; +$HSA_PATH='/opt/hsa' unless defined $HSA_PATH; + #--- #HIP_PLATFORM controls whether to use NVCC or HCC for compilation: $HIP_PLATFORM=$ENV{'HIP_PLATFORM'}; @@ -74,6 +79,7 @@ if ($p_compiler or $p_platform) { } + if (!$printed or $p_full) { print "== hipconfig\n"; print "HIP_PATH : ", $HIP_PATH, "\n"; @@ -83,7 +89,7 @@ if (!$printed or $p_full) { { print "\n" ; print "== hcc\n"; - print ("HSA_HOME : $HCC_HOME\n"); + print ("HSA_PATH : $HSA_PATH\n"); print ("HCC_HOME : $HCC_HOME\n"); system("$HCC_HOME/bin/hcc --version"); print ("HCC-cxxflags: "); @@ -115,6 +121,30 @@ if (!$printed or $p_full) { } +if ($p_check) { + print "\nCheck system installation:\n"; + + printf ("%-70s", "check hipconfig in PATH..."); + if (system ("hipconfig > /dev/null 2>&1") != 0) { + print "FAIL\n"; + } else { + printf "good\n"; + } + + if ($HIP_PLATFORM eq "hcc") { + $LD_LIBRARY_PATH=$ENV{'LD_LIBRARY_PATH'}; + printf("%-70s", "check LD_LIBRARY_PATH ($LD_LIBRARY_PATH) contains HSA_PATH ($HSA_PATH)..."); + if (index($LD_LIBRARY_PATH, $HSA_PATH) == -1) { + print "FAIL\n"; + } else { + printf "good\n"; + } + + # TODO - check hipcc / nvcc found and executable. + } +} + + if ($p_newline) { print "\n"; }