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

Method TestWrites

cpp/src/arrow/gpu/cuda_test.cc:483–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481 }
482
483 void TestWrites(const int64_t total_bytes, const int64_t chunksize,
484 const int64_t buffer_size = 0) {
485 std::shared_ptr<ResizableBuffer> buffer;
486 ASSERT_OK(MakeRandomByteBuffer(total_bytes, default_memory_pool(), &buffer));
487
488 if (buffer_size > 0) {
489 ASSERT_OK(writer_->SetBufferSize(buffer_size));
490 }
491
492 ASSERT_OK_AND_EQ(0, writer_->Tell());
493
494 const uint8_t* host_data = buffer->data();
495 ASSERT_OK(writer_->Write(host_data, chunksize));
496 ASSERT_OK_AND_EQ(chunksize, writer_->Tell());
497
498 ASSERT_OK(writer_->Seek(0));
499 ASSERT_OK_AND_EQ(0, writer_->Tell());
500
501 int64_t position = 0;
502 while (position < total_bytes) {
503 int64_t bytes_to_write = std::min(chunksize, total_bytes - position);
504 ASSERT_OK(writer_->Write(host_data + position, bytes_to_write));
505 position += bytes_to_write;
506 }
507
508 ASSERT_OK(writer_->Flush());
509
510 AssertCudaBufferEquals(*device_buffer_, *buffer);
511 }
512
513 protected:
514 std::shared_ptr<CudaBuffer> device_buffer_;

Callers

nothing calls this directly

Calls 9

MakeRandomByteBufferFunction · 0.85
default_memory_poolFunction · 0.85
AssertCudaBufferEqualsFunction · 0.85
SetBufferSizeMethod · 0.45
TellMethod · 0.45
dataMethod · 0.45
WriteMethod · 0.45
SeekMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected