rapidsai / cudf

cuDF - GPU DataFrame Library
https://docs.rapids.ai/api/cudf/stable/
Apache License 2.0
8.34k stars 889 forks source link

[BUG] Creating a DataFrame from a numpy array consumes too much RAM #10107

Closed NightMachinery closed 2 years ago

NightMachinery commented 2 years ago

Describe the bug Creating a DataFrame from a numpy array consumes too much RAM.

Steps/Code to reproduce bug

command time -f 'Max_memory: %M' python -c '
import numpy
np = numpy

n = 10**(5+4)
# a = numpy.random.default_rng().standard_normal(size=(n), dtype=np.float32)
a = np.ones((n,), dtype=np.float32)

import cudf
cudf.DataFrame(a)
' 

This will result in the following main memory (not GPU memory!) usages:

Expected behavior The numpy array itself occupies(you can comment the last two lines to see this):

The expected behavior is that the conversion should happen with some constant O(1) overhead, not an O(n) overhead.

Environment overview (please complete the following information)

Environment details Please run and paste the output of the cudf/print_env.sh script here, to gather any other relevant environment details

<details><summary>Click here to see environment details</summary><pre>

     **git***
     commit f1e0bb6a4ee766e68d93a9958688dd9ee0df7333 (HEAD -> branch-22.04, origin/branch-22.04, origin/HEAD)
     Merge: 57ff6f55b9 5a4c5f36f0
     Author: gpuCI <38199262+GPUtester@users.noreply.github.com>
     Date:   Fri Jan 21 14:26:43 2022 -0500

     Merge pull request #10106 from rapidsai/branch-22.02

     [gpuCI] Forward-merge branch-22.02 to branch-22.04 [skip gpuci]
     **git submodules***

     ***OS Information***
     DISTRIB_ID=Ubuntu
     DISTRIB_RELEASE=18.04
     DISTRIB_CODENAME=bionic
     DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
     NAME="Ubuntu"
     VERSION="18.04.5 LTS (Bionic Beaver)"
     ID=ubuntu
     ID_LIKE=debian
     PRETTY_NAME="Ubuntu 18.04.5 LTS"
     VERSION_ID="18.04"
     HOME_URL="https://www.ubuntu.com/"
     SUPPORT_URL="https://help.ubuntu.com/"
     BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
     PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
     VERSION_CODENAME=bionic
     UBUNTU_CODENAME=bionic
     Linux 97bea0896dfd 5.4.144+ #1 SMP Tue Dec 7 09:58:10 PST 2021 x86_64 x86_64 x86_64 GNU/Linux

     ***GPU Information***
     Fri Jan 21 21:55:38 2022
     +-----------------------------------------------------------------------------+
     | NVIDIA-SMI 495.46       Driver Version: 460.32.03    CUDA Version: 11.2     |
     |-------------------------------+----------------------+----------------------+
     | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
     | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
     |                               |                      |               MIG M. |
     |===============================+======================+======================|
     |   0  Tesla P100-PCIE...  Off  | 00000000:00:04.0 Off |                    0 |
     | N/A   42C    P0    27W / 250W |      0MiB / 16280MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+

     +-----------------------------------------------------------------------------+
     | Processes:                                                                  |
     |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
     |        ID   ID                                                   Usage      |
     |=============================================================================|
     |  No running processes found                                                 |
     +-----------------------------------------------------------------------------+

     ***CPU***
     Architecture:        x86_64
     CPU op-mode(s):      32-bit, 64-bit
     Byte Order:          Little Endian
     CPU(s):              4
     On-line CPU(s) list: 0-3
     Thread(s) per core:  2
     Core(s) per socket:  2
     Socket(s):           1
     NUMA node(s):        1
     Vendor ID:           GenuineIntel
     CPU family:          6
     Model:               63
     Model name:          Intel(R) Xeon(R) CPU @ 2.30GHz
     Stepping:            0
     CPU MHz:             2299.998
     BogoMIPS:            4599.99
     Hypervisor vendor:   KVM
     Virtualization type: full
     L1d cache:           32K
     L1i cache:           32K
     L2 cache:            256K
     L3 cache:            46080K
     NUMA node0 CPU(s):   0-3
     Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat md_clear arch_capabilities

     ***CMake***
     /usr/local/bin/cmake
     cmake version 3.12.0

     CMake suite maintained and supported by Kitware (kitware.com/cmake).

     ***g++***
     /usr/bin/g++
     g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
     Copyright (C) 2017 Free Software Foundation, Inc.
     This is free software; see the source for copying conditions.  There is NO
     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

     ***nvcc***
     /usr/local/cuda/bin/nvcc
     nvcc: NVIDIA (R) Cuda compiler driver
     Copyright (c) 2005-2020 NVIDIA Corporation
     Built on Mon_Oct_12_20:09:46_PDT_2020
     Cuda compilation tools, release 11.1, V11.1.105
     Build cuda_11.1.TC455_06.29190527_0

     ***Python***
     /root/miniconda3/bin/python
     Python 3.8.10

     ***Environment Variables***
     PATH                            : /root/miniconda3/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tools/node/bin:/tools/google-cloud-sdk/bin:/opt/bin
     LD_LIBRARY_PATH                 : /usr/lib64-nvidia
     NUMBAPRO_NVVM                   :
     NUMBAPRO_LIBDEVICE              :
     CONDA_PREFIX                    :
     PYTHON_PATH                     :

     ***conda packages***
     /root/miniconda3/bin/conda
     # packages in environment at /root/miniconda3:
     #
     # Name                    Version                   Build  Channel
     _libgcc_mutex             0.1                 conda_forge    conda-forge
     _openmp_mutex             4.5                      1_llvm    conda-forge
     abseil-cpp                20210324.2           h9c3ff4c_0    conda-forge
     aiohttp                   3.8.1            py38h497a2fe_0    conda-forge
     aiosignal                 1.2.0              pyhd8ed1ab_0    conda-forge
     alsa-lib                  1.2.3                h516909a_0    conda-forge
     anyio                     3.5.0            py38h578d9bd_0    conda-forge
     appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
     argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
     argon2-cffi-bindings      21.2.0           py38h497a2fe_1    conda-forge
     arrow-cpp                 5.0.0           py38h4dc56cc_20_cuda    conda-forge
     arrow-cpp-proc            3.0.0                      cuda    conda-forge
     asgiref                   3.4.1              pyhd8ed1ab_0    conda-forge
     asttokens                 2.0.5              pyhd8ed1ab_0    conda-forge
     async-timeout             4.0.2              pyhd8ed1ab_0    conda-forge
     attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
     aws-c-auth                0.6.8                hadad3cd_1    conda-forge
     aws-c-cal                 0.5.12               h70efedd_7    conda-forge
     aws-c-common              0.6.17               h7f98852_0    conda-forge
     aws-c-compression         0.2.14               h7c7754b_7    conda-forge
     aws-c-event-stream        0.2.7               hd2be095_32    conda-forge
     aws-c-http                0.6.10               h416565a_3    conda-forge
     aws-c-io                  0.10.14              he836878_0    conda-forge
     aws-c-mqtt                0.7.10               h885097b_0    conda-forge
     aws-c-s3                  0.1.29               h8d70ed6_0    conda-forge
     aws-c-sdkutils            0.1.1                h7c7754b_4    conda-forge
     aws-checksums             0.1.12               h7c7754b_6    conda-forge
     aws-crt-cpp               0.17.10              h6ab17b9_5    conda-forge
     aws-sdk-cpp               1.9.160              h36ff4c5_0    conda-forge
     backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
     backports                 1.0                        py_2    conda-forge
     backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
     backports.zoneinfo        0.2.1            py38h497a2fe_4    conda-forge
     bkmeans                   1.1                      pypi_0    pypi
     black                     21.12b0            pyhd8ed1ab_0    conda-forge
     bleach                    4.1.0              pyhd8ed1ab_0    conda-forge
     blis                      0.7.5                    pypi_0    pypi
     blosc                     1.21.0               h9c3ff4c_0    conda-forge
     bokeh                     2.4.0            py38h578d9bd_0    conda-forge
     boost                     1.74.0           py38h2b96118_4    conda-forge
     boost-cpp                 1.74.0               h312852a_4    conda-forge
     brish                     0.3.4.1                  pypi_0    pypi
     brotli                    1.0.9                h7f98852_6    conda-forge
     brotli-bin                1.0.9                h7f98852_6    conda-forge
     brotlipy                  0.7.0           py38h497a2fe_1003    conda-forge
     brunsli                   0.1                  h9c3ff4c_0    conda-forge
     bzip2                     1.0.8                h7f98852_4    conda-forge
     c-ares                    1.18.1               h7f98852_0    conda-forge
     c-blosc2                  2.0.4                h5f21a17_1    conda-forge
     ca-certificates           2021.10.8            ha878542_0    conda-forge
     cachetools                5.0.0              pyhd8ed1ab_0    conda-forge
     cairo                     1.16.0            h6cf1ce9_1008    conda-forge
     catalogue                 2.0.6                    pypi_0    pypi
     certifi                   2021.10.8        py38h578d9bd_1    conda-forge
     cffi                      1.14.6           py38ha65f79e_0    conda-forge
     cfitsio                   3.470                hb418390_7    conda-forge
     chardet                   4.0.0            py38h578d9bd_2    conda-forge
     charls                    2.2.0                h9c3ff4c_0    conda-forge
     charset-normalizer        2.0.10             pyhd8ed1ab_0    conda-forge
     click                     8.0.3            py38h578d9bd_1    conda-forge
     click-plugins             1.1.1                      py_0    conda-forge
     cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
     cloudpickle               2.0.0              pyhd8ed1ab_0    conda-forge
     colorama                  0.4.4                    pypi_0    pypi
     colorcet                  3.0.0              pyhd8ed1ab_0    conda-forge
     conda                     4.11.0           py38h578d9bd_0    conda-forge
     conda-package-handling    1.7.3            py38h497a2fe_1    conda-forge
     cryptography              36.0.1           py38h3e25421_0    conda-forge
     cucim                     21.12.00        cuda_11_py38_g6d1f082_0    rapidsai
     cudatoolkit               11.0.221             h6bb024c_0    nvidia
     cudf                      21.12.02        cuda_11_py38_g06540b9b37_0    rapidsai
     cudf_kafka                21.12.02        py38_g06540b9b37_0    rapidsai
     cugraph                   21.12.00        cuda11_py38_g3a43e9d0_0    rapidsai
     cuml                      21.12.00        cuda11_py38_g04c4927f3_0    rapidsai
     cupy                      9.6.0            py38h57017e2_0    conda-forge
     curl                      7.81.0               h2574ce0_0    conda-forge
     cusignal                  21.12.00        py37_g2bf865c_0    rapidsai
     cuspatial                 21.12.00        py38_gab6748f_0    rapidsai
     custreamz                 21.12.02        py38_g06540b9b37_0    rapidsai
     cuxfilter                 21.12.00        py38_g2e0fb5a_0    rapidsai
     cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
     cymem                     2.0.6                    pypi_0    pypi
     cyrus-sasl                2.1.27               h230043b_5    conda-forge
     cytoolz                   0.11.2           py38h497a2fe_1    conda-forge
     dask                      2021.11.2          pyhd8ed1ab_0    conda-forge
     dask-core                 2021.11.2          pyhd8ed1ab_0    conda-forge
     dask-cuda                 21.12.00                 py38_0    rapidsai
     dask-cudf                 21.12.02        cuda_11_py38_g06540b9b37_0    rapidsai
     dask-sql                  2021.12.0        py38h578d9bd_0    conda-forge
     dataclasses               0.8                pyhc8e2a94_3    conda-forge
     datashader                0.11.1             pyh9f0ad1d_0    conda-forge
     datashape                 0.5.4                      py_1    conda-forge
     debugpy                   1.5.1            py38h709712a_0    conda-forge
     decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
     defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
     distributed               2021.11.2        py38h578d9bd_0    conda-forge
     dlpack                    0.5                  h9c3ff4c_0    conda-forge
     dnspython                 2.2.0                    pypi_0    pypi
     entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
     executing                 0.8.2              pyhd8ed1ab_0    conda-forge
     expat                     2.4.3                h9c3ff4c_0    conda-forge
     faiss-proc                1.0.0                      cuda    rapidsai
     fastai                    2.5.3                    pypi_0    pypi
     fastapi                   0.72.0             pyhd8ed1ab_0    conda-forge
     fastavro                  1.4.9            py38h497a2fe_0    conda-forge
     fastcore                  1.3.27                   pypi_0    pypi
     fastdownload              0.0.5                    pypi_0    pypi
     fastprogress              1.0.0                    pypi_0    pypi
     fastrlock                 0.8              py38h709712a_1    conda-forge
     fiona                     1.8.20           py38hbb147eb_2    conda-forge
     flit-core                 3.6.0              pyhd8ed1ab_0    conda-forge
     font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
     font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
     font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
     font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
     fontconfig                2.13.1            hba837de_1005    conda-forge
     fonts-conda-ecosystem     1                             0    conda-forge
     fonts-conda-forge         1                             0    conda-forge
     freetype                  2.10.4               h0708190_1    conda-forge
     freexl                    1.0.6                h7f98852_0    conda-forge
     frozenlist                1.2.0            py38h497a2fe_1    conda-forge
     fsspec                    2022.1.0           pyhd8ed1ab_0    conda-forge
     gdal                      3.3.2            py38h81a01a0_3    conda-forge
     geopandas                 0.9.0              pyhd8ed1ab_1    conda-forge
     geopandas-base            0.9.0              pyhd8ed1ab_1    conda-forge
     geos                      3.9.1                h9c3ff4c_2    conda-forge
     geotiff                   1.7.0                h08e826d_2    conda-forge
     gettext                   0.19.8.1          h0b5b191_1005    conda-forge
     gflags                    2.2.2             he1b5a44_1004    conda-forge
     giflib                    5.2.1                h36c2ea0_2    conda-forge
     glog                      0.5.0                h48cff8f_0    conda-forge
     graphite2                 1.3.13            h58526e2_1001    conda-forge
     grpc-cpp                  1.42.0               ha1441d3_1    conda-forge
     h11                       0.12.0             pyhd8ed1ab_0    conda-forge
     harfbuzz                  2.9.1                h83ec7ef_1    conda-forge
     hdf4                      4.2.15               h10796ff_3    conda-forge
     hdf5                      1.12.1          nompi_h2750804_103    conda-forge
     heapdict                  1.0.1                      py_0    conda-forge
     icecream                  2.1.1                    pypi_0    pypi
     icu                       68.2                 h9c3ff4c_0    conda-forge
     idna                      2.10               pyhd3eb1b0_0
     imagecodecs               2021.8.26        py38hb5ce8f7_1    conda-forge
     imageio                   2.13.1             pyhd8ed1ab_0    conda-forge
     importlib-metadata        4.10.1           py38h578d9bd_0    conda-forge
     importlib_metadata        4.10.1               hd8ed1ab_0    conda-forge
     importlib_resources       5.4.0              pyhd8ed1ab_0    conda-forge
     ipykernel                 6.7.0            py38he5a9106_0    conda-forge
     ipython                   8.0.1            py38h578d9bd_0    conda-forge
     ipython_genutils          0.2.0                      py_1    conda-forge
     ipywidgets                7.6.5              pyhd8ed1ab_0    conda-forge
     jbig                      2.1               h7f98852_2003    conda-forge
     jedi                      0.18.1           py38h578d9bd_0    conda-forge
     jinja2                    3.0.3              pyhd8ed1ab_0    conda-forge
     joblib                    1.1.0              pyhd8ed1ab_0    conda-forge
     jpeg                      9d                   h36c2ea0_0    conda-forge
     jpype1                    1.3.0            py38h1fd1430_2    conda-forge
     json-c                    0.15                 h98cffda_0    conda-forge
     jsonschema                4.4.0              pyhd8ed1ab_0    conda-forge
     jupyter-server-proxy      3.2.0              pyhd8ed1ab_0    conda-forge
     jupyter_client            7.1.1              pyhd8ed1ab_0    conda-forge
     jupyter_core              4.9.1            py38h578d9bd_1    conda-forge
     jupyter_server            1.13.3             pyhd8ed1ab_0    conda-forge
     jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
     jupyterlab_widgets        1.0.2              pyhd8ed1ab_0    conda-forge
     jxrlib                    1.1                  h7f98852_2    conda-forge
     kealib                    1.4.14               h87e4c3c_3    conda-forge
     kiwisolver                1.3.2            py38h1fd1430_1    conda-forge
     krb5                      1.19.2               hcc1bbae_0    conda-forge
     langcodes                 3.3.0                    pypi_0    pypi
     lcms2                     2.12                 hddcbb42_0    conda-forge
     ld_impl_linux-64          2.35.1               h7274673_9
     lerc                      3.0                  h9c3ff4c_0    conda-forge
     libaec                    1.0.6                h9c3ff4c_0    conda-forge
     libblas                   3.9.0           13_linux64_openblas    conda-forge
     libbrotlicommon           1.0.9                h7f98852_6    conda-forge
     libbrotlidec              1.0.9                h7f98852_6    conda-forge
     libbrotlienc              1.0.9                h7f98852_6    conda-forge
     libcblas                  3.9.0           13_linux64_openblas    conda-forge
     libcucim                  21.12.00        cuda11_g6d1f082_0    rapidsai
     libcudf                   21.12.02        cuda11_g06540b9b37_0    rapidsai
     libcudf_kafka             21.12.02          g06540b9b37_0    rapidsai
     libcugraph                21.12.00        cuda11_g3a43e9d0_0    rapidsai
     libcuml                   21.12.00        cuda11_g04c4927f3_0    rapidsai
     libcumlprims              21.12.00        cuda11_g0a7f19f_0    nvidia
     libcurl                   7.81.0               h2574ce0_0    conda-forge
     libcusolver               11.3.2.107           hc875929_0    nvidia
     libcuspatial              21.12.00        cuda11_gab6748f_0    rapidsai
     libdap4                   3.20.6               hd7c4107_2    conda-forge
     libdeflate                1.8                  h7f98852_0    conda-forge
     libedit                   3.1.20191231         he28a2e2_2    conda-forge
     libev                     4.33                 h516909a_1    conda-forge
     libevent                  2.1.10               h9b69904_4    conda-forge
     libfaiss                  1.7.0           cuda110h8045045_8_cuda    conda-forge
     libffi                    3.3                  he6710b0_2
     libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
     libgcrypt                 1.9.4                h7f98852_0    conda-forge
     libgdal                   3.3.2                h6acdded_3    conda-forge
     libgfortran-ng            11.2.0              h69a702a_11    conda-forge
     libgfortran5              11.2.0              h5c6108e_11    conda-forge
     libglib                   2.68.4               h3e27bee_0    conda-forge
     libgpg-error              1.42                 h9c3ff4c_0    conda-forge
     libgsasl                  1.10.0               h5b4c23d_0    conda-forge
     libhwloc                  2.3.0                h5e5b7d1_1    conda-forge
     libiconv                  1.16                 h516909a_0    conda-forge
     libkml                    1.3.0             h238a007_1014    conda-forge
     liblapack                 3.9.0           13_linux64_openblas    conda-forge
     libllvm11                 11.1.0               hf817b99_2    conda-forge
     libnetcdf                 4.8.1           nompi_hb3fd0d9_101    conda-forge
     libnghttp2                1.43.0               h812cca2_1    conda-forge
     libnsl                    2.0.0                h7f98852_0    conda-forge
     libntlm                   1.4               h7f98852_1002    conda-forge
     libopenblas               0.3.18          pthreads_h8fe5266_0    conda-forge
     libpng                    1.6.37               h21135ba_2    conda-forge
     libpq                     13.5                 hd57d9b9_1    conda-forge
     libprotobuf               3.19.3               h780b84a_0    conda-forge
     librdkafka                1.6.1                hc49e61c_1    conda-forge
     librmm                    21.12.00        cuda11_g957ad04_0    rapidsai
     librttopo                 1.1.0                h1185371_6    conda-forge
     libsodium                 1.0.18               h36c2ea0_1    conda-forge
     libspatialindex           1.9.3                h9c3ff4c_4    conda-forge
     libspatialite             5.0.1                h5cf074c_8    conda-forge
     libssh2                   1.10.0               ha56f1ee_2    conda-forge
     libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
     libthrift                 0.15.0               he6d91bd_1    conda-forge
     libtiff                   4.3.0                h6f004c6_2    conda-forge
     libutf8proc               2.7.0                h7f98852_0    conda-forge
     libuuid                   2.32.1            h7f98852_1000    conda-forge
     libuv                     1.42.0               h7f98852_0    conda-forge
     libwebp                   1.2.1                h3452ae3_0    conda-forge
     libwebp-base              1.2.1                h7f98852_0    conda-forge
     libxcb                    1.13              h7f98852_1004    conda-forge
     libxgboost                1.5.0dev.rapidsai21.12      cuda11.0_0    rapidsai
     libxml2                   2.9.12               h72842e0_0    conda-forge
     libzip                    1.8.0                h4de3113_1    conda-forge
     libzlib                   1.2.11            h36c2ea0_1013    conda-forge
     libzopfli                 1.0.3                h9c3ff4c_0    conda-forge
     llvm-openmp               12.0.1               h4bd325d_1    conda-forge
     llvmlite                  0.38.0           py38h4630a5e_0    conda-forge
     locket                    0.2.0                      py_2    conda-forge
     lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
     mapclassify               2.4.3              pyhd8ed1ab_0    conda-forge
     markdown                  3.3.6              pyhd8ed1ab_0    conda-forge
     markupsafe                2.0.1            py38h497a2fe_1    conda-forge
     matplotlib-base           3.4.3            py38hf4fb855_0    conda-forge
     matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
     mistune                   0.8.4           py38h497a2fe_1005    conda-forge
     msgpack-python            1.0.3            py38h1fd1430_0    conda-forge
     multidict                 5.2.0            py38h497a2fe_1    conda-forge
     multipledispatch          0.6.0                      py_0    conda-forge
     munch                     2.5.0                      py_0    conda-forge
     murmurhash                1.0.6                    pypi_0    pypi
     mypy_extensions           0.4.3            py38h578d9bd_4    conda-forge
     nbclient                  0.5.10             pyhd8ed1ab_1    conda-forge
     nbconvert                 6.4.0            py38h578d9bd_0    conda-forge
     nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
     nccl                      2.11.4.1             h17a0586_1    conda-forge
     ncurses                   6.2                  he6710b0_1
     nest-asyncio              1.5.4              pyhd8ed1ab_0    conda-forge
     networkx                  2.6.3              pyhd8ed1ab_1    conda-forge
     nodejs                    14.17.4              h92b4a50_0    conda-forge
     notebook                  6.4.7              pyha770c72_0    conda-forge
     numba                     0.55.0           py38h4bf6c61_0    conda-forge
     numpy                     1.21.5           py38h87f13fb_0    conda-forge
     nvtx                      0.2.3            py38h497a2fe_1    conda-forge
     olefile                   0.46               pyh9f0ad1d_1    conda-forge
     openjdk                   11.0.9.1             h5cc2fde_1    conda-forge
     openjpeg                  2.4.0                hb52868f_1    conda-forge
     openssl                   1.1.1l               h7f98852_0    conda-forge
     orc                       1.7.1                h1be678f_1    conda-forge
     packaging                 21.3               pyhd8ed1ab_0    conda-forge
     pandas                    1.3.5            py38h43a58ef_0    conda-forge
     pandoc                    2.17.0.1             h7f98852_0    conda-forge
     pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
     panel                     0.12.4             pyhd8ed1ab_0    conda-forge
     param                     1.12.0             pyh6c4a22f_0    conda-forge
     parquet-cpp               1.5.1                         2    conda-forge
     parso                     0.8.3              pyhd8ed1ab_0    conda-forge
     partd                     1.2.0              pyhd8ed1ab_0    conda-forge
     pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
     pathy                     0.6.1                    pypi_0    pypi
     pcre                      8.45                 h9c3ff4c_0    conda-forge
     pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
     pickleshare               0.7.5                   py_1003    conda-forge
     pillow                    8.3.1            py38h8e6f84c_0    conda-forge
     pip                       21.3.1             pyhd8ed1ab_0    conda-forge
     pixman                    0.40.0               h36c2ea0_0    conda-forge
     platformdirs              2.3.0              pyhd8ed1ab_0    conda-forge
     pooch                     1.5.2              pyhd8ed1ab_0    conda-forge
     poppler                   21.09.0              h0e1ea10_2    conda-forge
     poppler-data              0.4.11               hd8ed1ab_0    conda-forge
     postgresql                13.5                 h2510834_1    conda-forge
     preshed                   3.0.6                    pypi_0    pypi
     proj                      8.1.0                h277dcde_1    conda-forge
     prometheus_client         0.12.0             pyhd8ed1ab_0    conda-forge
     prompt-toolkit            3.0.24             pyha770c72_0    conda-forge
     protobuf                  3.19.3           py38h709712a_0    conda-forge
     psutil                    5.9.0            py38h497a2fe_0    conda-forge
     pthread-stubs             0.4               h36c2ea0_1001    conda-forge
     ptxcompiler               0.2.0            py38hb739d79_0    rapidsai
     ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
     pure_eval                 0.2.1              pyhd8ed1ab_1    conda-forge
     py-xgboost                1.5.0dev.rapidsai21.12  cuda11.0py38_0    rapidsai
     pyarrow                   5.0.0           py38ha746e9d_20_cuda    conda-forge
     pycosat                   0.6.3           py38h497a2fe_1009    conda-forge
     pycparser                 2.20                       py_2
     pyct                      0.4.6                      py_0    conda-forge
     pyct-core                 0.4.6                      py_0    conda-forge
     pydantic                  1.8.2                    pypi_0    pypi
     pydeck                    0.5.0              pyh9f0ad1d_0    conda-forge
     pyee                      8.1.0              pyh9f0ad1d_0    conda-forge
     pygments                  2.11.2             pyhd8ed1ab_0    conda-forge
     pynight                   0.1.0                    pypi_0    pypi
     pynvml                    11.4.1             pyhd8ed1ab_0    conda-forge
     pyopenssl                 20.0.1             pyhd3eb1b0_1
     pyparsing                 3.0.7              pyhd8ed1ab_0    conda-forge
     pyppeteer                 0.2.6              pyhd8ed1ab_0    conda-forge
     pyproj                    3.1.0            py38h3701b11_4    conda-forge
     pyrsistent                0.18.1           py38h497a2fe_0    conda-forge
     pysocks                   1.7.1            py38h578d9bd_4    conda-forge
     python                    3.8.10          h49503c6_1_cpython    conda-forge
     python-confluent-kafka    1.6.0            py38h497a2fe_1    conda-forge
     python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
     python-tzdata             2021.5             pyhd8ed1ab_0    conda-forge
     python_abi                3.8                      2_cp38    conda-forge
     pytz                      2021.3             pyhd8ed1ab_0    conda-forge
     pytz-deprecation-shim     0.1.0.post0      py38h578d9bd_1    conda-forge
     pyviz_comms               2.1.0              pyhd8ed1ab_0    conda-forge
     pywavelets                1.2.0            py38h6c62de6_1    conda-forge
     pyyaml                    6.0              py38h497a2fe_3    conda-forge
     pyzmq                     22.3.0           py38h2035c66_1    conda-forge
     rapids                    21.12.00        cuda11.0_py38_gc46440c_94    rapidsai
     rapids-xgboost            21.12.00        cuda11.0_py38_gc46440c_94    rapidsai
     re2                       2021.11.01           h9c3ff4c_0    conda-forge
     readline                  8.1                  h27cfd23_0
     requests                  2.25.1             pyhd3eb1b0_0
     rmm                       21.12.00        cuda11_py38_g957ad04_0_no_cma    rapidsai
     rtree                     0.9.7            py38h02d302b_3    conda-forge
     ruamel_yaml               0.15.80         py38h497a2fe_1006    conda-forge
     s2n                       1.3.0                h9b69904_0    conda-forge
     scikit-image              0.18.1           py38h51da96c_0    conda-forge
     scikit-learn              1.0.2            py38h1561384_0    conda-forge
     scipy                     1.7.3            py38h56a6a73_0    conda-forge
     send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
     setuptools                59.8.0           py38h578d9bd_0    conda-forge
     shapely                   1.8.0            py38hb7fe4a8_0    conda-forge
     simpervisor               0.4                pyhd8ed1ab_0    conda-forge
     six                       1.16.0             pyhd3eb1b0_0
     smart-open                5.2.1                    pypi_0    pypi
     snappy                    1.1.8                he1b5a44_3    conda-forge
     sniffio                   1.2.0            py38h578d9bd_2    conda-forge
     soalpy                    0.1.0                    pypi_0    pypi
     sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
     spacy                     3.2.1                    pypi_0    pypi
     spacy-legacy              3.0.8                    pypi_0    pypi
     spacy-loggers             1.0.1                    pypi_0    pypi
     spdlog                    1.8.5                h4bd325d_0    conda-forge
     sqlite                    3.36.0               hc218d9a_0
     srsly                     2.4.2                    pypi_0    pypi
     stack_data                0.1.4              pyhd8ed1ab_0    conda-forge
     starlette                 0.17.1             pyhd8ed1ab_0    conda-forge
     streamz                   0.6.3              pyh6c4a22f_0    conda-forge
     tabulate                  0.8.9              pyhd8ed1ab_0    conda-forge
     tblib                     1.7.0              pyhd8ed1ab_0    conda-forge
     terminado                 0.12.1           py38h578d9bd_1    conda-forge
     testpath                  0.5.0              pyhd8ed1ab_0    conda-forge
     thinc                     8.0.13                   pypi_0    pypi
     threadpoolctl             3.0.0              pyh8a188c0_0    conda-forge
     tifffile                  2021.11.2          pyhd8ed1ab_0    conda-forge
     tiledb                    2.3.4                he87e0bf_0    conda-forge
     tk                        8.6.10               hbc83047_0
     tomli                     1.2.2              pyhd8ed1ab_0    conda-forge
     toolz                     0.11.2             pyhd8ed1ab_0    conda-forge
     torch                     1.10.1                   pypi_0    pypi
     torchvision               0.11.2                   pypi_0    pypi
     tornado                   6.1              py38h497a2fe_2    conda-forge
     tqdm                      4.61.2             pyhd3eb1b0_1
     traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
     treelite                  2.1.0            py38hdd725b4_0    conda-forge
     treelite-runtime          2.1.0                    pypi_0    pypi
     typed-ast                 1.5.1            py38h497a2fe_0    conda-forge
     typer                     0.4.0                    pypi_0    pypi
     typing-extensions         4.0.1                hd8ed1ab_0    conda-forge
     typing_extensions         4.0.1              pyha770c72_0    conda-forge
     tzcode                    2021e                h7f98852_0    conda-forge
     tzdata                    2021a                h52ac0ba_0
     tzlocal                   4.1              py38h578d9bd_1    conda-forge
     ucx                       1.11.2+gef2bbcf      cuda11.0_0    rapidsai
     ucx-proc                  1.0.0                       gpu    rapidsai
     ucx-py                    0.23.0          py38_gef2bbcf_0    rapidsai
     urllib3                   1.26.6             pyhd3eb1b0_1
     uvicorn                   0.17.0           py38h578d9bd_0    conda-forge
     wasabi                    0.9.0                    pypi_0    pypi
     wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
     webencodings              0.5.1                      py_1    conda-forge
     websocket-client          1.2.3              pyhd8ed1ab_0    conda-forge
     websockets                9.1              py38h497a2fe_0    conda-forge
     wheel                     0.36.2             pyhd3eb1b0_0
     widgetsnbextension        3.5.2            py38h578d9bd_1    conda-forge
     xarray                    0.20.2             pyhd8ed1ab_0    conda-forge
     xerces-c                  3.2.3                h9d8b166_3    conda-forge
     xgboost                   1.5.0dev.rapidsai21.12  cuda11.0py38_0    rapidsai
     xorg-fixesproto           5.0               h7f98852_1002    conda-forge
     xorg-inputproto           2.3.2             h7f98852_1002    conda-forge
     xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
     xorg-libice               1.0.10               h7f98852_0    conda-forge
     xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
     xorg-libx11               1.7.2                h7f98852_0    conda-forge
     xorg-libxau               1.0.9                h7f98852_0    conda-forge
     xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
     xorg-libxext              1.3.4                h7f98852_1    conda-forge
     xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
     xorg-libxi                1.7.10               h7f98852_0    conda-forge
     xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
     xorg-libxtst              1.2.3             h7f98852_1002    conda-forge
     xorg-recordproto          1.14.2            h7f98852_1002    conda-forge
     xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
     xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
     xorg-xproto               7.0.31            h7f98852_1007    conda-forge
     xz                        5.2.5                h7b6447c_0
     yaml                      0.2.5                h7b6447c_0
     yarl                      1.7.2            py38h497a2fe_1    conda-forge
     zeromq                    4.3.4                h9c3ff4c_1    conda-forge
     zfp                       0.5.5                h9c3ff4c_8    conda-forge
     zict                      2.0.0                      py_0    conda-forge
     zipp                      3.7.0              pyhd8ed1ab_0    conda-forge
     zlib                      1.2.11            h36c2ea0_1013    conda-forge
     zstd                      1.5.2                ha95c52a_0    conda-forge

</pre></details>
beckernick commented 2 years ago

This is likely coming from cupy's asarray, which is used in the DataFrame constructor when you pass a numpy array.

Would you be open to filing this issue instead at https://github.com/cupy/cupy/issues/ to consolidate discussion?

%load_ext memory_profiler
​
import numpy as np
import cupy
​
for n in (7, 8, 9):
    a = np.ones((10**n,), dtype=np.float32)
    %memit cupy.asarray(a)
peak memory: 514.58 MiB, increment: 350.82 MiB
peak memory: 1369.92 MiB, increment: 512.01 MiB
peak memory: 8899.16 MiB, increment: 4096.00 MiB
NightMachinery commented 2 years ago

@beckernick I filed an issue there, but this can only explain about half of the excess memory consumption.

beckernick commented 2 years ago

Thanks. The differences in the tests above for smaller data sizes (but same result for 9GB) is probably related to how CuPy uses pool allocators for performance.

Is CuPy's use of CPU memory affecting a cuDF or Dask workload negatively?

github-actions[bot] commented 2 years ago

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

beckernick commented 2 years ago

Closing this issue, as this is generally expected behavior and implementing a cap for CPU pinned memory that affects other libraries by default is out of scope for cuDF. Please take further discussion to the CuPy issue linked above.