Skip to content

Commit d00aee6

Browse files
littlewu2508LiXueying0309
authored andcommitted
Check /sys/module/amdgpu for ROCk instead of lsmod
Closes: #42 Signed-off-by: YiyangWu <xgreenlandforwyy@gmail.com>
1 parent aa8a838 commit d00aee6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

rocminfo.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,9 +1201,14 @@ int CheckInitialState(void) {
12011201
return -1;
12021202
}
12031203
} else {
1204-
printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n",
1204+
int module_dir;
1205+
module_dir = open("/sys/module/amdgpu", O_DIRECTORY);
1206+
if (module_dir < 0) {
1207+
printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n",
12051208
COL_RED, COL_RESET);
1206-
return -1;
1209+
return -1;
1210+
}
1211+
close(module_dir);
12071212
}
12081213

12091214
// Check if user belongs to the group for /dev/kfd (e.g. "video" or

0 commit comments

Comments
 (0)