Skip to content

Commit db35353

Browse files
authored
Merge pull request #420 from zhenyu-xu-metax/fix-metax-gpu-number
Fix incorrect gpu number for METAX GPU
2 parents 8f3a7bb + 4e1be6b commit db35353

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/extract_gpuinfo_metax.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static mxSmlReturn_t (*mxSmlInit)(void);
4343

4444
// Static information and helper functions
4545

46-
static mxSmlReturn_t(*mxSmlGetDeviceCount)(unsigned int *deviceCount);
46+
static unsigned int (*mxSmlGetDeviceCount)(void);
4747

4848
static const char *(*mxSmlGetErrorString)(mxSmlReturn_t);
4949

@@ -223,7 +223,6 @@ __attribute__((constructor)) static void init_extract_gpuinfo_metax(void) { regi
223223
*
224224
*/
225225
static bool gpuinfo_metax_init(void) {
226-
printf("gpuinfo_metax_init\n");
227226
libmxsml_handle = dlopen("/opt/mxdriver/lib/libmxsml.so", RTLD_LAZY);
228227
if (!libmxsml_handle)
229228
libmxsml_handle = dlopen("/opt/maca/lib/libmxsml.so", RTLD_LAZY);
@@ -344,13 +343,10 @@ static const char *gpuinfo_metax_last_error_string(void) {
344343
}
345344

346345
static bool gpuinfo_metax_get_device_handles(struct list_head *devices, unsigned int *count) {
347-
printf("gpuinfo_metax_get_device_handles...\n");
348346
if (!libmxsml_handle)
349347
return false;
350348

351-
unsigned int num_devices;
352-
mxSmlGetDeviceCount(&num_devices);
353-
printf("device count: %u\n", num_devices);
349+
unsigned int num_devices = mxSmlGetDeviceCount();
354350
struct gpu_info_metax *gpu_infos = calloc(num_devices, sizeof(*gpu_infos));
355351
if (!gpu_infos) {
356352
local_error_string = strerror(errno);
@@ -364,7 +360,7 @@ static bool gpuinfo_metax_get_device_handles(struct list_head *devices, unsigned
364360
mxSmlDeviceInfo_t deviceInfo;
365361
mxSmlReturn_t deviceInfoRet = mxSmlGetDeviceInfo(i, &deviceInfo);
366362
if (deviceInfoRet != MXSML_SUCCESS) {
367-
deviceInfoRet != mxSmlGetLimitedDeviceInfo(i, &deviceInfo);
363+
deviceInfoRet = mxSmlGetLimitedDeviceInfo(i, &deviceInfo);
368364
// Limited device
369365
if (deviceInfoRet == MXSML_SUCCESS) {
370366
gpu_infos[*count].device = deviceInfo;

0 commit comments

Comments
 (0)