I am trying to make our device work with Libcufile , basically we want our device dma which has control of data trafer to its huge volatile memory to be used by GPu using GDS. its failing at
cufio_core:1259 cuFile DIO status for file descriptor 51 DirectIO not supported
How does libcufile check this Flag ?
To there is failure here… cuFileHandleRegister → 5008
On Linux, the canonical way to check whether a file descriptor was opened with O_DIRECT is:
-
fcntl(fd, F_GETFL) to retrieve the open flags, then
-
test the returned flags with & O_DIRECT
Conceptually:
Shell
int flags = fcntl(fd, F_GETFL);
if (flags < 0) { /* error */ }
bool has_odirect = (flags & O_DIRECT) != 0;
``
Show more lines
That’s almost certainly the first “cheap” check libcufile performs, because it’s quick and doesn’t require any filesystem probing.
Important nuance: O_DIRECT is an open-time flag. If your application (or a library layer) opens the fd without O_DIRECT, libcufile cannot “add it later” just by checking; it will reject for DIO.