Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi GPU BUGS #3

Open
WemChao opened this issue Apr 10, 2022 · 0 comments
Open

Multi GPU BUGS #3

WemChao opened this issue Apr 10, 2022 · 0 comments

Comments

@WemChao
Copy link

WemChao commented Apr 10, 2022

When this code is using a multi-card, it directly uses no CUDA Context environment switch, and pytorch uses the last environment by default, so the decoder created in front of it reports an error. Therefore I made the following changes in the C++ source code when calling the function.

torch::Tensor Decoder::decode(const std::string& data, bool stream_sync = true) {
  auto orig_device = c10::cuda::current_device();
  c10::cuda::set_device(device_id);
  ....
  c10::cuda::set_device(orig_device);
  return image_tensor;
std::vector<torch::Tensor> Decoder::batch_decode(const std::vector<std::string>& data_list, bool stream_sync = true) {
  auto orig_device = c10::cuda::current_device();
  c10::cuda::set_device(device_id);
  ....
  c10::cuda::set_device(orig_device);
  return tensor_list;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant