You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/10/11 12:31:47 UTC
[GitHub] [incubator-mxnet] LourisXu opened a new issue #19332: Ndarray support extension problem
LourisXu opened a new issue #19332:
URL: https://github.com/apache/incubator-mxnet/issues/19332
For example, in parallel computing with multiple GPUs, I choose sigmoid binary cross entropy loss as the loss function to calculate the loss. For the fourth parameter POS_ Weight needs to load multiple weights to each GPU at the same time, and then each GPU uses its corresponding weight to calculate the loss of parallel computing.
The code is shown below:
```python
ctx = [mx.gpu(), mx.gpu(1))
pos_weights = []
for ctx_i in ctx: # load multiple weights to gpus
w = nd.array(pos_weight, ctx=ctx_i)
pos_weights.append(w)
...
for i, batch in enumerate(train_iter):
Xs, ys, batch_size = _get_batch(batch, ctx)
ls = []
with autograd.record():
y_hats = [net(X) for X in Xs]
ls = [loss(y_hat, y, None, pos_weights[ctx.index(y.context)]) for y_hat, y in zip(y_hats, ys)] # each gpu use its corresponding pos_weight to calcualte the loss
for l in ls:
l.backward()
```
If you don't, the following problems may ariseļ¼
```python
mxnet/mshadow/mshadow/./stream_gpu-inl.h:62: Check failed: e == cudaSuccess CUDA: an illegal memory access was encountered
Check failed: type_ != nullptr: The any container is empty requested=N5mxnet
```
So, is there any other simpler method or API similar to model loading on multiple GPUs to achieve this goal
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org
[GitHub] [incubator-mxnet] github-actions[bot] commented on issue #19332: Ndarray support extension problem
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #19332:
URL: https://github.com/apache/incubator-mxnet/issues/19332#issuecomment-706698109
Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue.
Please make sure to include all the relevant context, and one of the @apache/mxnet-committers will be here shortly.
If you are interested in contributing to our project, let us know! Also, be sure to check out our guide on [contributing to MXNet](https://mxnet.apache.org/community/contribute) and our [development guides wiki](https://cwiki.apache.org/confluence/display/MXNET/Developments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org