| 164 | } |
| 165 | |
| 166 | Status CudaBuffer::CopyFromHost(const int64_t position, const void* data, |
| 167 | int64_t nbytes) { |
| 168 | if (nbytes > size_ - position) { |
| 169 | return Status::Invalid("Copy would overflow buffer"); |
| 170 | } |
| 171 | return context_->CopyHostToDevice(const_cast<uint8_t*>(data_) + position, data, nbytes); |
| 172 | } |
| 173 | |
| 174 | Status CudaBuffer::CopyFromDevice(const int64_t position, const void* data, |
| 175 | int64_t nbytes) { |