NVIDIA / NVIDIA/apex

RuntimeError: reduce failed to synchronize: device-side assert triggered

Open
#471 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

It's the first time to try Apex in pytorch, several minor problems I've met were solved when I run my code. But when I think it was successful after running several minutes normally,the error below occurred.

/opt/conda/conda-bld/pytorch_1556653183467/work/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [8,0,0], thread: [94,0,0] Assertion input >= 0. && input <= 1. failed.
/opt/conda/conda-bld/pytorch_1556653183467/work/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [8,0,0], thread: [95,0,0] Assertion input >= 0. && input <= 1. failed.
/opt/conda/conda-bld/pytorch_1556653183467/work/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [8,0,0], thread: [96,0,0] Assertion input >= 0. && input <= 1. failed.

Traceback (most recent call last):
a = self.bce_loss(y_true, y_pred)
File "/home/sensetime/anaconda2/envs/pytorch1.1.0-py3-gdal/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/sensetime/anaconda2/envs/pytorch1.1.0-py3-gdal/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 512, in forward
return F.binary_cross_entropy(input, target, weight=self.weight, reduction=self.reduction)
File "/home/sensetime/anaconda2/envs/pytorch1.1.0-py3-gdal/lib/python3.6/site-packages/apex/amp/wrap.py", line 129, in wrapper
return orig_fn(*args, **kwargs)
File "/home/sensetime/anaconda2/envs/pytorch1.1.0-py3-gdal/lib/python3.6/site-packages/torch/nn/functional.py", line 2113, in binary_cross_entropy
input, target, weight, reduction_enum)
RuntimeError: reduce failed to synchronize: device-side assert triggered

How to solve them?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the BCECriterion.cu assertion shown in the error and the binary_cross_entropy call in torch/nn/functional.py. Check how Apex's amp/wrap.py reaches that loss and determine why the input violates the reported range. Done means identifying whether the failure belongs to Apex or the calling code and documenting a reproducible resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.