Load NDArray only to GPU if GPU is present#16432
Conversation
|
For a machine with GPU, if user want to run model on CPU only, will this change works for him? |
|
This change only affects the case where a MXNet cuda-enabled build is used on a CPU-only machine. It avoids a crash that currently happens. So the use-case you describe is not affected. |
|
So if user want to use MXNet cuda-enabled build on a GPU equipped machine, but want to run model on its CPU, is this case supported? |
|
Yes. It is already supported currently. Nothing is changed with respect to that. The problem addressed here, is that a serialized ndarray encodes the context it lived on before serialization. When loading it, and no GPU is present, MXNet crashes as it attempts to load the array to GPU. With this PR, we fallback to loading to CPU. This is already done for CPU-only builds of MXNet. |
* Load NDArray only to GPU if GPU is present * Add test
Description
Fix #16399
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments