GPUManager#
The Ray actor-class stores cuDF.DataFrame
-s and executes operations on it.
Public API#
- class modin.core.execution.ray.implementations.cudf_on_ray.partitioning.gpu_manager.GPUManager(gpu_id)#
Ray actor-class to store
cudf.DataFrame
-s and execute functions on it.- Parameters:
gpu_id (int) – The identifier of GPU.
- apply(first, other, func, **kwargs)#
Apply func to values associated with first/other keys of self.cudf_dataframe_dict with storing of the result.
Store the return value of func (a new
cudf.DataFrame
) into self.cudf_dataframe_dict.- Parameters:
first (int) – The first key associated with dataframe from self.cudf_dataframe_dict.
other (int or ray.ObjectRef) – The second key associated with dataframe from self.cudf_dataframe_dict. If it isn’t a real key, the func will be applied to the first only.
func (callable) – A function to apply.
**kwargs (dict) – Additional keywords arguments to be passed in func.
- Returns:
The new key of the new dataframe stored in self.cudf_dataframe_dict (will be a
ray.ObjectRef
in outside level).- Return type:
int
- apply_non_persistent(first, other, func, **kwargs)#
Apply func to values associated with first/other keys of self.cudf_dataframe_dict.
- Parameters:
first (int) – The first key associated with dataframe from self.cudf_dataframe_dict.
other (int) – The second key associated with dataframe from self.cudf_dataframe_dict. If it isn’t a real key, the func will be applied to the first only.
func (callable) – A function to apply.
**kwargs (dict) – Additional keywords arguments to be passed in func.
- Returns:
The result of the func (will be a
ray.ObjectRef
in outside level).- Return type:
The type of return of func
- free(key)#
Free the dataFrame and associated key out of self.cudf_dataframe_dict.
- Parameters:
key (int) – The key to be deleted.
- get_id()#
Get the self.gpu_id from this object.
- Returns:
The gpu_id from this object (will be a
ray.ObjectRef
in outside level).- Return type:
int
- get_oid(key)#
Get the value from self.cudf_dataframe_dict by key.
- Parameters:
key (int) – The key to get value.
- Returns:
Dataframe corresponding to key`(will be a ``ray.ObjectRef` in outside level).
- Return type:
cudf.DataFrame
- put(pandas_df)#
Convert pandas_df to
cudf.DataFrame
and put it to self.cudf_dataframe_dict.- Parameters:
pandas_df (pandas.DataFrame/pandas.Series) – A pandas DataFrame/Series to be added.
- Returns:
The key associated with added dataframe (will be a
ray.ObjectRef
in outside level).- Return type:
int
- reduce(first, others, func, axis=0, **kwargs)#
Apply func to values associated with first key and others keys of self.cudf_dataframe_dict with storing of the result.
Dataframes associated with others keys will be concatenated to one dataframe.
Store the return value of func (a new
cudf.DataFrame
) into self.cudf_dataframe_dict.- Parameters:
first (int) – The first key associated with dataframe from self.cudf_dataframe_dict.
others (list of int / list of ray.ObjectRef) – The list of keys associated with dataframe from self.cudf_dataframe_dict.
func (callable) – A function to apply.
axis ({0, 1}, default: 0) – An axis corresponding to a particular row/column of the dataframe.
**kwargs (dict) – Additional keywords arguments to be passed in func.
- Returns:
The new key of the new dataframe stored in self.cudf_dataframe_dict (will be a
ray.ObjectRef
in outside level).- Return type:
int
Notes
If
len(others) == 0
func should be able to work with 2nd positional argument with None value.
- store_new_df(df)#
Store df in self.cudf_dataframe_dict.
- Parameters:
df (cudf.DataFrame) – The
cudf.DataFrame
to be added.- Returns:
The key associated with added dataframe (will be a
ray.ObjectRef
in outside level).- Return type:
int