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