HIP icon indicating copy to clipboard operation
HIP copied to clipboard

Better way to detect hip_platform

Open atabish opened this issue 6 years ago • 0 comments

Hi,

I have a problem with detecting the correct hip_platform on Nvidia machines. The problem lies in the "hipconfig" script below. Since I have installed rocm-dev package for cross-compilation reasons, the command "/opt/rocm/hcc/bin/hcc --version" always runs gracefully and the HIP_PLATFORM is set to "hcc". This causes a problem when the gpu card on the machine is Nvidia. I was wondering if there is a better way to detect platform such as actually probing the system for gpu device.

sub can_run {
    my ($exe) = @_;
    `$exe --version 2>&1`;
    if ($? == 0) {
        return 1;
    } else {
        return 0;
    }
}

and

if (not defined $HIP_PLATFORM) {
    if (can_run("$HCC_HOME/bin/hcc") or can_run("hcc")) {
        $HIP_PLATFORM = "hcc";
    } ...

Note: I know "export HIP_PLATFORM=nvcc" solves this issues but ideally I don't want to require the end-user of my program to do this.

Thanks

atabish avatar Nov 11 '19 22:11 atabish