Skip to content

Commit

Permalink
stop gradient on allreduce create_token (#30)
Browse files Browse the repository at this point in the history
* stop gradient on allreduce create_token
  • Loading branch information
PhilipVinc committed Sep 23, 2020
1 parent 10551c1 commit d8f8434
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
2 changes: 0 additions & 2 deletions mpi4jax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from .collective_ops.send import Send
from .collective_ops.sendrecv import Sendrecv
from .flush import flush
from .token import create_token
from .warn import disable_omnistaging_warning

# at exit, we wait for all pending operations to finish
Expand All @@ -27,7 +26,6 @@
"Send",
"Recv",
"Sendrecv",
"create_token",
"disable_omnistaging_warning",
"flush",
]
Expand Down
4 changes: 2 additions & 2 deletions mpi4jax/collective_ops/allreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from jax.interpreters import ad, xla
from jax.lib import xla_client

from ..token import create_token
from jax.lax import create_token, stop_gradient
from ..utils import (
HashableMPIType,
_constant_s32_scalar,
Expand Down Expand Up @@ -52,7 +52,7 @@ def Allreduce(x, op, comm=_MPI.COMM_WORLD, token=None):
This result can be ignored if result forces a data dependency.
"""
if token is None:
token = create_token(x)
token = create_token(stop_gradient(x))

op = wrap_as_hashable(op)
comm = wrap_as_hashable(comm)
Expand Down
41 changes: 0 additions & 41 deletions mpi4jax/token.py

This file was deleted.

0 comments on commit d8f8434

Please sign in to comment.