 // TODO(sonots): support stream
 void CudaDevice::Mul(const Array& lhs, const Array& rhs, Array& out) {
     CheckDevicesCompatible({lhs, rhs, out});
+    cudaSetDevice(index());
     VisitDtype(lhs.dtype(), [&](auto pt) {
         using T = typename decltype(pt)::type;
         static const int kMaxBlockSize = CudaOccupancyMaxPotentialBlockSize(&MulKernel<T>).block_size;

#include "xchainer/cuda/cuda_device.h"

#include "xchainer/array.h"
#include "xchainer/cuda/cuda_runtime.h"

// TODO(sonots): support stream
void CudaDevice::Add(const Array& lhs, const Array& rhs, Array& out) {
    CheckDevicesCompatible({lhs, rhs, out});
    cudaSetDevice(index());
    VisitDtype(lhs.dtype(), [&](auto pt) {
        using T = typename decltype(pt)::type;
        static const int kMaxBlockSize = CudaOccupancyMaxPotentialBlockSize(&AddKernel<T>).block_size;
