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

Fix testchunkedPackTwoPasses to copy from the bounce buffer #15220

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions java/src/test/java/ai/rapids/cudf/TableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3739,12 +3739,16 @@ void testChunkedPackBasic() {
}
}
}
/*

@Test
void testChunkedPackTwoPasses() {
// this test packes ~2MB worth of long into a 1MB bounce buffer
// this is 3 iterations because of the validity buffer
Long[] longs = new Long[256*1024];
for (int i = 0; i < longs.length; i++) {
// fill the column and set every other value to null
longs[i] = i % 2 == 0 ? null : (long)i;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since null is the default value for object references we could simply skip even positions

Suggested change
for (int i = 0; i < longs.length; i++) {
// fill the column and set every other value to null
longs[i] = i % 2 == 0 ? null : (long)i;
}
// Initialize elements at odd-numbered indices
for (int i = 1; i < longs.length; i += 2) {
longs[i] = (long)i;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the untouched values of longs be uninitialized (containing garbage value)?

Copy link
Contributor

@gerashegalov gerashegalov Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.12.5

Each class variable, instance variable, or array component is initialized with a default value when it is created
...
for all reference types (§4.3), the default value is null.

try (Table t1 = new Table.TestBuilder().column(longs).build();
DeviceMemoryBuffer bounceBuffer = DeviceMemoryBuffer.allocate(1L*1024*1024);
ChunkedPack cp = t1.makeChunkedPack(1L*1024*1024);
Expand All @@ -3757,7 +3761,7 @@ void testChunkedPackTwoPasses() {
while (cp.hasNext()) {
long copied = cp.next(bounceBuffer);
target.copyFromDeviceBufferAsync(
offset, target, 0, copied, Cuda.DEFAULT_STREAM);
offset, bounceBuffer, 0, copied, Cuda.DEFAULT_STREAM);
offset += copied;
}

Expand All @@ -3768,7 +3772,6 @@ void testChunkedPackTwoPasses() {
}
}
}
*/

@Test
void testContiguousSplitWithStrings() {
Expand Down
Loading