Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple File I/O in Cuda C++

Tags:

c++

cuda

Im working on Cuda C++ right now. But I'm having problems about reading and writing into files with CUDA.

How can I implement file input output processes in Cuda C++?

I wanna read .obj files into my Cuda kernel.

What should i do?

like image 719
blodrayne Avatar asked Oct 25 '13 12:10

blodrayne


1 Answers

Read the file using ordinary host (C++) file operations. Then transfer the data to the device if you need it there, using ordinary cudaMalloc and cudaMemcpy operations.

You won't be able to implement file I/O directly in CUDA C++, as there is no API for this and the GPU does not connect directly to the file system. You have to go through the OS for file system services.

like image 114
Robert Crovella Avatar answered Sep 21 '22 21:09

Robert Crovella