From 90eb7e1c4e301317aa38176f69f1287ad63bdf5e Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Fri, 25 Mar 2016 17:08:34 -0500 Subject: [PATCH] Improve automated platform detection. If AMD GPU is installed and detected by driver, default HIP_PLATFORM to hcc. [ROCm/hip commit: 373251aca03e9ffeb5670bf170fc9f6edcbf65d5] --- projects/hip/bin/hipconfig | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/hip/bin/hipconfig b/projects/hip/bin/hipconfig index af85e335a6..2d880f157d 100755 --- a/projects/hip/bin/hipconfig +++ b/projects/hip/bin/hipconfig @@ -45,10 +45,15 @@ $HSA_PATH='/opt/hsa' unless defined $HSA_PATH; #--- #HIP_PLATFORM controls whether to use NVCC or HCC for compilation: $HIP_PLATFORM=$ENV{'HIP_PLATFORM'}; -if (not defined $HIP_PLATFORM and (-e "$CUDA_PATH/bin/nvcc")) { - $HIP_PLATFORM="nvcc"; +if (not defined $HIP_PLATFORM) { + $NAMDGPUNODES=`cat /sys/class/kfd/kfd/topology/nodes/*/properties 2>/dev/null | grep -c 'simd_count [1-9]'`; + + if ($NAMDGPUNODES > 0) { + $HIP_PLATFORM = "hcc" + } else { + $HIP_PLATFORM = "nvcc"; + } } -$HIP_PLATFORM="hcc" unless defined $HIP_PLATFORM; $HIP_PATH=$ENV{'HIP_PATH'}; $HIP_PATH=Cwd::realpath (dirname (dirname $0)) unless defined $HIP_PATH; # use parent directory of this tool