Skip to content

Commit 93b2cbc

Browse files
committed
UCT/ROCM: Fix dmabuf support check for coreos.
1 parent 33e7d1d commit 93b2cbc

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Gonzalo Brito Gadeschi <gonzalob@nvidia.com>
4242
Graham Lopez <lopezmg@ornl.gov>
4343
Guy Ealey Morag <gealeymorag@nvidia.com>
4444
Guy Shattah <sguy@mellanox.com>
45+
Hannes Hansen <hannes.jakob.hansen@cern.ch>
4546
Hessam Mirsadeghi <hmirsadeghi@nvidia.com>
4647
Hiroyuki Sato <hiroysato@gmail.com>
4748
Hod Badihi <hbadihi@nvidia.com>

src/uct/rocm/base/rocm_base.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,29 @@ int uct_rocm_base_is_dmabuf_supported()
316316
goto out;
317317
}
318318

319-
ucs_snprintf_safe(kernel_conf_file, sizeof(kernel_conf_file),
320-
"/boot/config-%s", utsname.release);
321-
fp = fopen(kernel_conf_file, "r");
319+
const char *fmts[] = {
320+
"/boot/config-%s",
321+
"/usr/src/linux-%s/.config",
322+
"/usr/src/linux/.config",
323+
"/usr/lib/modules/%s/config",
324+
"/usr/lib/ostree-boot/config-%s",
325+
"/usr/lib/kernel/config-%s",
326+
"/usr/src/linux-headers-%s/.config",
327+
"/lib/modules/%s/build/.config"
328+
};
329+
330+
for (i = 0; i < sizeof(fmts) / sizeof(fmts[0]); ++i) {
331+
ucs_snprintf_safe(path, sizeof(path), fmts[i], utsname.release);
332+
fp = fopen(path, "r");
333+
if (fp != NULL) {
334+
ucs_trace("reading kernel config from %s", path);
335+
break;
336+
}
337+
ucs_trace("could not open kernel conf file %s error: %m", path);
338+
}
339+
322340
if (fp == NULL) {
323-
ucs_trace("could not open kernel conf file %s error: %m",
324-
kernel_conf_file);
341+
ucs_trace("no kernel config file found");
325342
goto out;
326343
}
327344

0 commit comments

Comments
 (0)