Skip to content

Commit 7dfdd6f

Browse files
committed
Forward into fetch
1 parent fda04ba commit 7dfdd6f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

interfaces/cuda/Control.cu

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ ConcreteAPI::ConcreteAPI() {
3838

3939
CHECK_ERR;
4040

41+
int numDevices{};
42+
APIWRAP(cudaGetDeviceCount(&numDevices));
43+
44+
properties.resize(numDevices);
45+
for (int i = 0; i < numDevices; ++i) {
46+
APIWRAP(cudaGetDeviceProperties(&properties[i], i));
47+
}
48+
4149
status[StatusID::DriverApiInitialized] = true;
4250
}
4351

@@ -63,14 +71,6 @@ void ConcreteAPI::initialize() {
6371
status[StatusID::InterfaceInitialized] = true;
6472
APIWRAP(cudaStreamCreateWithFlags(&defaultStream, cudaStreamNonBlocking));
6573

66-
int numDevices{};
67-
APIWRAP(cudaGetDeviceCount(&numDevices));
68-
69-
properties.resize(numDevices);
70-
for (int i = 0; i < numDevices; ++i) {
71-
APIWRAP(cudaGetDeviceProperties(&properties[i], i));
72-
}
73-
7474
allowedConcurrentManagedAccess = properties[getDeviceId()].concurrentManagedAccess != 0;
7575

7676
usmDefault = properties[getDeviceId()].directManagedMemAccessFromHost != 0;

interfaces/hip/Control.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ ConcreteAPI::ConcreteAPI() {
3535

3636
CHECK_ERR;
3737

38+
int numDevices{};
39+
APIWRAP(hipGetDeviceCount(&numDevices));
40+
41+
properties.resize(numDevices);
42+
for (int i = 0; i < numDevices; ++i) {
43+
APIWRAP(hipGetDeviceProperties(&properties[i], i));
44+
}
45+
3846
status[StatusID::DriverApiInitialized] = true;
3947
}
4048

@@ -61,14 +69,6 @@ void ConcreteAPI::initialize() {
6169
status[StatusID::InterfaceInitialized] = true;
6270
APIWRAP(hipStreamCreateWithFlags(&defaultStream, hipStreamNonBlocking));
6371

64-
int numDevices{};
65-
APIWRAP(hipGetDeviceCount(&numDevices));
66-
67-
properties.resize(numDevices);
68-
for (int i = 0; i < numDevices; ++i) {
69-
APIWRAP(hipGetDeviceProperties(&properties[i], i));
70-
}
71-
7272
// NOTE: hipDeviceGetAttribute internally calls hipGetDeviceProperties; hence it doesn't make
7373
// sense to use it here
7474

0 commit comments

Comments
 (0)