Merge pull request #108 from adityaatluri/enum-fix
fixed device selection during compilation to use rocm_agent_enumerator
This commit is contained in:
@@ -103,6 +103,28 @@ if ($HIP_PLATFORM eq "hcc") {
|
||||
|
||||
$HIPLDFLAGS = `${HCC_HOME}/bin/hcc-config --ldflags`;
|
||||
|
||||
$ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator";
|
||||
|
||||
my $myAgents = `${ROCM_AGENT_ENUM} -t GPU`;
|
||||
my @agentsLine = split('\n', $myAgents);
|
||||
|
||||
foreach my $val (@agentsLine) {
|
||||
if($val eq "gfx701") {
|
||||
$target_gfx701 = 1;
|
||||
}
|
||||
if($val eq "gfx801") {
|
||||
$target_gfx801 = 1;
|
||||
}
|
||||
if($val eq "gfx802") {
|
||||
$target_gfx802 = 1;
|
||||
}
|
||||
if($val eq "gfx803") {
|
||||
$target_gfx803 = 1;
|
||||
}
|
||||
if($val eq "gfx900") {
|
||||
$target_gfx900 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#### GCC system includes workaround ####
|
||||
$HCC_WA_FLAGS = " ";
|
||||
|
||||
@@ -54,9 +54,10 @@ int main(int argc, char *argv[])
|
||||
float *A_h, *C_h;
|
||||
size_t N = 1000000;
|
||||
size_t Nbytes = N * sizeof(float);
|
||||
|
||||
static int device = 0;
|
||||
CHECK(hipSetDevice(device));
|
||||
hipDeviceProp_t props;
|
||||
CHECK(hipGetDeviceProperties(&props, 0/*deviceID*/));
|
||||
CHECK(hipGetDeviceProperties(&props, device/*deviceID*/));
|
||||
printf ("info: running on device %s\n", props.name);
|
||||
#ifdef __HIP_PLATFORM_HCC__
|
||||
printf ("info: architecture on AMD GPU device is: %d\n",props.gcnArch);
|
||||
|
||||
Reference in New Issue
Block a user