Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting DataFrames does not free up GPU memory #177

Closed
ayushdg opened this issue Jul 31, 2018 · 2 comments
Closed

Deleting DataFrames does not free up GPU memory #177

ayushdg opened this issue Jul 31, 2018 · 2 comments

Comments

@ayushdg
Copy link
Member

ayushdg commented Jul 31, 2018

import numpy as np
from pygdf import DataFrame

record = np.array([(2,3),(4,5)], dtype = np.dtype('i8,i8'))
gdf = DataFrame.from_records(record)
del(gdf)

Expected: Gpu memory taken up by the dataframe will be freed.

Actual:

Tue Jul 31 11:54:08 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.45                 Driver Version: 396.45                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 710      Off  | 00000000:01:00.0 N/A |                  N/A |
| 50%   47C    P8    N/A /  N/A |     11MiB /  2000MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
|   1  TITAN V             Off  | 00000000:02:00.0 Off |                  N/A |
| 29%   42C    P8    28W / 250W |   410MiB  / 12066MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0                    Not Supported                                       |
|    1     12145      C   python                                       410MiB |
+-----------------------------------------------------------------------------+

It's not a major issue during data exploration and basic analysis, but when working with multiple dataframes, not having the ability to manually delete the ones which are not needed anymore is resulting in CUDA OOM errors.

@kkraus14
Copy link
Collaborator

kkraus14 commented Aug 1, 2018

@ayushdg since Numba is the allocator / deallocator of the memory, it follows Numba's CUDA memory management rules. In this case by default Numba won't try to deallocate memory until you hit 20% of the device memory (~2.4GB in your case). Can you try creating a larger dataframe and then calling the del and seeing if it frees the memory to confirm it's working on your end?

See http://numba.pydata.org/numba-doc/latest/cuda/memory.html#deallocation-behavior for more information.

@ayushdg
Copy link
Member Author

ayushdg commented Aug 2, 2018

Yeah. Testing on larger dataframes confirmed that when data in the deallocation queue exeeded 20% of the gpu memory it automatically deallocated the memory based on the deallocation behvaiour specified by Numba.

