Cuda C ++中的简单文件I / O [英] Simple File I/O in Cuda C++

查看:112
本文介绍了Cuda C ++中的简单文件I / O的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在使用Cuda C ++。但是我在使用CUDA读写文件时遇到了问题。

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

如何在Cuda C ++中实现文件输入输出过程?

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

我想将 .obj 文件读取到我的Cuda内核中。

I wanna read .obj files into my Cuda kernel.

我该怎么办?

推荐答案

使用普通主机(C ++)文件操作读取文件。然后,使用普通的 cudaMalloc cudaMemcpy 操作将数据传输到设备(如果需要)。

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.

您将无法直接在CUDA C ++中实现文件I / O,因为没有为此的API,并且GPU无法直接连接到文件系统。您必须通过操作系统才能获得文件系统服务。

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.

这篇关于Cuda C ++中的简单文件I / O的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