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

[REVIEW] string conversion for duration types (to_durations, from_durations) #5625

Merged
merged 63 commits into from
Aug 7, 2020
Merged
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
fa3a659
add string conversion API from_durations()
karthikeyann Jul 2, 2020
26f9833
rename variables, enums
karthikeyann Jul 2, 2020
e7c9359
support isoformat single digit for H:M:S
karthikeyann Jul 3, 2020
5b91efb
add durations_tests.cpp
karthikeyann Jul 3, 2020
7eb218c
update doc for format specifiers
karthikeyann Jul 6, 2020
6a6f23e
skip trailing zero for %f specifier, %u of length 6.
karthikeyann Jul 6, 2020
c372d1e
update doc duration type, ISO format string
karthikeyann Jul 6, 2020
9c0ec8f
misc style changes
karthikeyann Jul 6, 2020
e2d008a
add dot as par of %u, %f subsecond specifier (dot not present if zero)
karthikeyann Jul 7, 2020
d61c645
style fix clang-format
karthikeyann Jul 7, 2020
10795ab
style fix spacing
karthikeyann Jul 7, 2020
907843f
add nvtx to from_durations, comments update
karthikeyann Jul 8, 2020
fc04aa6
add to_durations
karthikeyann Jul 8, 2020
7cf538e
add to_durations unit tests
karthikeyann Jul 8, 2020
8713042
style fix clang-format
karthikeyann Jul 8, 2020
be7ea2d
change log entry for PR #5625
karthikeyann Jul 8, 2020
d6899fe
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 8, 2020
cb5f473
remove units from format_compiler
karthikeyann Jul 8, 2020
99d92ee
stylefix clang-format
karthikeyann Jul 8, 2020
e087ac6
conda recipe header include
karthikeyann Jul 8, 2020
5bfd55e
add duration strings API microseconds unit test
karthikeyann Jul 8, 2020
dc01137
add converters utilities.cuh
karthikeyann Jul 9, 2020
ae02fd8
macros for cudf::test::expect_* column, table for showing line of fai…
karthikeyann Jul 9, 2020
6aa6a4d
add src/strings/convert/utilities.cuh
karthikeyann Jul 9, 2020
508369b
Apply suggestions from code review
karthikeyann Jul 9, 2020
530a723
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 9, 2020
c4fd5bd
Apply suggestions from code review (harrism)
karthikeyann Jul 10, 2020
f639cb8
review comments changes (harrism)
karthikeyann Jul 10, 2020
40309f0
use libcu++ std::chrono methods
karthikeyann Jul 13, 2020
3a13550
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 13, 2020
b658f7d
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 14, 2020
d573172
Apply suggestions from code review (davidwendt)
karthikeyann Jul 15, 2020
5045f65
style fix clang-format
karthikeyann Jul 15, 2020
5c5dad7
replace device_ptr deref with get_value
karthikeyann Jul 15, 2020
b7d7cc2
use device_uvector for duration format_items
karthikeyann Jul 15, 2020
748c95a
change for loop to transform_reduce
karthikeyann Jul 16, 2020
a1ef104
specifiers to std::format supported spec only
karthikeyann Jul 17, 2020
5e76e45
remove modulo_time
karthikeyann Jul 17, 2020
95ff3a6
remove countTrailingZeros
karthikeyann Jul 17, 2020
7cb80a4
change from_durations to std::format compliant
karthikeyann Jul 17, 2020
55afdc9
update unit tests to std::format compliant
karthikeyann Jul 17, 2020
6c5a951
update ISOFormat tests, other tests to be std::format complaint
karthikeyann Jul 17, 2020
bd1d5c8
update parsing D,H,M,S to be std::format compliant
karthikeyann Jul 17, 2020
d9ca314
update default format args
karthikeyann Jul 17, 2020
6a8b2f1
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 17, 2020
0e3bd65
add %p%R%T parse support
karthikeyann Jul 17, 2020
a3b2c47
remove runtime type_id info, use templates
karthikeyann Jul 20, 2020
ee5bf3d
move powers_of_ten to __constant__ memory (to avoid local memory access)
karthikeyann Jul 20, 2020
2e42c68
replace timeparts int32_t array with struct
karthikeyann Jul 20, 2020
0def734
stylefix lowercase struct members
karthikeyann Jul 20, 2020
b7dc79d
add parse_2digit_int, parse_hour, minute, second
karthikeyann Jul 20, 2020
b7045f1
add benchmark DuratiionsToString, StringToDurations
karthikeyann Jul 21, 2020
151fa49
optimization of integer to string function
karthikeyann Jul 22, 2020
05cbb18
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 22, 2020
85d0631
add parse tests for HMSpRT
karthikeyann Jul 27, 2020
9f7dcdb
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 27, 2020
77b518c
support all escape Characters, add unit tests
karthikeyann Jul 27, 2020
bbbe2ac
Merge branch 'branch-0.15' of github.com:rapidsai/cudf into fea-durat…
karthikeyann Jul 27, 2020
1ebfb0a
review updates (davidwendt)
karthikeyann Jul 27, 2020
f37af51
review updates (karthikeyann)
karthikeyann Jul 28, 2020
0d84102
doc update: locale -> without sign
karthikeyann Jul 28, 2020
78f94d8
doc update escaping % character
karthikeyann Jul 30, 2020
ef93d42
change benchmark name
karthikeyann Jul 30, 2020
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
26 changes: 15 additions & 11 deletions cpp/src/strings/convert/convert_durations.cu
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
#include <strings/convert/utilities.cuh>
#include <strings/utilities.cuh>

#include <thrust/transform_reduce.h>
#include <map>
#include <rmm/device_uvector.hpp>
#include <vector>
@@ -228,17 +229,20 @@ struct duration_to_string_size_fn {
auto duration = d_durations.element<T>(idx);
int32_t timeparts[DU_ARRAYSIZE] = {0}; // days, hours, minutes, seconds, subseconds(9)
dissect_duration(duration.count(), timeparts, type);
size_type string_length{0};
for (auto i = 0; i < items_count; i++) {
format_item item = d_format_items[i];
if (item.item_type == format_char_type::literal)
string_length++;
else if (item.length != -1)
string_length += item.length;
else
string_length += format_length(item.value, timeparts);
}
return string_length;
return thrust::transform_reduce(
thrust::seq,
d_format_items,
d_format_items + items_count,
[this, &timeparts] __device__(format_item item) -> size_type {
if (item.item_type == format_char_type::literal)
return 1;
else if (item.length != -1)
return item.length;
else
return format_length(item.value, timeparts);
},
size_type{0},
thrust::maximum<size_type>());
}
};