Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions python/cocoindex/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
Awaitable,
Callable,
Protocol,
ParamSpec,
TypeVar,
Type,
cast,
dataclass_transform,
Annotated,
get_args,
Expand Down Expand Up @@ -125,9 +121,6 @@ def __call__(
return (result_type, executor)


_gpu_dispatch_lock = asyncio.Lock()


_COCOINDEX_ATTR_PREFIX = "cocoindex.io/"


Expand Down Expand Up @@ -348,16 +341,7 @@ async def __call__(self, *args: Any, **kwargs: Any) -> Any:
decoded_kwargs[kwarg_name] = kwarg_info.decoder(arg)

assert self._acall is not None
if op_args.gpu:
# For GPU executions, data-level parallelism is applied, so we don't want to
# execute different tasks in parallel.
# Besides, multiprocessing is more appropriate for pytorch.
# For now, we use a lock to ensure only one task is executed at a time.
# TODO: Implement multi-processing dispatching.
async with _gpu_dispatch_lock:
output = await self._acall(*decoded_args, **decoded_kwargs)
else:
output = await self._acall(*decoded_args, **decoded_kwargs)
output = await self._acall(*decoded_args, **decoded_kwargs)
return self._result_encoder(output)

def enable_cache(self) -> bool:
Expand Down
Loading