Skip to content

Commit

Permalink
Merge pull request nv-legate#167 from magnatelee/nccl-fix
Browse files Browse the repository at this point in the history
Turn off local function optimization for NCCL initialization
  • Loading branch information
magnatelee authored Mar 23, 2022
2 parents 486525e + 54909da commit e091ccb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 4 additions & 2 deletions legate/core/communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ def __init__(self, runtime):
self._tag = library.LEGATE_GPU_VARIANT

def _initialize(self, volume):
# This doesn't need to run on a GPu, but will use it anyway
task = Task(self._context, self._init_nccl_id, tag=self._tag)
# This doesn't need to run on a GPU, but will use it anyway
task = Task(
self._context, self._init_nccl_id, tag=self._tag, side_effect=True
)
nccl_id = task.execute_single()

task = Task(self._context, self._init_nccl, tag=self._tag)
Expand Down
15 changes: 13 additions & 2 deletions legate/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,13 @@ def update_storages(self):

class TaskLauncher:
def __init__(
self, context, task_id, mapper_id=0, tag=0, error_on_interference=True
self,
context,
task_id,
mapper_id=0,
tag=0,
error_on_interference=True,
side_effect=False,
):
assert type(tag) != bool
self._context = context
Expand All @@ -559,6 +565,7 @@ def __init__(
self._point = None
self._output_regions = list()
self._error_on_interference = error_on_interference
self._has_side_effect = side_effect

@property
def library_task_id(self):
Expand Down Expand Up @@ -733,7 +740,11 @@ def build_single_task(self, argbuf):
task.add_future(future)
for (out_req, fields) in self._out_analyzer.requirements:
out_req.add_single(task, fields)
if self._req_analyzer.empty and self._out_analyzer.empty:
if (
not self._has_side_effect
and self._req_analyzer.empty
and self._out_analyzer.empty
):
task.set_local_function(True)
if self._sharding_space is not None:
task.set_sharding_space(self._sharding_space)
Expand Down

0 comments on commit e091ccb

Please sign in to comment.