使用cudf读取一个巨大的csv文件

问题描述

我正在尝试读取一个巨大的 csv 文件 CUDF,但遇到内存问题。

import cudf
cudf.set_allocator("managed")
cudf.__version__
user_wine_rate_df = cudf.read_csv('myfile.csv',sep = "\t",parse_dates = ['created_at'])


'0.17.0a+382.gbd321d1e93'

terminate called after throwing an instance of 'thrust::system::system_error'
  what():  parallel_for failed: cudaErrorIllegalAddress: an illegal memory access was encountered
Aborted (core dumped)

如果我删除 cudf.set_allocator("managed") 我得到

MemoryError: std::bad_alloc: CUDA error at: /opt/conda/envs/rapids/include/rmm/mr/device/cuda_memory_resource.hpp:69: cudaErrorMemoryAllocation out of memory

我通过 rapidsai/rapidsai:cuda11.0-runtime-ubuntu16.04-py3.8 使用 CUDF

我想知道whar可能是内存不足的原因,而我可以用pandas读取这个大文件

**更新

我安装了dask_cudf

并使用 dask_cudf.read_csv('myfile.csv') - 但仍然得到

parallel_for failed: cudaErrorIllegalAddress: an illegal memory access was encountered

解决方法

如果您正在读取的文件大于可用内存,那么当 cuDF 在单个 GPU 上运行时,您将观察到 OOM(内存不足)错误。 为了读取非常大的文件,我建议使用 dask_cudf

,

查看 Nick Becker 的 this blog 阅读大于 GPU 内存的文件。它应该可以帮助您。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...