A data engineer loads a 10 GB CSV file into a cuDF DataFrame and then needs to join it with a 500 MB lookup table that currently lives in a pandas DataFrame. Which approach correctly brings both tables onto the GPU so that the merge operation runs entirely on GPU memory?
- APass the pandas DataFrame directly to cudf.merge as the right-hand argument; cuDF will convert it automatically during the merge.
- BConvert the cuDF DataFrame to pandas using the to_pandas method and perform the merge in pandas on the CPU, then reload the result into cuDF.
- CConvert the pandas DataFrame to a cuDF DataFrame using cudf.from_pandas before calling the merge operation on the two cuDF objects. Correct
- DUse the cudf.pandas accelerator module so that both DataFrames are transparently promoted to GPU; no explicit conversion call is needed.
Why A is wrong: Tempting because cuDF's merge signature resembles pandas, but cuDF does not silently convert a pandas object passed as the right-hand frame - it raises a TypeError, so the merge would fail before running.
Why B is wrong: This approach moves 10 GB from device to host, loses the GPU acceleration for the merge, and then requires another host-to-device copy for subsequent GPU work - the opposite of the intended workflow.
Why C is correct: cudf.from_pandas copies the host-side pandas data to GPU memory, producing a cuDF DataFrame. Both frames are then on the GPU, so the merge executes entirely on the device without further host-device transfers.
Why D is wrong: The cudf.pandas accelerator intercepts pandas API calls on objects created after the module is activated, but a pandas DataFrame that already exists in memory before activation is not retroactively transferred to GPU without an explicit conversion step.