Merge pull request #108 from adityaatluri/enum-fix

fixed device selection during compilation to use rocm_agent_enumerator
This commit is contained in:
Ben Sander
2017-07-21 16:42:48 -05:00
committed by GitHub
2 changed files with 25 additions and 2 deletions
+22
View File
@@ -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 = " ";
+3 -2
View File
@@ -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);