MCPcopy Create free account
hub / github.com/apache/arrow / Write

Method Write

cpp/src/arrow/gpu/cuda_memory.cc:368–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366 }
367
368 Status Write(const void* data, int64_t nbytes) {
369 CHECK_CLOSED();
370 if (nbytes == 0) {
371 return Status::OK();
372 }
373
374 if (buffer_size_ > 0) {
375 if (nbytes + buffer_position_ >= buffer_size_) {
376 // Reach end of buffer, write everything
377 RETURN_NOT_OK(Flush());
378 RETURN_NOT_OK(context_->CopyHostToDevice(address_ + position_, data, nbytes));
379 } else {
380 // Write bytes to buffer
381 std::memcpy(host_buffer_data_ + buffer_position_, data, nbytes);
382 buffer_position_ += nbytes;
383 }
384 } else {
385 // Unbuffered write
386 RETURN_NOT_OK(context_->CopyHostToDevice(address_ + position_, data, nbytes));
387 }
388 position_ += nbytes;
389 return Status::OK();
390 }
391
392 Status WriteAt(int64_t position, const void* data, int64_t nbytes) {
393 std::lock_guard<std::mutex> guard(lock_);

Callers

nothing calls this directly

Calls 3

FlushFunction · 0.85
OKFunction · 0.50
CopyHostToDeviceMethod · 0.45

Tested by

no test coverage detected