@ayushdg ayushdg closed this as completed Aug 2, 2018
mike-wendt pushed a commit that referenced this issue Oct 26, 2018
[REVIEW] Make gdf_is_valid inline rather than static (Fix #176)
rapids-bot bot pushed a commit that referenced this issue May 11, 2022
Compile warning introduced with merge of PR #10802 

```
10 warnings like this:
12:43:23 $SRC_DIR/cpp/src/search/search.cu(108): warning #177-D: parameter "args" was declared but never referenced
12:43:23           detected during instantiation of function "lambda [](auto &&...)->auto [with <auto-1>=<rmm::exec_policy, const
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default> &, 
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default>, const 
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default> &, 
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default>, cudf::size_type *const &, 
const cudf::row_lexicographic_comparator<cudf::nullate::DYNAMIC> &>]" 
12:43:23 (121): here
```

Line 108 has a lambda refactoring that seems to confuse the compiler. 
```
  auto const do_search = [find_first](auto&&... args) {
    if (find_first) {
      thrust::lower_bound(std::forward<decltype(args)>(args)...);
    } else {
      thrust::upper_bound(std::forward<decltype(args)>(args)...);
    }
  };
  do_search(rmm::exec_policy(stream),
            count_it,  count_it + haystack.num_rows(), count_it, count_it + needles.num_rows(),
            out_it, comp);
```

The warning is wrong and the compiler generates the correct code so this is likely a compiler bug.

This PR fixes the warning by replacing the lambda with an if statement.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Yunsong Wang (https://github.com/PointKernel)

URL: #10827
rapids-bot bot pushed a commit that referenced this issue Aug 26, 2022
Fixes compile warning introduced in #11534 
```
/cudf/cpp/src/io/json/nested_json_gpu.cu(970): warning #177-D: variable "single_item_count" was declared but never referenced
```
Removed unreferenced variable declaration.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Bradley Dice (https://github.com/bdice)

URL: #11607
rapids-bot bot pushed a commit that referenced this issue Sep 29, 2022
Compile warning was introduced in #11652 in `bgzip_data_chunk_source.cu`. The warning can be seen here https://gpuci.gpuopenanalytics.com/job/rapidsai/job/gpuci/job/cudf/job/prb/job/cudf-cpu-cuda-build/CUDA=11.5/12417/consoleFull (search for `177-D`)
```
/cudf/cpp/src/io/text/bgzip_data_chunk_source.cu(362): warning #177-D: variable "nvtx3_range__" was declared but never referenced
```
The `nvtx3_range__` is part of the `CUDF_FUNC_RANGE()` macro. The warning is incorrect and likely a compiler bug. The workaround in this PR is to add `[[maybe_unused]]` to the variable declaration.

I was not able to create a small reproducer for compile bug filing.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Tobias Ribizel (https://github.com/upsj)
  - MithunR (https://github.com/mythrocks)

URL: #11798
rapids-bot bot pushed a commit that referenced this issue Apr 10, 2023
Fixes a minor compile error/warnings for unused variables in the `cpp/src/io/parquet/page_data.cu` source file.

```
cudf/cpp/src/io/parquet/page_data.cu -o CMakeFiles/cudf.dir/src/io/parquet/page_data.cu.o
/cudf/cpp/src/io/parquet/page_data.cu(636): error #177-D: parameter "s" was declared but never referenced

/cudf/cpp/src/io/parquet/page_data.cu(343): error #177-D: parameter "sb" was declared but never referenced
          detected during instantiation of "cuda::std::__4::pair<int, int> cudf::io::parquet::gpu::<unnamed>::gpuDecodeDictionaryIndices<sizes_only>(volatile cudf::io::parquet::gpu::<unnamed>::page_state_s *, volatile cudf::io::parquet::gpu::<unnamed>::page_state_buffers_s *, int, int) [with sizes_only=true]" 
(1720): here

/cudf/cpp/src/io/parquet/page_data.cu(527): error #177-D: parameter "sb" was declared but never referenced
          detected during instantiation of "cudf::size_type cudf::io::parquet::gpu::<unnamed>::gpuInitStringDescriptors<sizes_only>(volatile cudf::io::parquet::gpu::<unnamed>::page_state_s *, volatile cudf::io::parquet::gpu::<unnamed>::page_state_buffers_s *, int, int) [with sizes_only=true]" 
(1724): here

3 errors detected in the compilation of "/cudf/cpp/src/io/parquet/page_data.cu".

```

Found these with a Debug build using nvcc 11.5 and gcc 9.5.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Divye Gala (https://github.com/divyegala)
  - Vukasin Milovanovic (https://github.com/vuule)
  - Karthikeyan (https://github.com/karthikeyann)

URL: #13093
rapids-bot bot pushed a commit that referenced this issue Apr 24, 2023
Fixes unused parameter warning/error introduced by #13143 in `grouped_rolling.cu`
```
CMakeFiles/cudf.dir/src/rolling/grouped_rolling.cu.o
/cudf/cpp/src/rolling/grouped_rolling.cu(280): error #177-D: parameter "delta" was declared but never referenced
```
This was found when building with nvcc 11.5.
I was hoping there would be some clever partial specialization or function overloading that could be done here but none were as clean as the current implementation. Solution was to just add `[[maybe_unused]]` to offending parameter declaration.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Bradley Dice (https://github.com/bdice)

URL: #13192
rapids-bot bot pushed a commit that referenced this issue May 2, 2023
Fix some unused variables/parameters warnings introduced by #13076.
My old nvcc 11.5 compiler found these. Removing some of these found functions that could be removed as well.
Some variables/parameters are now declared with `[[maybe_unused]]`

```
/cudf/cpp/src/io/parquet/writer_impl.cu(575): error #177-D: variable "data_col_type" was declared but never referenced

/cudf/cpp/src/io/parquet/writer_impl.cu(906): error #177-D: parameter "stream" was declared but never referenced

/cudf/cpp/src/io/parquet/writer_impl.cu(908): error #177-D: variable "col" was declared but never referenced

/cudf/cpp/src/io/parquet/writer_impl.cu(1290): error #177-D: parameter "max_page_uncomp_data_size" was declared but never referenced

/cudf/cpp/src/io/parquet/writer_impl.cu(1411): error #177-D: parameter "input" was declared but never referenced

/cudf/cpp/src/io/parquet/writer_impl.cu(1712): error #177-D: variable "dict_info_owner" was declared but never referenced

```

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Karthikeyan (https://github.com/karthikeyann)

URL: #13263
rapids-bot bot pushed a commit that referenced this issue May 17, 2023
Fixed unused parameters warning/error in the `parquet/page_data.cu`:
```
/cudf/cpp/src/io/parquet/page_data.cu(171): error #177-D: parameter "is_decode_step" was declared but never referenced
          detected during:
            instantiation of "__nv_bool cudf::io::parquet::gpu::<unnamed>::setupLocalPageInfo(cudf::io::parquet::gpu::<unnamed>::page_state_s *, const cudf::io::parquet::gpu::PageInfo *, cudf::device_span<const cudf::io::parquet::gpu::ColumnChunkDesc, 18446744073709551615UL>, size_t, size_t, __nv_bool, cudf::io::parquet::gpu::rle_stream<level_t> *) [with level_t=uint8_t]" 
(1825): here
            instantiation of "void cudf::io::parquet::gpu::<unnamed>::gpuComputePageSizes<lvl_buf_size,level_t>(cudf::io::parquet::gpu::PageInfo *, cudf::device_span<const cudf::io::parquet::gpu::ColumnChunkDesc, 18446744073709551615UL>, size_t, size_t, __nv_bool, __nv_bool) [with lvl_buf_size=2048, level_t=uint8_t]" 
(2197): here

/cudf/cpp/src/io/parquet/page_data.cu(172): error #177-D: parameter "decoders" was declared but never referenced
          detected during:
            instantiation of "__nv_bool cudf::io::parquet::gpu::<unnamed>::setupLocalPageInfo(cudf::io::parquet::gpu::<unnamed>::page_state_s *, const cudf::io::parquet::gpu::PageInfo *, cudf::device_span<const cudf::io::parquet::gpu::ColumnChunkDesc, 18446744073709551615UL>, size_t, size_t, __nv_bool, cudf::io::parquet::gpu::rle_stream<level_t> *) [with level_t=uint8_t]" 
(1825): here
            instantiation of "void cudf::io::parquet::gpu::<unnamed>::gpuComputePageSizes<lvl_buf_size,level_t>(cudf::io::parquet::gpu::PageInfo *, cudf::device_span<const cudf::io::parquet::gpu::ColumnChunkDesc, 18446744073709551615UL>, size_t, size_t, __nv_bool, __nv_bool) [with lvl_buf_size=2048, level_t=uint8_t]" 
(2197): here

2 errors detected in the compilation of "/cudf/cpp/src/io/parquet/page_data.cu".
```
Removing the parameters seemed to work and gtests are passing.
This was found by building with nvcc 11.5.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Divye Gala (https://github.com/divyegala)
  - Bradley Dice (https://github.com/bdice)
  - https://github.com/nvdbaranec

URL: #13367
rapids-bot bot pushed a commit that referenced this issue Jun 26, 2023
Fixes compile warning found in `cpp/src/strings/split/split_re.cu` for unused declared variable
```
/cudf/cpp/src/strings/split/split_re.cu(83): error #177-D: structured binding "end_pos" was declared but never referenced
```

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Bradley Dice (https://github.com/bdice)
  - Mike Wilson (https://github.com/hyperbolic2346)

URL: #13621
PointKernel added a commit to PointKernel/cudf that referenced this issue Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants