This question is difficult to solve reliably without access to sample data, but the code snippet below should be a good starting point for adjusting to actual use-case.
As general advice, I'd recommend to first solve a smaller case using pandas
(since both dask and cudf provide the ability to operate on pandas dataframes):
from pandas import DataFrame, concat
df = DataFrame({"a": [[1, 2], [3, 4]], "b": [[5, 7], [9, 11]]})
def calculate_difference(df):
# create dfs using https://stackoverflow.com/a/35491399/10693596
_a = DataFrame(df["a"].tolist(), columns=["0", "1"], index=df.index)
_b = DataFrame(df["b"].tolist(), columns=["0", "1"], index=df.index)
_diff = _a - _b
return concat([df, _diff], axis=1)
print(calculate_difference(df))
# a b 0 1
# 0 [1, 2] [5, 7] -4 -5
# 1 [3, 4] [9, 11] -6 -7
In the function, we rely on this answer to first convert the data into columns with consistent indexing, and then find the difference in column values.
Assuming the above generates the desired result, we can map the function across dataframe chunks (since operations are done row-wise, there is no need for data exchange across partitions):
from dask.dataframe import from_pandas
# will use the pandas example to provide meta (highly recommended)
meta = calculate_difference(df)
ddf = from_pandas(df, npartitions=1)
ddf = ddf.map_partitions(calculate_difference, meta=meta)
print(ddf.compute())
# a b 0 1
# 0 [1, 2] [5, 7] -4 -5
# 1 [3, 4] [9, 11] -6 -7
For dask cudf, you could convert the dask cudf into dask dataframe:
from dask_cudf import from_cudf
# assuming df is a cudf dataframe
ddf = from_cudf(df, npartitions=2)
# will use the pandas example to provide meta (highly recommended)
meta = calculate_difference(df.head(3))
ddf = ddf.map_partitions(calculate_difference, meta=meta)