Need suggestions to transfer direct data from GPU to disk not via CPU

Hi All, I need some library suggestions for this direct write the data on disk from GPU without involving the host (CPU). Is this possible, if not please explain?

The GPU does not connect directly to any disk interface. The shortest path may be GPU Direct Storage (GDS), depending on your platform. There are numerous articles and public documentation for GDS.

Thanks Robert! nice suggestion

You can memory map a file, register the memory with cudaHostRegister, then access the file memory directly from the kernel

#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <assert.h>

__global__
void kernel(char* filedata){
	const char* string = "Hello\n";
	memcpy(filedata, string, 6);
}

int main(){

	int fd = open("file.txt", O_RDWR | O_CREAT);
	assert(fd > 0);

	int ret = ftruncate(fd, 4096);
	assert(ret == 0);

	void* ptr = mmap(nullptr, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
	assert(ptr != MAP_FAILED);

	char* mappedfiledata = (char*)ptr;
	cudaError_t status = cudaHostRegister(mappedfiledata, 4096, cudaHostRegisterDefault);
	assert(status == cudaSuccess);

	kernel<<<1,1>>>(mappedfiledata);
	cudaDeviceSynchronize();

    status = cudaHostUnregister(mappedfiledata);
	assert(status == cudaSuccess);

	ret = munmap(ptr, 4096);

	close(fd);
}

I am also thinking to write a kernel, Thanks!